From: Harald Hoyer <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: "Pádraig Brady" <P@draigBrady.com>
Cc: Seewer Philippe <philippe.seewer-omB+W0Dpw2o@public.gmane.org>,
"initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] network: don't die if gateway is down and root server is local
Date: Fri, 15 Oct 2010 15:43:15 +0200 [thread overview]
Message-ID: <4CB85A73.6010902@redhat.com> (raw)
In-Reply-To: <4CB84390.5060203-V8g9lnOeT5ydJdNcDFJN0w@public.gmane.org>
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" ]
next prev parent reply other threads:[~2010-10-15 13:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 10:20 dracut requires router Pádraig Brady
[not found] ` <4CAEF060.8030701-V8g9lnOeT5ydJdNcDFJN0w@public.gmane.org>
2010-10-08 13:30 ` Seewer Philippe
[not found] ` <4CAF1D02.6060701-omB+W0Dpw2o@public.gmane.org>
2010-10-08 13:59 ` Pádraig Brady
[not found] ` <4CAF23BA.4010605-V8g9lnOeT5ydJdNcDFJN0w@public.gmane.org>
2010-10-08 14:17 ` Seewer Philippe
[not found] ` <4CAF27EF.80301-omB+W0Dpw2o@public.gmane.org>
2010-10-08 15:19 ` Pádraig Brady
[not found] ` <4CAF367D.7030707-V8g9lnOeT5ydJdNcDFJN0w@public.gmane.org>
2010-10-15 12:05 ` [PATCH] network: don't die if gateway is down and root server is local Pádraig Brady
[not found] ` <4CB84390.5060203-V8g9lnOeT5ydJdNcDFJN0w@public.gmane.org>
2010-10-15 13:43 ` Harald Hoyer [this message]
[not found] ` <4CB85A73.6010902-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-10-15 14:03 ` Pádraig Brady
[not found] ` <4CB85F31.5010207-V8g9lnOeT5ydJdNcDFJN0w@public.gmane.org>
2010-10-28 15:14 ` Harald Hoyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CB85A73.6010902@redhat.com \
--to=harald-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=P@draigBrady.com \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=philippe.seewer-omB+W0Dpw2o@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox