--- dst/Makefile.dist.orig Thu Jun 10 10:59:28 2004 +++ dst/Makefile.dist Thu Aug 31 20:01:18 2006 @@ -31,6 +31,10 @@ all: libdst.a install: + mkdir -p $(DESTDIR)$(LIBDIR) + $(INSTALL) libdst.a $(DESTDIR)$(LIBDIR) + $(CHMOD) 644 $(DESTDIR)$(LIBDIR)/libdst.a + libdst.a: $(OBJ) rm -f dst.a --- relay/dhcrelay.c.orig Thu Apr 27 14:38:30 2006 +++ relay/dhcrelay.c Thu Aug 31 20:01:18 2006 @@ -102,6 +102,8 @@ static char message [] = "Internet Systems Consortium DHCP Relay Agent"; static char url [] = "For info, please visit http://www.isc.org/sw/dhcp/"; +extern int log_isc_blurb; + int main (argc, argv, envp) int argc; char **argv, **envp; @@ -170,6 +172,7 @@ } else if (!strcmp (argv [i], "-q")) { quiet = 1; quiet_interface_discovery = 1; + log_isc_blurb = 0; } else if (!strcmp (argv [i], "-a")) { add_agent_options = 1; } else if (!strcmp (argv [i], "-c")) { --- client/scripts/bsdos.orig Fri Jun 1 10:25:43 2001 +++ client/scripts/bsdos Thu Aug 31 20:01:18 2006 @@ -1,11 +1,42 @@ #!/bin/sh make_resolv_conf() { - if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then + if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + if [ "x$new_domain_name" != x ]; then + conf="${conf}search $new_domain_name\n" + fi + for nameserver in $new_domain_name_servers; do + conf="${conf}nameserver $nameserver\n" + done + if [ -x /sbin/resolvconf ]; then + echo -e "$conf" | resolvconf -a "$interface" + else + echo -e "$conf" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + fi + fi + fi + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf +} + +make_ntp_conf() { + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then + if [ x$new_ntp_servers != x ]; then + conf="# Generated by dhclient for interface $interface\n" + conf="${conf}restrict default noquery notrust nomodify\n" + conf="${conf}restrict 127.0.0.1\n" + for ntpserver in $new_ntp_servers; do + conf="${conf}restrict $ntpserver nomodify notrap noquery\n" + conf="${conf}server $ntpserver\n" + done + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n" + conf="${conf}logfile /var/log/ntp.log\n" + echo -e "${conf}" > /etc/ntp.conf + chmod 644 /etc/ntp.conf + fi fi } @@ -50,6 +81,12 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" +fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -107,7 +144,7 @@ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do route add default $router >/dev/null 2>&1 @@ -164,7 +201,7 @@ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 fi eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" sleep 1 if [ "$new_routers" != "" ]; then set $new_routers --- client/scripts/freebsd.orig Thu Sep 30 16:22:48 2004 +++ client/scripts/freebsd Thu Aug 31 20:01:18 2006 @@ -11,25 +11,41 @@ fi make_resolv_conf() { - if [ x"$new_domain_name_servers" != x ]; then - if [ "x$new_domain_name" != x ]; then - ( echo search $new_domain_name >/etc/resolv.conf ) - exit_status=$? - else - if [ -e /etc/resolv.conf ] ; then - ( rm /etc/resolv.conf ) - exit_status=$? + if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then + if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + if [ "x$new_domain_name" != x ]; then + conf="${conf}search $new_domain_name\n" + fi + for nameserver in $new_domain_name_servers; do + conf="${conf}nameserver $nameserver\n" + done + if [ -x /sbin/resolvconf ]; then + echo -e "$conf" | resolvconf -a "$interface" else - ( touch /etc/resolv.conf ) - exit_status=$? + echo -e "$conf" > /etc/resolv.conf + chmod 644 /etc/resolv.conf fi fi - if [ $exit_status -ne 0 ]; then - $LOGGER "WARNING: Unable to update resolv.conf: Error $exit_status" - else - for nameserver in $new_domain_name_servers; do - ( echo nameserver $nameserver >>/etc/resolv.conf ) + fi + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf +} + +make_ntp_conf() { + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then + if [ "x$new_ntp_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + conf="${conf}restrict default noquery notrust nomodify\n" + conf="${conf}restrict 127.0.0.1\n" + for ntpserver in $new_ntp_servers; do + conf="${conf}restrict $ntpserver nomodify notrap noquery\n" + conf="${conf}server $ntpserver\n" done + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n" + conf="${conf}logfile /var/log/ntp.log\n" + echo -e "${conf}" > /etc/ntp.conf + chmod 644 /etc/ntp.conf fi fi } @@ -75,6 +91,12 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" +fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -132,7 +154,7 @@ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" $LOGGER "New IP Address ($interface): $new_ip_address" $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" @@ -196,7 +218,7 @@ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 fi eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" $LOGGER "New IP Address ($interface): $new_ip_address" $LOGGER "New Subnet Mask ($interface): $new_subnet_mask" $LOGGER "New Broadcast Address ($interface): $new_broadcast_address" --- client/scripts/linux.orig Thu Nov 14 17:09:09 2002 +++ client/scripts/linux Thu Aug 31 20:01:18 2006 @@ -23,12 +23,42 @@ # of the $1 in its args. make_resolv_conf() { - if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then - echo search $new_domain_name >/etc/resolv.conf - chmod 644 /etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then + if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + if [ "x$new_domain_name" != x ]; then + conf="${conf}search $new_domain_name\n" + fi + for nameserver in $new_domain_name_servers; do + conf="${conf}nameserver $nameserver\n" + done + if [ -x /sbin/resolvconf ]; then + echo -e "$conf" | resolvconf -a "$interface" + else + echo -e "$conf" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + fi + fi + fi + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf +} + +make_ntp_conf() { + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then + if [ "x$new_ntp_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + conf="${conf}restrict default noquery notrust nomodify\n" + conf="${conf}restrict 127.0.0.1\n" + for ntpserver in $new_ntp_servers; do + conf="${conf}restrict $ntpserver nomodify notrap noquery\n" + conf="${conf}server $ntpserver\n" + done + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n" + conf="${conf}logfile /var/log/ntp.log\n" + echo -e "${conf}" > /etc/ntp.conf + chmod 644 /etc/ntp.conf + fi fi } @@ -53,11 +83,6 @@ fi fi -release=`uname -r` -release=`expr $release : '\(.*\)\..*'` -relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'` -relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'` - if [ x$new_broadcast_address != x ]; then new_broadcast_arg="broadcast $new_broadcast_address" fi @@ -73,6 +98,12 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" +fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then # Linux doesn't do mediums (ok, ok, media). @@ -82,17 +113,9 @@ if [ x$reason = xPREINIT ]; then if [ x$alias_ip_address != x ]; then # Bring down alias interface. Its routes will disappear too. - ifconfig $interface:0- inet 0 - fi - if [ $relmajor -lt 2 ] || ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ) - then - ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \ - broadcast 255.255.255.255 up - # Add route to make broadcast work. Do not omit netmask. - route add default dev $interface netmask 0.0.0.0 - else - ifconfig $interface 0 up + ifconfig $interface:0- inet 0.0.0.0 fi + ifconfig $interface 0.0.0.0 up # We need to give the kernel some time to get the interface up. sleep 1 @@ -108,41 +131,45 @@ [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then current_hostname=`hostname` if [ x$current_hostname = x ] || \ + [ x$current_hostname = "x(none)" ] || \ + [ x$current_hostname = xlocalhost ] || \ [ x$current_hostname = x$old_host_name ]; then if [ x$current_hostname = x ] || \ [ x$new_host_name != x$old_host_name ]; then - hostname $new_host_name + hostname "$new_host_name" fi fi if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \ [ x$alias_ip_address != x$old_ip_address ]; then # Possible new alias. Remove old alias. - ifconfig $interface:0- inet 0 + ifconfig $interface:0- inet 0.0.0.0 fi if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then # IP address changed. Bringing down the interface will delete all routes, # and clear the ARP cache. - ifconfig $interface inet 0 down + ifconfig $interface inet 0.0.0.0 fi if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then ifconfig $interface inet $new_ip_address $new_subnet_arg \ - $new_broadcast_arg + $new_broadcast_arg $mtu_arg # Add a network route to the computed network address. - if [ $relmajor -lt 2 ] || \ - ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then - route add -net $new_network_number $new_subnet_arg dev $interface + if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then + route del -net $new_network_number $new_subnet_arg \ + dev $interface + route add -net $new_network_number $new_subnet_arg $metric_arg \ + dev $interface fi for router in $new_routers; do - route add default gw $router + route add default gw $router $metric_arg dev $interface done fi if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ]; then - ifconfig $interface:0- inet 0 + ifconfig $interface:0- inet 0.0.0.0 ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg route add -host $alias_ip_address $interface:0 fi @@ -154,11 +181,11 @@ || [ x$reason = xSTOP ]; then if [ x$alias_ip_address != x ]; then # Turn off alias interface. - ifconfig $interface:0- inet 0 + ifconfig $interface:0- inet 0.0.0.0 fi if [ x$old_ip_address != x ]; then # Shut down interface, which will delete routes and clear arp cache. - ifconfig $interface inet 0 down + ifconfig $interface inet 0.0.0.0 fi if [ x$alias_ip_address != x ]; then ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg @@ -169,10 +196,10 @@ if [ x$reason = xTIMEOUT ]; then if [ x$alias_ip_address != x ]; then - ifconfig $interface:0- inet 0 + ifconfig $interface:0- inet 0.0.0.0 fi ifconfig $interface inet $new_ip_address $new_subnet_arg \ - $new_broadcast_arg + $new_broadcast_arg $mtu_arg set $new_routers ############## what is -w in ping? if ping -q -c 1 $1; then @@ -181,17 +208,20 @@ ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg route add -host $alias_ip_address dev $interface:0 fi - if [ $relmajor -lt 2 ] || \ - ( [ $relmajor -eq 2 ] && [ $relminor -eq 0 ] ); then - route add -net $new_network_number + # Add a network route to the computed network address. + if [ x$IF_METRIC != x ] && [ x$IF_METRIC != x0 ]; then + route del -net $new_network_number $new_subnet_arg \ + dev $interface + route add -net $new_network_number $new_subnet_arg $metric_arg \ + dev $interface fi for router in $new_routers; do - route add default gw $router + route add default gw $router $metric_arg dev $interface done make_resolv_conf exit_with_hooks 0 fi - ifconfig $interface inet 0 down + ifconfig $interface inet 0.0.0.0 exit_with_hooks 1 fi --- client/scripts/netbsd.orig Fri Jun 1 10:25:47 2001 +++ client/scripts/netbsd Thu Aug 31 20:01:18 2006 @@ -1,11 +1,42 @@ #!/bin/sh make_resolv_conf() { - if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then + if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + if [ "x$new_domain_name" != x ]; then + conf="${conf}search $new_domain_name\n" + fi + for nameserver in $new_domain_name_servers; do + conf="${conf}nameserver $nameserver\n" + done + if [ -x /sbin/resolvconf ]; then + echo -e "$conf" | resolvconf -a "$interface" + else + echo -e "$conf" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + fi + fi + fi + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf +} + +make_ntp_conf() { + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then + if [ "x$new_ntp_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + conf="${conf}restrict default noquery notrust nomodify\n" + conf="${conf}restrict 127.0.0.1\n" + for ntpserver in $new_ntp_servers; do + conf="${conf}restrict $ntpserver nomodify notrap noquery\n" + conf="${conf}server $ntpserver\n" + done + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n" + conf="${conf}logfile /var/log/ntp.log\n" + echo -e "${conf}" > /etc/ntp.conf + chmod 644 /etc/ntp.conf + fi fi } @@ -50,6 +81,12 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" +fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -107,7 +144,7 @@ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do route add default $router >/dev/null 2>&1 @@ -164,7 +201,7 @@ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 fi eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" sleep 1 if [ "$new_routers" != "" ]; then set $new_routers --- client/scripts/openbsd.orig Fri Jun 1 10:25:49 2001 +++ client/scripts/openbsd Thu Aug 31 20:01:18 2006 @@ -1,11 +1,42 @@ #!/bin/sh make_resolv_conf() { - if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then + if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + if [ x$new_domain_name != x ]; then + conf="${conf}search $new_domain_name\n" + fi + for nameserver in $new_domain_name_servers; do + conf="${conf}nameserver $nameserver\n" + done + if [ -x /sbin/resolvconf ]; then + echo -e "$conf" | resolvconf -a "$interface" + else + echo -e "$conf" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + fi + fi + fi + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf +} + +make_ntp_conf() { + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then + if [ "x$new_ntp_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + conf="${conf}restrict default noquery notrust nomodify\n" + conf="${conf}restrict 127.0.0.1\n" + for ntpserver in $new_ntp_servers; do + conf="${conf}restrict $ntpserver nomodify notrap noquery\n" + conf="${conf}server $ntpserver\n" + done + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n" + conf="${conf}logfile /var/log/ntp.log\n" + echo -e "${conf}" > /etc/ntp.conf + chmod 644 /etc/ntp.conf + fi fi } @@ -50,6 +81,9 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" +fi if [ x$reason = xMEDIUM ]; then eval "ifconfig $interface $medium" @@ -107,7 +141,7 @@ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $medium" route add $new_ip_address 127.1 >/dev/null 2>&1 for router in $new_routers; do route add default $router >/dev/null 2>&1 @@ -164,7 +198,7 @@ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 fi eval "ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $medium" sleep 1 if [ "$new_routers" != "" ]; then set $new_routers --- client/scripts/solaris.orig Fri Jun 1 10:25:51 2001 +++ client/scripts/solaris Thu Aug 31 20:01:18 2006 @@ -1,11 +1,42 @@ #!/bin/sh make_resolv_conf() { - if [ "x$new_domain_name" != x ] && [ x"$new_domain_name_servers" != x ]; then - echo search $new_domain_name >/etc/resolv.conf - for nameserver in $new_domain_name_servers; do - echo nameserver $nameserver >>/etc/resolv.conf - done + if [ x$PEER_DNS = x ] || [ x$PEER_DNS = xyes ]; then + if [ "x$new_domain_name" != x ] || [ "x$new_domain_name_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + if [ "x$new_domain_name" != x ]; then + conf="${conf}search $new_domain_name\n" + fi + for nameserver in $new_domain_name_servers; do + conf="${conf}nameserver $nameserver\n" + done + if [ -x /sbin/resolvconf ]; then + echo -e "$conf" | resolvconf -a "$interface" + else + echo -e "$conf" > /etc/resolv.conf + chmod 644 /etc/resolv.conf + fi + fi + fi + # If we're making confs, may as well make an ntp.conf too + make_ntp_conf +} + +make_ntp_conf() { + if [ x$PEER_NTP = x ] || [ x$PEER_NTP = xyes ]; then + if [ "x$new_ntp_servers" != x ]; then + conf="# Generated by dhclient for interface $interface\n" + conf="${conf}restrict default noquery notrust nomodify\n" + conf="${conf}restrict 127.0.0.1\n" + for ntpserver in $new_ntp_servers; do + conf="${conf}restrict $ntpserver nomodify notrap noquery\n" + conf="${conf}server $ntpserver\n" + done + conf="${conf}driftfile /var/lib/ntp/ntp.drift\n" + conf="${conf}logfile /var/log/ntp.log\n" + echo -e "${conf}" > /etc/ntp.conf + chmod 644 /etc/ntp.conf + fi fi } @@ -45,6 +76,12 @@ if [ x$alias_subnet_mask != x ]; then alias_subnet_arg="netmask $alias_subnet_mask" fi +if [ x$new_interface_mtu != x ]; then + mtu_arg="mtu $new_interface_mtu" +fi +if [ x$IF_METRIC != x ]; then + metric_arg="metric $IF_METRIC" +fi ifconfig=/sbin/ifconfig @@ -107,7 +144,7 @@ if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" route add $new_ip_address 127.1 1 >/dev/null 2>&1 for router in $new_routers; do route add default $router 1 >/dev/null 2>&1 @@ -148,7 +185,7 @@ route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1 fi eval "$ifconfig $interface inet $new_ip_address $new_netmask_arg \ - $new_broadcast_arg $medium" + $new_broadcast_arg $mtu_arg $metric_arg $medium" sleep 1 set $new_routers if ping -s -n -I 1 $1 64 1; then --- client/clparse.c.orig Wed Feb 22 14:43:27 2006 +++ client/clparse.c Thu Aug 31 20:01:18 2006 @@ -51,6 +51,7 @@ DHO_DOMAIN_NAME, DHO_DOMAIN_NAME_SERVERS, DHO_HOST_NAME, + DHO_NTP_SERVERS, 0 }; @@ -96,6 +97,11 @@ status = read_client_conf_file (path_dhclient_conf, (struct interface_info *)0, &top_level_config); + + /* Read any extra configuration from stdin */ + read_client_conf_stdin ((struct interface_info *)0, + &top_level_config); + if (status != ISC_R_SUCCESS) { ; #ifdef LATER @@ -148,20 +154,17 @@ return status; } -int read_client_conf_file (const char *name, struct interface_info *ip, - struct client_config *client) +int read_client_conf_actual (int file, const char *name, + struct interface_info *ip, + struct client_config *client) { - int file; struct parse *cfile; const char *val; int token; isc_result_t status; - if ((file = open (name, O_RDONLY)) < 0) - return uerr2isc (errno); - cfile = (struct parse *)0; - new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); + new_parse (&cfile, file, (char *)0, 0, name , 0); do { token = peek_token (&val, (unsigned *)0, cfile); @@ -177,6 +180,32 @@ return status; } +int read_client_conf_file (const char *name, struct interface_info *ip, + struct client_config *client) +{ + int file; + isc_result_t status; + + if ((file = open (name, O_RDONLY)) < 0) + return uerr2isc (errno); + + status = read_client_conf_actual(file, name, ip, client); + + return status; +} + + +int read_client_conf_stdin (struct interface_info *ip, + struct client_config *client) +{ + int file = fileno(stdin); + isc_result_t status; + + if (isatty(file)) return ISC_R_NOTFOUND; + status = read_client_conf_actual(file, "stdin", ip, client); + + return status; +} /* lease-file :== client-lease-statements END_OF_FILE client-lease-statements :== --- client/dhclient.8.orig Wed Sep 14 09:03:33 2005 +++ client/dhclient.8 Thu Aug 31 20:01:18 2006 @@ -82,6 +82,9 @@ .B -w ] [ +.B -x +] +[ .I if0 [ .I ...ifN @@ -265,6 +268,10 @@ supplying the .B -nw flag. +.PP +The -x argument enables eXtended option information to be created in the +-s dhclient-script environment, which would allow applications running +in that environment to handle options they do not know about in advance. .SH CONFIGURATION The syntax of the dhclient.conf(5) file is discussed separately. .SH OMAPI --- client/dhclient.c.orig Sun Jul 9 08:40:12 2006 +++ client/dhclient.c Thu Aug 31 20:01:18 2006 @@ -34,7 +34,7 @@ static char ocopyright[] = "$Id: dhclient.c,v 1.129.2.33 2006/07/09 15:40:12 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ - + #include "dhcpd.h" #include "version.h" @@ -74,11 +74,15 @@ int onetry=0; int quiet=0; int nowait=0; - +#ifdef EXTENDED_NEW_OPTION_INFO +int extended_option_environment = 0; +#endif static void usage PROTO ((void)); void do_release(struct client_state *); +extern int log_isc_blurb; + int main (argc, argv, envp) int argc; char **argv, **envp; @@ -174,6 +178,7 @@ } else if (!strcmp (argv [i], "-q")) { quiet = 1; quiet_interface_discovery = 1; + log_isc_blurb = 0; } else if (!strcmp (argv [i], "-s")) { if (++i == argc) usage (); @@ -204,6 +209,11 @@ } else if (!strcmp (argv [i], "--version")) { log_info ("isc-dhclient-%s", DHCP_VERSION); exit (0); +#ifdef EXTENDED_NEW_OPTION_INFO + } else if (!strcmp (argv [i], "-x")) { + extended_option_environment = 1; + new_option_info_tree = GENERATE_NEW_OPTION_INFO; +#endif } else if (argv [i][0] == '-') { usage (); } else { @@ -476,7 +486,11 @@ log_info (arr); log_info (url); +#ifdef EXTENDED_NEW_OPTION_INFO + log_error ("Usage: dhclient [-1dqr] [-nwx] [-p ] %s", +#else log_error ("Usage: dhclient [-1dqr] [-nw] [-p ] %s", +#endif "[-s server]"); log_error (" [-cf config-file] [-lf lease-file]%s", "[-pf pid-file] [-e VAR=val]"); @@ -2437,8 +2451,28 @@ struct envadd_state { struct client_state *client; const char *prefix; + struct universe *universe; }; +#ifdef EXTENDED_NEW_OPTION_INFO +static +void build_universe_info_envvar +( struct option_cache *oc, + struct packet *p, struct lease *l, + struct client_state *client, + struct option_state *in_o, + struct option_state *cf_o, + struct binding_scope **scope, + struct universe *u, void *es +) +{ + char info_name[512], info_data[512]; + snprintf(info_name, 512, "%s._universe_.", oc->option->universe->name); + snprintf(info_data, 512, "%u:%s", oc->option->code,oc->option->format); + client_envadd( client, info_name, oc->option->name, info_data ); +} +#endif + void client_option_envadd (struct option_cache *oc, struct packet *packet, struct lease *lease, struct client_state *client_state, @@ -2455,6 +2489,31 @@ in_options, cfg_options, scope, oc, MDL)) { if (data.len) { char name [256]; +#ifdef EXTENDED_NEW_OPTION_INFO + if ( extended_option_environment ) + { + if( ( oc->option->universe != &dhcp_universe ) + &&( oc->option->universe->index > fqdn_universe.index ) + &&( es->universe != oc->option->universe ) + ) + { + es->universe = oc->option->universe; + (*(es->universe->foreach)) + ( (struct packet *)0, (struct lease *)0, + client_state, + in_options, cfg_options, + scope, es->universe, es, + build_universe_info_envvar + ); + }else + if ( lookup_new_option_info(oc->option) != 0L ) + build_universe_info_envvar + ( oc, packet, lease, client_state, + in_options, cfg_options, scope, + oc->option->universe, es + ); + } +#endif if (dhcp_option_ev_name (name, sizeof name, oc -> option)) { client_envadd (es -> client, es -> prefix, @@ -2483,6 +2542,7 @@ es.client = client; es.prefix = prefix; + es.universe = 0L; client_envadd (client, prefix, "ip_address", "%s", piaddr (lease -> address)); @@ -2694,7 +2754,14 @@ s = option -> name; if (j + 1 == buflen) return 0; +#ifdef EXTENDED_NEW_OPTION_INFO + if ( ! extended_option_environment ) + buf [j++] = '_'; + else + buf [j++] = '.'; +#else buf [j++] = '_'; +#endif } ++i; } while (i != 2); --- common/conflex.c.orig Wed Feb 22 14:43:27 2006 +++ common/conflex.c Thu Aug 31 20:01:18 2006 @@ -96,7 +96,7 @@ struct parse **cfile; { /* "Memory" config files have no file. */ - if ((*cfile)->file != -1) + if ((*cfile)->file != -1 && (*cfile)->file != fileno(stdin)) close((*cfile)->file); if ((*cfile)->bufsiz) --- common/parse.c.orig Wed Feb 22 14:43:27 2006 +++ common/parse.c Thu Aug 31 20:01:18 2006 @@ -1271,6 +1271,10 @@ option_hash_add (option -> universe -> hash, (const char *)option -> name, 0, option, MDL); +#ifdef EXTENDED_NEW_OPTION_INFO + if ( new_option_info_tree != 0L ) + add_new_option_info( option ); +#endif return 1; } --- common/tables.c.orig Wed Feb 22 14:43:27 2006 +++ common/tables.c Thu Aug 31 20:01:18 2006 @@ -1250,3 +1250,40 @@ fqdn_universe.name, 0, &fqdn_universe, MDL); } + +#ifdef EXTENDED_NEW_OPTION_INFO +#include + +void *new_option_info_tree = 0L; + +static int new_option_info_comparator( const void* p1, const void *p2 ) +{ + uint32_t ocode1 = (((const struct option*)p1)->universe->index << 8) + |(((const struct option*)p1)->code), + ocode2 = (((const struct option*)p2)->universe->index << 8) + |(((const struct option*)p2)->code); + return( (ocode1 == ocode2) + ? 0 + :( ( ocode1 > ocode2 ) + ? 1 + : -1 + ) + ); +} + +void *add_new_option_info( struct option *option ) +{ + if ( option->universe->index >= fqdn_universe.index ) + return 0L; + if ( new_option_info_tree == GENERATE_NEW_OPTION_INFO ) + new_option_info_tree = (void*)0L; + return tsearch( option, &(new_option_info_tree), new_option_info_comparator ); +} + +void *lookup_new_option_info( struct option *option ) +{ + if ( new_option_info_tree == GENERATE_NEW_OPTION_INFO ) + return 0L; + return tfind( option, &(new_option_info_tree), new_option_info_comparator ); +} +#endif --- omapip/errwarn.c.orig Thu Sep 30 13:38:32 2004 +++ omapip/errwarn.c Thu Aug 31 20:01:18 2006 @@ -45,6 +45,8 @@ int log_perror = 1; #endif int log_priority; +int log_isc_blurb=1; + void (*log_cleanup) (void); #define CVT_BUF_MAX 1023 @@ -76,7 +78,9 @@ write (STDERR_FILENO, "\n", 1); } -#if !defined (NOMINUM) +#if !defined(NOMINUM) + if ( log_isc_blurb ) + { log_error ("%s", ""); log_error ("If you did not get this software from ftp.isc.org, please"); log_error ("get the latest from ftp.isc.org and install that before"); @@ -94,7 +98,12 @@ log_error ("the README file."); log_error ("%s", ""); log_error ("exiting."); + }else + { + log_error ("exiting."); + } #endif + if (log_cleanup) (*log_cleanup) (); exit (1); --- server/dhcpd.c.orig Mon Jul 17 08:23:44 2006 +++ server/dhcpd.c Thu Aug 31 20:01:18 2006 @@ -47,11 +47,24 @@ #include "version.h" #include +#if defined (PARANOIA) +# include +# include +# include +/* get around the ISC declaration of group */ +# define group real_group +# include +# undef group +#endif /* PARANOIA */ + static void usage PROTO ((void)); struct iaddr server_identifier; int server_identifier_matched; + +extern int log_isc_blurb; + #if defined (NSUPDATE) /* This stuff is always executed to figure the default values for certain @@ -193,6 +206,22 @@ omapi_object_dereference (&listener, MDL); } +#if defined (PARANOIA) +/* to be used in one of two possible scenarios */ +static void setup_chroot (char *chroot_dir) { + if (geteuid()) + log_fatal ("you must be root to use chroot"); + + if (chroot(chroot_dir)) { + log_fatal ("chroot(\"%s\"): %m", chroot_dir); + } + if (chdir ("/")) { + /* probably permission denied */ + log_fatal ("chdir(\"/\"): %m"); + } +} +#endif /* PARANOIA */ + int main (argc, argv, envp) int argc; char **argv, **envp; @@ -225,6 +254,14 @@ char *traceinfile = (char *)0; char *traceoutfile = (char *)0; #endif +#if defined (PARANOIA) + char *set_user = 0; + char *set_group = 0; + char *set_chroot = 0; + + uid_t set_uid = 0; + gid_t set_gid = 0; +#endif /* PARANOIA */ /* Make sure we have stdin, stdout and stderr. */ status = open ("/dev/null", O_RDWR); @@ -287,6 +324,20 @@ if (++i == argc) usage (); server = argv [i]; +#if defined (PARANOIA) + } else if (!strcmp (argv [i], "-user")) { + if (++i == argc) + usage (); + set_user = argv [i]; + } else if (!strcmp (argv [i], "-group")) { + if (++i == argc) + usage (); + set_group = argv [i]; + } else if (!strcmp (argv [i], "-chroot")) { + if (++i == argc) + usage (); + set_chroot = argv [i]; +#endif /* PARANOIA */ } else if (!strcmp (argv [i], "-cf")) { if (++i == argc) usage (); @@ -320,6 +371,7 @@ } else if (!strcmp (argv [i], "-q")) { quiet = 1; quiet_interface_discovery = 1; + log_isc_blurb = 0; } else if (!strcmp (argv [i], "--version")) { log_info ("isc-dhcpd-%s", DHCP_VERSION); exit (0); @@ -390,6 +442,44 @@ trace_seed_stop, MDL); #endif +#if defined (PARANOIA) + /* get user and group info if those options were given */ + if (set_user) { + struct passwd *tmp_pwd; + + if (geteuid()) + log_fatal ("you must be root to set user"); + + if (!(tmp_pwd = getpwnam(set_user))) + log_fatal ("no such user: %s", set_user); + + set_uid = tmp_pwd->pw_uid; + + /* use the user's group as the default gid */ + if (!set_group) + set_gid = tmp_pwd->pw_gid; + } + + if (set_group) { +/* get around the ISC declaration of group */ +#define group real_group + struct group *tmp_grp; + + if (geteuid()) + log_fatal ("you must be root to set group"); + + if (!(tmp_grp = getgrnam(set_group))) + log_fatal ("no such group: %s", set_group); + + set_gid = tmp_grp->gr_gid; +#undef group + } + +# if defined (EARLY_CHROOT) + if (set_chroot) setup_chroot (set_chroot); +# endif /* EARLY_CHROOT */ +#endif /* PARANOIA */ + /* Default to the DHCP/BOOTP port. */ if (!local_port) { @@ -493,6 +583,10 @@ postconf_initialization (quiet); +#if defined (PARANOIA) && !defined (EARLY_CHROOT) + if (set_chroot) setup_chroot (set_chroot); +#endif /* PARANOIA && !EARLY_CHROOT */ + /* test option should cause an early exit */ if (cftest && !lftest) exit(0); @@ -505,6 +599,12 @@ if (lftest) exit (0); +#if defined (PARANOIA) + /* Set proper permissions... */ + if (lchown (path_dhcpd_db, set_uid, set_gid)) + log_fatal ("lchown(%s, %d, %d): %m", path_dhcpd_db, (int) set_uid, (int) set_gid); +#endif /* PARANOIA */ + /* Discover all the network interfaces and initialize them. */ discover_interfaces (DISCOVER_SERVER); @@ -536,6 +636,22 @@ exit (0); } +#if defined (PARANOIA) + /* change uid to the specified one */ + + if (set_gid) { + if (setgroups (0, (void *)0)) + log_fatal ("setgroups: %m"); + if (setgid (set_gid)) + log_fatal ("setgid(%d): %m", (int) set_gid); + } + + if (set_uid) { + if (setuid (set_uid)) + log_fatal ("setuid(%d): %m", (int) set_uid); + } +#endif /* PARANOIA */ + /* Read previous pid file. */ if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { status = read (i, pbuf, (sizeof pbuf) - 1); @@ -883,6 +999,10 @@ log_fatal ("Usage: dhcpd [-p ] [-d] [-f]%s%s%s%s", "\n [-cf config-file] [-lf lease-file]", +#if defined (PARANOIA) + /* meld into the following string */ + "\n [-user user] [-group group] [-chroot dir]" +#endif /* PARANOIA */ #if defined (TRACING) "\n [-tf trace-output-file]", "\n [-play trace-input-file]", --- includes/dhcpd.h.orig Wed May 17 13:16:59 2006 +++ includes/dhcpd.h Thu Aug 31 20:01:18 2006 @@ -1811,6 +1811,13 @@ void initialize_common_option_spaces PROTO ((void)); struct universe *config_universe; +#ifdef EXTENDED_NEW_OPTION_INFO +#define GENERATE_NEW_OPTION_INFO ((void*)1) +extern void *new_option_info_tree; +extern void *add_new_option_info( struct option*); +extern void *lookup_new_option_info( struct option *); +#endif + /* stables.c */ #if defined (FAILOVER_PROTOCOL) extern failover_option_t null_failover_option; --- Makefile.orig Thu Jun 10 10:59:10 2004 +++ Makefile Thu Aug 31 20:01:18 2006 @@ -33,7 +33,7 @@ if [ ! -d work.$$sysname ]; then \ echo No build directory for $$sysname - please run ./configure.; \ else \ - (cd work.$$sysname; make all); \ + (cd work.$$sysname; $(MAKE) all); \ fi install: @@ -41,7 +41,7 @@ if [ ! -d work.$$sysname ]; then \ echo No build directory for $$sysname - please run ./configure.; \ else \ - (cd work.$$sysname; make install); \ + (cd work.$$sysname; $(MAKE) install); \ fi depend: @@ -49,7 +49,7 @@ if [ ! -d work.$$sysname ]; then \ echo No build directory for $$sysname - please run ./configure.; \ else \ - (cd work.$$sysname; make depend); \ + (cd work.$$sysname; $(MAKE) depend); \ fi clean: @@ -57,7 +57,7 @@ if [ ! -d work.$$sysname ]; then \ echo No build directory for $$sysname - please run ./configure.; \ else \ - (cd work.$$sysname; make clean); \ + (cd work.$$sysname; $(MAKE) clean); \ fi realclean: @@ -65,7 +65,7 @@ if [ ! -d work.$$sysname ]; then \ echo No build directory for $$sysname - please run ./configure.; \ else \ - (cd work.$$sysname; make realclean); \ + (cd work.$$sysname; $(MAKE) realclean); \ fi distclean: @@ -73,7 +73,7 @@ if [ ! -d work.$$sysname ]; then \ echo No build directory for $$sysname - please run ./configure.; \ else \ - (cd work.$$sysname; make distclean); \ + (cd work.$$sysname; $(MAKE) distclean); \ fi links: @@ -81,6 +81,6 @@ if [ ! -d work.$$sysname ]; then \ echo No build directory for $$sysname - please run ./configure.; \ else \ - (cd work.$$sysname; make links); \ + (cd work.$$sysname; $(MAKE) links); \ fi