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; ! #}
could you attach those patches ? when you post them as comments they're useless ...
Created attachment 4571 [details, diff] patch agains net.eth0 v1.17
Created attachment 4572 [details, diff] patch against /etc/conf.d/net v1.5
Created attachment 4573 [details, diff] patch against /etc/dhcp/dhclient.conf-sample
Created attachment 4574 [details, diff] patch against /etc/dhcp/dhclient-script-sample to support interface MTU
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 ...
Created attachment 21875 [details, diff] allows a custom dhcp command iface_eth0="dhcp pump" (for example)
*** Bug 40532 has been marked as a duplicate of this bug. ***
*** Bug 16229 has been marked as a duplicate of this bug. ***
*** Bug 20556 has been marked as a duplicate of this bug. ***
*** Bug 44184 has been marked as a duplicate of this bug. ***
latest masked/cvs baselayout supports network modules currently we have dhcp/dhclient/udhcpc/pump