Search code examples
debiandhcp

which program invokes dhclient on debian squeeze?


I'm curious about which program invokes dhclient on Debian squeeze?

I suspect it's NetworkManager but it's not true. Since I have removed it (apt-get remove NetworkManager) and rebooted the computer.

The dhclient program runs as usual. See:

~$ ps aux|grep dhclient

root      2042  0.0  0.0   2332   532 ?        Ss   09:47   0:00 dhclient -v -pf /var/run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0

I also grep for dhclient in /etc but there are no sufficient hints (not found the caller).

How is the dhclient program being invoked on Debian Squeeze?


Solution

  • It's coded in ifupdown.

    http://packages.debian.org/stable/ifupdown

    Download the souce and

    make inet.c

    Check the function dhcp_up() :

    static int dhcp_up(interface_defn *ifd, execfn *exec) {
    {
      if (!execute("[[ifconfig %iface% hw %hwaddress%]]", ifd, exec)) return 0;
    }
    if ( execable("/sbin/dhclient3") ) {
      if (!execute("dhclient3 -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp3/dhclient.%iface%.leases %iface%", ifd, exec)) return 0;
    }
    else if ( execable("/sbin/dhclient") ) {
      if (!execute("dhclient -v -pf /var/run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases %iface%", ifd, exec)) return 0;
    }
    else if ( execable("/sbin/pump") && mylinuxver() >= mylinux(2,1,100) ) {
      if (!execute("pump -i %iface% [[-h %hostname%]] [[-l %leasehours%]]", ifd, exec)) return 0;
    }
    else if ( execable("/sbin/udhcpc") && mylinuxver() >= mylinux(2,2,0) ) {
      if (!execute("udhcpc -n -p /var/run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]]            [[-c %client%]]", ifd, exec)) return 0;
    }
    else if ( execable("/sbin/dhcpcd") ) {
      if (!execute("dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]]            [[-l %leasetime%]] %iface%", ifd, exec)) return 0;
    }
    return 1;
    }