[dhcp/f14/master] s/ping/arping/ in dhclient-script to handle not-on-local-net gateway in ARP-less device (#524298)

Jiří Popelka jpopelka at fedoraproject.org
Thu Oct 7 16:06:21 UTC 2010


commit db1d0eda080ed2ccedb700eba9b7bb60c905e1ca
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Thu Oct 7 17:48:46 2010 +0200

    s/ping/arping/ in dhclient-script to handle not-on-local-net gateway in ARP-less device (#524298)

 dhclient-script |   20 ++++++++++----------
 dhcp.spec       |    6 +++++-
 2 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/dhclient-script b/dhclient-script
index 3f22696..6961af5 100755
--- a/dhclient-script
+++ b/dhclient-script
@@ -215,24 +215,24 @@ is_router_reachable() {
     router="${1}"
     routersubnet="$(get_network_address ${router} ${new_subnet_mask})"
     mysubnet="$(get_network_address ${new_ip_address} ${new_subnet_mask})"
-    unreachable=0
 
     if [ ! "${routersubnet}" = "${mysubnet}" ]; then
-        unreachable=1
-        if arping -f -q -I ${interface} -w2 ${router}; then
-            ip -4 route add ${router}/32 dev ${interface}
-            if [ $? -eq 0 ]; then
-                unreachable=0
+        ip -4 route add ${router}/32 dev ${interface}
+        if [ $? -eq 0 ]; then
+            if ping -q -c1 -w2 -I ${interface} ${router}; then
+                return 0
             else
-                logmessage "failed to create host router for unreachable router ${router} not on subnet ${mysubnet}"
+                logmessage "DHCP router ${router} is unreachable on DHCP subnet ${mysubnet} router subnet ${routersubnet}"
+                ip route del ${router}/32 dev ${interface}
+                return 1
             fi
         else
-            unreachable=1
-            logmessage "DHCP router ${router} is unreachable on DHCP subnet ${mysubnet} router subnet ${routersubnet}"
+            logmessage "failed to create host router for unreachable router ${router} not on subnet ${mysubnet}"
+            return 1
         fi
     fi
 
-    return ${unreachable}
+    return 0
 }
 
 add_default_gateway() {
diff --git a/dhcp.spec b/dhcp.spec
index cd571d1..42e5a0f 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -7,7 +7,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.2.0
-Release:  10%{?dist}
+Release:  11%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -520,6 +520,10 @@ fi
 %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
 
 %changelog
+* Thu Oct 07 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-11
+- Use ping instead of arping in dhclient-script to handle
+  not-on-local-net gateway in ARP-less device (#524298)
+
 * Thu Oct 07 2010 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.0-10
 - Check whether there is any unexpired address in previous lease
   prior to confirming (INIT-REBOOT) the lease (#585418)


More information about the scm-commits mailing list