On 10/15/2010 02:05 PM, Pádraig Brady wrote:
On 08/10/10 16:19, Pádraig Brady wrote:
On 08/10/10 15:17, Seewer Philippe wrote:
On 10/08/2010 03:59 PM, Pádraig Brady wrote:

Is it right to die if we can't contact the router?
Usually yes. Either because the rootserver is behind the router or if
you supplied routing information it's safe to assume that later you want
it to work anyway.

Well in my case the router is just needed for browsing the net.
All other services are provided locally.

But yes, usually. I would have preferred to somehow a subnet check on
the rootserver to decide what or if to check. But alas, not all netroot
variants know the ip of their rootserver at that point.

Right, but no need to penalize the common case.
I.E. we can bypass all this if the rootserver is known,
and on the same subnet.

This seems to work.

cheers,
Pádraig.

 From a1a1fac1a1cfc8bd22417923823f3d64c29dd44f Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?=<p...@draigbrady.com>
Date: Fri, 15 Oct 2010 12:58:31 +0100
Subject: [PATCH] network: make gateway optional with a local root server

* modules.d/40network/netroot: Don't arping the gateway
if we don't need to
---
  modules.d/40network/netroot |   25 ++++++++++++++++++-------
  1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/modules.d/40network/netroot b/modules.d/40network/netroot
index 81a9ad3..12717b1 100755
--- a/modules.d/40network/netroot
+++ b/modules.d/40network/netroot
@@ -83,22 +83,33 @@ done
  [ -e /tmp/net.$netif.override ]&&  . /tmp/net.$netif.override
  [ -e /tmp/dhclient.$netif.dhcpopts ]&&  . /tmp/dhclient.$netif.dhcpopts

-# Handle STP Timeout: arping default router or if not available the
-# root server. Note: This assumes that if no router is present the
+# Handle STP Timeout: arping the default router if root server is
+# unknown or not local, or if not available the root server.
+# Note: This assumes that if no router is present the
  # root server is on the same subnet.
  #
  # TODO There's some netroot variants that don't (yet) have their
  # server-ip netroot
-[ -n "$new_routers" ]&&  dest=${new_routers%%,*}
-[ -n "$gw" ]&&  dest=$gw
-if [ -z "$dest" ] ; then
+[ "$new_routers" ]&&  gw_ip=${new_routers%%,*}
+[ "$gw" ]&&  gw_ip=$gw
+if [ "$netroot" ]; then
      dummy=${netroot#*:}
      dummy=${dummy%%:*}
      case "$dummy" in
-        [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) dest=$dummy;;
+        [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) netroot_ip=$dummy;;
      esac
  fi
-if [ -n "$dest" ]&&  ! arping -q -f -w 60 -I $netif $dest ; then
+dest="$gw_ip"
+if [ "$netroot_ip" ]; then
+    if [ -z "$dest" ]; then
+         # no gateway so check root server
+        dest="$netroot_ip"
+    elif ! ip route get "$netroot_ip" | grep -qF ' via '; then
+        # local root server, so don't arping gateway
+        dest="$netroot_ip"
+    fi
+fi
+if [ "$dest" ]&&  ! arping -q -f -w 60 -I $netif $dest; then
      die "Resolving $dest via ARP on $netif failed"
  fi


please use [ -n "$var" ]
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to