Skip to contentSkip to conversation

dracut requires router

PATCH In review Pádraig Brady 3 participants 9 messages Oct 8, 2010 – Oct 28, 2010 8 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 6 lines · Pádraig Brady

My terminals just failed to boot because the router was (temporarily) unavailable. Seems this is on purpose?

http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=commit;h=98f25e96

I don't know what the above is trying to do exactly.

What this does ist simply try and give a possible router enough time to update its STP caches (See http://en.wikipedia.org/wiki/Spanning_tree_protocol) so that subsequent mount attempts don't fail because the router isn't ready.

So yes, it is on purpose if the available IP information contains routers.

I Hope this helps

Regards,
Philippe

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 9 lines · Seewer Philippe
Quoted 7 lines · Pádraig Brady

My terminals just failed to boot because the router was (temporarily) unavailable. Seems this is on purpose?

http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=commit;h=98f25e96

I don't know what the above is trying to do exactly.

Quoted 8 lines

What this does ist simply try and give a possible router enough time to update its STP caches (See
http://en.wikipedia.org/wiki/Spanning_tree_protocol) so that subsequent mount attempts don't fail because the router isn't ready.

So yes, it is on purpose if the available IP information contains routers.

I Hope this helps

Thanks for the info, but.
Is it right to do this synchronously with such a long timeout? Is it right to die if we can't contact the router?

cheers,
Pádraig.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 15 lines · Pádraig Brady
Quoted 14 lines · Seewer Philippe
Quoted 7 lines · Pádraig Brady

My terminals just failed to boot because the router was (temporarily) unavailable. Seems this is on purpose?

http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=commit;h=98f25e96

I don't know what the above is trying to do exactly.

What this does ist simply try and give a possible router enough time to update its STP caches (See
http://en.wikipedia.org/wiki/Spanning_tree_protocol) so that subsequent mount attempts don't fail because the router isn't ready.

Quoted 6 lines
Quoted 3 lines

So yes, it is on purpose if the available IP information contains routers.

I Hope this helps

Thanks for the info, but.
Is it right to do this synchronously with such a long timeout?

It has to be done synchronously, sorry. We have to be sure the router is there and ready if the rootserver is behind the router.

As for the timeout: STP can take between 30-60 seconds. (There's a reason why there's newer protocols like RSTP etc).

Quoted 1 line

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.

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.

I'm always open for ideas on how to improve this.

Regards,
Philippe

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw
Quoted 6 lines · Seewer Philippe
Quoted 1 line · Pádraig Brady

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.

Quoted 3 lines

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.

cheers,
Pádraig.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

PATCH 1/1 network: don't die if gateway is down and root server is local

Quoted 11 lines · Pádraig Brady
Quoted 6 lines · Seewer Philippe
Quoted 1 line · Pádraig Brady

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.

Quoted 7 lines
Quoted 3 lines

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?= <[email protected]>
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(-)
modules.d/40network/netroot +18 -7
index 81a9ad3..12717b1 100755
@@ -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
 
Signature · 1 line
1.6.2.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [PATCH] network: don't die if gateway is down and root server is local

Quoted 71 lines · Pádraig Brady
Quoted 11 lines · Pádraig Brady
Quoted 6 lines · Seewer Philippe
Quoted 1 line · Pádraig Brady

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.

Quoted 7 lines
Quoted 3 lines

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?=<[email protected]>
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(-)
modules.d/40network/netroot +11 -7
index 81a9ad3..12717b1 100755
@@ -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

modules.d/40network/netroot done · line 115

Quoted 10 lines
modules.d/40network/netroot +7 -0
+        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" ]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

Re: [PATCH] network: don't die if gateway is down and root server is local

Quoted 3 lines · Harald Hoyer

please use [ -n "$var" ]

Done, and added a couple of comments.

cheers,
Pádraig.

From 3030d23e31f3975c0c44207b0faae0792d5cc9b0 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Fri, 15 Oct 2010 12:58:31 +0100
Subject: [PATCH] network: don't die if gateway is down and root server is local

* modules.d/40network/netroot: Don't arping the gateway if we don't need to

---
 modules.d/40network/netroot |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)
modules.d/40network/netroot +22 -6
index 81a9ad3..948f68b 100755
@@ -83,21 +83,37 @@ 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
+
+# Get router IP if set
+[ -n "$new_routers" ] && gw_ip=${new_routers%%,*}
+[ -n "$gw" ] && gw_ip=$gw
+# Get root server IP if set
+if [ -n "$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
+# Default arping dest to router
+dest="$gw_ip"
+# Change to arping root server if appropriate
+if [ -n "$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 [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
     die "Resolving $dest via ARP on $netif failed"
 fi
Signature · 1 line
1.6.2.5

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

Re: [PATCH] network: don't die if gateway is down and root server is local

Quoted 10 lines · Pádraig Brady
Quoted 3 lines · Harald Hoyer

please use [ -n "$var" ]

Done, and added a couple of comments.

cheers,
Pádraig.

Quoted 7 lines

From 3030d23e31f3975c0c44207b0faae0792d5cc9b0 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?=<[email protected]>
Date: Fri, 15 Oct 2010 12:58:31 +0100
Subject: [PATCH] network: don't die if gateway is down and root server is local

* modules.d/40network/netroot: Don't arping the gateway if we don't need to

pushed