Gosh this is frustrating.

I'm trying to work out a better way of starting umls whilst using
dhcp address allocation.

Currently I approach this by having the uml fs ssh the ip address it
gets from dhcp to a known host.

Doing that requires a lot of infrastructure though. It's quite
fragile.


What I'd really like to be able to do is this:

  umlboot ... umid=someid &
  mconsole someid
    proc/net/ipaddress

but the proc fs doesn't supply the ip address.

It's really frustrating that proc doesn't have a simple mapping for
the IP address. Anyone know why not?


Anyway, I might have a solution and I wanted to see what people here
think.

mconsole does allow you to access the proc mapped process data. If you
can find the dhcp client you can do this:

  (someid) proc/966/fd/4
  OK 
  lease {
    interface "eth0";
    fixed-address 192.168.1.127;
    option subnet-mask 255.255.255.0;
    option routers 192.168.1.1;
    option domain-name-servers 192.168.1.1;
    option broadcast-address 192.168.1.255;
    option dhcp-lease-time 43200;
    option dhcp-message-type 5;
    option dhcp-server-identifier 192.168.1.1;
    option dhcp-renewal-time 21600;
    option dhcp-rebinding-time 37800;
    renew 4 2006/10/5 19:07:10;
    rebind 4 2006/10/5 23:37:10;
    expire 5 2006/10/6 01:07:10;
  }

to get the actual lease data for the interface.

I could then parse the lease data and establish the current ip.

This is _quite_ a good solution... it requires no changes to the uml
filesystem. It does require the dhcp client to have the lease file
open. This works on ISC's dhcp client but I haven't tried any others
yet.


Another alternative would be to alter the filesystem providing a
script to be called when the dhcp address comes in. The script can
call another script with the current IP address and interface in the
cmdline. The new script simply hangs forever. mconsole could then find
the process associated with the script and read it's command line.

This would involve a lot less infrastructure than ssh-ing the IP out
of the uml. But it still involves some.


Both of these methods have the big down point that there is no way to
iterate over the proc fs from mconsole. So one would have to do it by
brute force:

  for i in `seq 1 2000`
  do 
    if [ mconsole someid proc/$i/cmdline | grep 'dhclient' ]
    then
      for j in `seq 1 20`
      do
        if [ mconsole someid proc/$i/fd/$j | grep 'lease' ]
        then
          work_out_ip_address `mconsole someid proc/$i/fd/$j`
        fi
      done
      break
    fi
  done

That's a bit boring. Maybe I could change mconsole so that it can
provide dir contents from proc as well.


The final alternative is that I fix proc so that it contains:

   /net/dev/inet_address

with a list of inet interfaces and their inet address.


Does anyone here have an opinion about this?

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   for all your tapsell ferrier needs

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to