Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 8917 - allow network startup scripts to use any dhcp client
Summary: allow network startup scripts to use any dhcp client
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: x86 Linux
: Lowest enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 20556 40532 44184 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-08 22:53 UTC by John R. Makosky
Modified: 2004-10-02 22:17 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch agains net.eth0 v1.17 (net.eth0-1.17.diff,2.01 KB, patch)
2002-10-10 08:35 UTC, John R. Makosky
Details | Diff
patch against /etc/conf.d/net v1.5 (net-1.5.diff,1.37 KB, patch)
2002-10-10 08:36 UTC, John R. Makosky
Details | Diff
patch against /etc/dhcp/dhclient.conf-sample (dhclient.conf.diff,2.25 KB, patch)
2002-10-10 08:37 UTC, John R. Makosky
Details | Diff
patch against /etc/dhcp/dhclient-script-sample to support interface MTU (dhclient-script.diff,1.56 KB, patch)
2002-10-10 08:38 UTC, John R. Makosky
Details | Diff
allows a custom dhcp command (net-custom-dhcp.patch,841 bytes, patch)
2003-12-08 10:54 UTC, Luke-Jr
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John R. Makosky 2002-10-08 22:53:44 UTC
In order to set interface MTU via DHCP, it was necessary for me to use ISC
dhclient provided by net-misc/dhcp, as I couldn't find support for this in
dhcpcd.  I've modified the following scripts to handle system startup
appropriately.  Set iface_eth0="isc_dhclient" to make it work.  Diffs follow for:

/etc/init.d/net.eth0
/etc/conf.d/net
/etc/dhcp/dhclient.conf.sample         -> dhclient.conf
/etc/dhcp/dhclient-script.sample       -> dhclient-script.conf

Note: it's probably not necessary to support both dhcpcd and ISC dhclient in the
system startup scripts.  Since dhclient seems to be more flexible than dhcpcd,
it might be best to someday make it the default DHCP client.  Something to kick
around...


--------------------------------------8<----------------------------------------
*** net.eth0.orig       Tue Oct  8 21:25:47 2002
--- net.eth0    Tue Oct  8 20:35:30 2002
***************
*** 5,11 ****
  
  #NB: Config is in /etc/conf.d/net
  
- 
  # For pcmcia users. note that pcmcia must be added to the same
  # runlevel as the net.* script that needs it.
  depend() {
--- 5,10 ----
***************
*** 26,40 ****
        local dhcp_args="$(eval echo \$\{dhcpcd_${IFACE}\})"
        local retval=0
        ebegin "Bringing ${IFACE} up"
!       if [ "$(eval echo \$\{iface_${IFACE}\})" != "dhcp" ]
        then
!               /sbin/ifconfig ${IFACE} ${iface_args} >/dev/null || {
!                       retval=$?
!                       eend ${retval} "Failed to bring ${IFACE} up"
!                       return ${retval}
!               }
        else
!               /sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || {
                        retval=$?
                        eend ${retval} "Failed to bring ${IFACE} up"
                        return ${retval}
--- 25,51 ----
        local dhcp_args="$(eval echo \$\{dhcpcd_${IFACE}\})"
        local retval=0
        ebegin "Bringing ${IFACE} up"
!       # dhcpcd
!       if [ "$(eval echo \$\{iface_${IFACE}\})" == "dhcp" ] 
        then
!                 /sbin/dhcpcd ${dhcp_args} ${IFACE} >/dev/null || {
!                         retval=$?
!                         eend ${retval} "Failed to bring ${IFACE} up"
!                         return ${retval}
!                 }
! 
!       # isc_dhclient
!         elif [ "$(eval echo \$\{iface_${IFACE}\})" == "isc_dhclient" ]
!         then
!                 /sbin/dhclient ${isc_dhclient_args} ${IFACE} > /dev/null || {
!                         retval=R?
!                         eend ${retval} "Failed to bring ${IFACE} up"
!                         return ${retval}
!                 }
! 
!       # static config
        else
!               /sbin/ifconfig ${IFACE} ${iface_args} >/dev/null || {
                        retval=$?
                        eend ${retval} "Failed to bring ${IFACE} up"
                        return ${retval}
***************
*** 149,154 ****
--- 160,169 ----
                        count=$((count + 1))
                done
                echo "done"
+       elif [ "$(eval echo \$\{iface_${IFACE}\})" == "dhclient" ]
+       then
+               kill `cat /var/run/dhclient.pid` > /dev/null 2>&1
+       
        else
                /sbin/ifconfig ${IFACE} down >/dev/null
        fi



--------------------------------------------------8<--------------------------

*** net.orig    Tue Oct  8 21:25:33 2002
--- net Tue Oct  8 20:33:03 2002
***************
*** 6,20 ****
  
  # This is basically the ifconfig argument without the ifconfig $iface
  #
! iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
  #iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"
  
  # For DHCP set iface_eth? to "dhcp"
  # For passing options to dhcpcd use dhcpcd_eth?
  #
! #iface_eth0="dhcp"
  #dhcpcd_eth0="..."
  
  # For adding aliases to a interface
  #
  #alias_eth0="192.168.0.3 192.168.0.4"
--- 6,25 ----
  
  # This is basically the ifconfig argument without the ifconfig $iface
  #
! #iface_eth0="192.168.130.180 broadcast 192.168.130.191 netmask 255.255.255.192
mtu 1428"
  #iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"
  
  # For DHCP set iface_eth? to "dhcp"
  # For passing options to dhcpcd use dhcpcd_eth?
  #
! #dhcp_args=""
  #dhcpcd_eth0="..."
  
+ # For ISC dhclient, set iface_eth? to "isc_dhclient"
+ iface_eth0="isc_dhclient"
+ isc_dhclient_args="-q -sf /etc/dhcp/dhclient-script -cf /etc/dhcp/dhclient.conf"
+ 
+ 
  # For adding aliases to a interface
  #
  #alias_eth0="192.168.0.3 192.168.0.4"
***************
*** 31,35 ****
  
  # For setting the default gateway
  #
! #gateway="eth0/192.168.0.1"
  
--- 36,40 ----
  
  # For setting the default gateway
  #
! #gateway="eth0/192.168.130.190"



--------------------------------------8<---------------------------------------

*** dhclient-script.sample      Tue Oct  8 21:00:49 2002
--- dhclient-script     Tue Oct  8 21:01:37 2002
***************
*** 73,78 ****
--- 73,82 ----
    alias_subnet_arg="netmask $alias_subnet_mask"
  fi
  
+ if [ x$new_interface_mtu != x ]; then
+   interface_mtu_arg="mtu $new_interface_mtu"
+ fi
+ 
  if [ x$reason = xMEDIUM ]; then
    # Linux doesn't do mediums (ok, ok, media).
    exit_with_hooks 0
***************
*** 129,135 ****
       [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
  
      ifconfig $interface inet $new_ip_address $new_subnet_arg \
!                                                       $new_broadcast_arg
      # Add a network route to the computed network address.
      if [ $relmajor -lt 2 ] || \
                ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
--- 133,139 ----
       [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then
  
      ifconfig $interface inet $new_ip_address $new_subnet_arg \
!                                       $interface_mtu_arg $new_broadcast_arg
      # Add a network route to the computed network address.
      if [ $relmajor -lt 2 ] || \
                ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then
***************
*** 171,177 ****
      ifconfig $interface:0- inet 0
    fi
    ifconfig $interface inet $new_ip_address $new_subnet_arg \
!                                       $new_broadcast_arg
    set $new_routers
    ############## what is -w in ping?
    if ping -q -c 1 $1; then
--- 175,181 ----
      ifconfig $interface:0- inet 0
    fi
    ifconfig $interface inet $new_ip_address $new_subnet_arg \
!                       $interface_mtu_arg $new_broadcast_arg
    set $new_routers
    ############## what is -w in ping?
    if ping -q -c 1 $1; then


------------------------------------------8<-----------------------------------

*** dhclient.conf.sample        Tue Oct  8 21:29:31 2002
--- dhclient.conf       Tue Oct  8 21:30:03 2002
***************
*** 1,36 ****
! send host-name "andare.fugue.com";
! send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
! send dhcp-lease-time 3600;
! supersede domain-name "fugue.com home.vix.com";
! prepend domain-name-servers 127.0.0.1;
  request subnet-mask, broadcast-address, time-offset, routers,
!       domain-name, domain-name-servers, host-name;
! require subnet-mask, domain-name-servers;
! timeout 60;
! retry 60;
! reboot 10;
! select-timeout 5;
! initial-interval 2;
! script "/etc/dhclient-script";
! media "-link0 -link1 -link2", "link0 link1";
! reject 192.33.137.209;
  
! alias {
!   interface "ep0";
!   fixed-address 192.5.5.213;
!   option subnet-mask 255.255.255.255;
! }
  
! lease {
!   interface "ep0";
!   fixed-address 192.33.137.200;
!   medium "link0 link1";
!   option host-name "andare.swiftmedia.com";
!   option subnet-mask 255.255.255.0;
!   option broadcast-address 192.33.137.255;
!   option routers 192.33.137.250;
!   option domain-name-servers 127.0.0.1;
!   renew 2 2000/1/12 00:00:01;
!   rebind 2 2000/1/12 00:00:01;
!   expire 2 2000/1/12 00:00:01;
! }
--- 1,36 ----
! #send host-name "andare.fugue.com";
! #send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
! #send dhcp-lease-time 3600;
! #supersede domain-name "fugue.com home.vix.com";
! #prepend domain-name-servers 127.0.0.1;
  request subnet-mask, broadcast-address, time-offset, routers,
!       domain-name, domain-name-servers, host-name, interface-mtu;
! #require subnet-mask, domain-name-servers;
! #timeout 60;
! #retry 60;
! #reboot 10;
! #select-timeout 5;
! #initial-interval 2;
! #script "/etc/dhclient-script";
! #media "-link0 -link1 -link2", "link0 link1";
! #reject 192.33.137.209;
  
! #alias {
! #  interface "ep0";
! #  fixed-address 192.5.5.213;
! #  option subnet-mask 255.255.255.255;
! #}
  
! #lease {
! #  interface "ep0";
! #  fixed-address 192.33.137.200;
! #  medium "link0 link1";
! #  option host-name "andare.swiftmedia.com";
! #  option subnet-mask 255.255.255.0;
! #  option broadcast-address 192.33.137.255;
! #  option routers 192.33.137.250;
! #  option domain-name-servers 127.0.0.1;
! #  renew 2 2000/1/12 00:00:01;
! #  rebind 2 2000/1/12 00:00:01;
! #  expire 2 2000/1/12 00:00:01;
! #}
Comment 1 SpanKY gentoo-dev 2002-10-10 00:03:22 UTC
could you attach those patches ? 
 
when you post them as comments they're useless ... 
Comment 2 John R. Makosky 2002-10-10 08:35:17 UTC
Created attachment 4571 [details, diff]
patch agains net.eth0 v1.17
Comment 3 John R. Makosky 2002-10-10 08:36:24 UTC
Created attachment 4572 [details, diff]
patch against /etc/conf.d/net v1.5
Comment 4 John R. Makosky 2002-10-10 08:37:13 UTC
Created attachment 4573 [details, diff]
patch against /etc/dhcp/dhclient.conf-sample
Comment 5 John R. Makosky 2002-10-10 08:38:16 UTC
Created attachment 4574 [details, diff]
patch against /etc/dhcp/dhclient-script-sample to support interface MTU
Comment 6 SpanKY gentoo-dev 2003-01-17 15:46:27 UTC
rather than doing this kind of hardcoded thing and adding ugly support for every
other dhcp client out there, why not abstract it ...

we've got dhclient, dhcpcd, pump, udhcp, and i'm sure there are more ...
Comment 7 Luke-Jr 2003-12-08 10:54:55 UTC
Created attachment 21875 [details, diff]
allows a custom dhcp command

iface_eth0="dhcp pump" (for example)
Comment 8 SpanKY gentoo-dev 2004-02-05 20:01:59 UTC
*** Bug 40532 has been marked as a duplicate of this bug. ***
Comment 9 SpanKY gentoo-dev 2004-08-27 22:12:44 UTC
*** Bug 16229 has been marked as a duplicate of this bug. ***
Comment 10 SpanKY gentoo-dev 2004-08-27 22:13:12 UTC
*** Bug 20556 has been marked as a duplicate of this bug. ***
Comment 11 SpanKY gentoo-dev 2004-08-27 22:17:53 UTC
*** Bug 44184 has been marked as a duplicate of this bug. ***
Comment 12 SpanKY gentoo-dev 2004-10-02 22:17:13 UTC
latest masked/cvs baselayout supports network modules

currently we have dhcp/dhclient/udhcpc/pump