Author: ken
Date: 2011-11-23 09:19:45 -0700 (Wed, 23 Nov 2011)
New Revision: 2335

Added:
   trunk/dhcp/dhcp-4.2.3-iproute2-1.patch
   trunk/dhcp/dhcp-4.2.3-missing_ipv6-1.patch
Log:
patches for dhcp-4.2.3

Added: trunk/dhcp/dhcp-4.2.3-iproute2-1.patch
===================================================================
--- trunk/dhcp/dhcp-4.2.3-iproute2-1.patch                              (rev 0)
+++ trunk/dhcp/dhcp-4.2.3-iproute2-1.patch      2011-11-23 16:19:45 UTC (rev 
2335)
@@ -0,0 +1,192 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2011-11-23
+Initial Package Version: 4.2.2
+Upstream Status: ignored
+Origin: Peter Marschall, modified by Ken Moffat
+Description: Fixes dhclient-script to work with iproute2
+
+originally from Peter Marschall,
+https://lists.isc.org/pipermail/dhcp-users/2011-January/012539.html
+
+ Extended to handle other 'route' invocations in 4.2.2, and output to
+/dev/null removed.  This replaces the earlier dhcp patch by Jim Gifford,
+Bruce Dubbs, and DJ Lucas which no longer applies.  Reinstated one
+output to /dev/null because the script tries to add an interface during
+reboot.
+
+--- dhcp-4.2.2/client/scripts/linux.orig       2011-05-18 21:01:54.000000000 
+0100
++++ dhcp-4.2.2/client/scripts/linux    2011-09-06 01:04:13.000000000 +0100
+@@ -3,6 +3,8 @@
+ # Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
+ # No guarantees about this. I'm a novice at the details of Linux
+ # networking.
++# Conversion to use ip for ipv4 (instead of ifconfig, route) by Peter 
Marschall
++# Extended for 4.2.2, and ip output to /dev/null removed, by Ken Moffat
+ 
+ # Notes:
+ 
+@@ -98,17 +100,11 @@
+ if [ x$old_broadcast_address != x ]; then
+   old_broadcast_arg="broadcast $old_broadcast_address"
+ fi
+-if [ x$new_subnet_mask != x ]; then
+-  new_subnet_arg="netmask $new_subnet_mask"
++if [ -n "$new_subnet_mask" ]; then
++    new_mask="/$new_subnet_mask"
+ fi
+-if [ x$old_subnet_mask != x ]; then
+-  old_subnet_arg="netmask $old_subnet_mask"
+-fi
+-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"
++if [ -n "$alias_subnet_mask" ]; then
++    alias_mask="/$alias_subnet_mask"
+ fi
+ if [ x$IF_METRIC != x ]; then
+   metric_arg="metric $IF_METRIC"
+@@ -122,9 +118,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
++    ${ip} -4 addr flush dev ${interface} label ${interface}:0
+   fi
+-  ifconfig $interface 0 up
++  ${ip} link set dev ${interface} up
+ 
+   # We need to give the kernel some time to get the interface up.
+   sleep 1
+@@ -151,25 +147,32 @@
+   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
++    ${ip} -4 addr flush dev ${interface} label ${interface}: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
++    ${ip} -4 addr flush dev ${interface} label ${interface}
++  fi
++
+ 
+   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 $mtu_arg
++    ${ip} -4 addr add ${new_ip_address}${new_mask} ${new_broadcast_arg} \
++                dev ${interface} label ${interface} 2>/dev/null
++    if [ -n "$new_interface_mtu" ]; then
++      # set MTU
++      ${ip} link set dev ${interface} mtu ${new_interface_mtu}
++    fi
+     # Add a network route to the computed network address.
+     for router in $new_routers; do
+       if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+-      route add -host $router dev $interface
++         ${ip} -4 route add ${router} dev $interface
+       fi
+-      route add default gw $router $metric_arg dev $interface
++      ${ip} -4 route add default via ${router} dev ${interface} \
++                    ${metric_arg}
+     done
+   else
+     # we haven't changed the address, have we changed other options           
+@@ -177,21 +180,24 @@
+     if [ x$new_routers != x ] && [ x$new_routers != x$old_routers ] ; then
+       # if we've changed routers delete the old and add the new.
+       for router in $old_routers; do
+-        route del default gw $router
++      ${ip} -4 route del via $router
+       done
+       for router in $new_routers; do
+         if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+-        route add -host $router dev $interface
++        ${ip} -4 route add $router dev $interface
+       fi
+       route add default gw $router $metric_arg dev $interface
++      ${ip} -4 route add default via $router dev $interface \
++                      $metric_arg
+       done
+     fi
+   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 $alias_ip_address $alias_subnet_arg
+-    route add -host $alias_ip_address $interface:0
++    ${ip} -4 addr flush dev ${interface} label ${interface}:0
++    ${ip} -4 addr add ${alias_ip_address}${alias_mask} \
++        dev ${interface} label ${interface}:0
++    ${ip} -4 route add ${alias_ip_address} dev ${interface}
+   fi
+   make_resolv_conf
+   exit_with_hooks 0
+@@ -201,42 +207,49 @@
+    || [ x$reason = xSTOP ]; then
+   if [ x$alias_ip_address != x ]; then
+     # Turn off alias interface.
+-    ifconfig $interface:0- inet 0
++    ${ip} -4 addr flush dev ${interface} label ${interface}: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
++    ${ip} -4 addr flush dev ${interface} label ${interface}
+   fi
+   if [ x$alias_ip_address != x ]; then
+-    ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+-    route add -host $alias_ip_address $interface:0
++    ${ip} -4 addr add ${alias_ip_address}${alias_network_arg} \
++        dev ${interface} label ${interface}:0
++    ${ip} -4 route add ${alias_ip_address} dev ${interface}
+   fi
+   exit_with_hooks 0
+ fi
+ 
+ if [ x$reason = xTIMEOUT ]; then
+   if [ x$alias_ip_address != x ]; then
+-    ifconfig $interface:0- inet 0
++    ${ip} -4 addr flush dev ${interface} label ${interface}:0
++  fi
++  ${ip} -4 addr add ${new_ip_address}${new_mask} ${new_broadcast_arg} \
++            dev ${interface} label ${interface}
++  if [ -n "$new_interface_mtu" ]; then
++    # set MTU
++    ip link set dev ${interface} mtu ${new_interface_mtu}
+   fi
+-  ifconfig $interface inet $new_ip_address $new_subnet_arg \
+-                                      $new_broadcast_arg $mtu_arg
+   set $new_routers
+   if ping -q -c 1 $1; then
+     if [ x$new_ip_address != x$alias_ip_address ] && \
+                       [ x$alias_ip_address != x ]; then
+-      ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
+-      route add -host $alias_ip_address dev $interface:0
++      ${ip} -4 addr add ${alias_ip_address}${alias_mask} \
++            dev ${interface} label ${interface}:0
++      ${ip} -4 route add ${alias_ip_address} dev ${interface}
+     fi
+     for router in $new_routers; do
+       if [ "x$new_subnet_mask" = "x255.255.255.255" ] ; then
+-      route add -host $router dev $interface
++        ${ip} -4 route add ${router} dev $interface
+       fi
+-      route add default gw $router $metric_arg dev $interface
++      ${ip} -4 route add default via ${router} dev ${interface} \
++                    ${metric_arg}
+     done
+     make_resolv_conf
+     exit_with_hooks 0
+   fi
+-  ifconfig $interface inet 0 down
++  ${ip} -4 addr flush dev ${interface}
+   exit_with_hooks 1
+ fi
+ 

Added: trunk/dhcp/dhcp-4.2.3-missing_ipv6-1.patch
===================================================================
--- trunk/dhcp/dhcp-4.2.3-missing_ipv6-1.patch                          (rev 0)
+++ trunk/dhcp/dhcp-4.2.3-missing_ipv6-1.patch  2011-11-23 16:19:45 UTC (rev 
2335)
@@ -0,0 +1,48 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2011-11-23
+Initial Package Version: 4.2.2
+Upstream Status: unknown
+Origin: found at fedora
+Description: Allow dhcp4 to work even if the kernel doesn't support ipv6.
+Fixed up by hand to apply to 4.2.2 (to me, it looks identical to the 4.2.0
+version, but patch failed in one hunk when I tried to apply that one).
+
+--- dhcp-4.2.2/common/discover.c.orig  2011-07-19 23:22:48.000000000 +0100
++++ dhcp-4.2.2/common/discover.c       2011-09-06 01:28:15.000000000 +0100
+@@ -455,7 +455,7 @@
+       }
+ 
+ #ifdef DHCPv6
+-      if (local_family == AF_INET6) {
++      if ((local_family == AF_INET6) && !access("/proc/net/if_inet6", R_OK)) {
+               ifaces->fp6 = fopen("/proc/net/if_inet6", "r");
+               if (ifaces->fp6 == NULL) {
+                       log_error("Error opening '/proc/net/if_inet6' to "
+@@ -466,6 +466,8 @@
+                       ifaces->fp = NULL;
+                       return 0;
+               }
++      } else {
++              ifaces->fp6 = NULL;
+       }
+ #endif
+ 
+@@ -733,7 +735,7 @@
+               return 1;
+       }
+ #ifdef DHCPv6
+-      if (!(*err)) {
++      if (!(*err) && ifaces->fp6) {
+               if (local_family == AF_INET6)
+                       return next_iface6(info, err, ifaces);
+       }
+@@ -752,7 +754,8 @@
+       ifaces->sock = -1;
+ #ifdef DHCPv6
+       if (local_family == AF_INET6) {
+-              fclose(ifaces->fp6);
++              if (ifaces->fp6)
++                      fclose(ifaces->fp6);
+               ifaces->fp6 = NULL;
+       }
+ #endif

-- 
http://linuxfromscratch.org/mailman/listinfo/patches
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to