The file /etc/netstart contains a particularly misleading comment:
    # /etc/mygate, if it exists, contains the name of my gateway host
    # that name must be in /etc/hosts.
This is patently false, since mygate(5) claims it must be an address and
the code clearly contradicts the comment.

This is can lead to undesired behaviour if the name in mygate resolves
to an IPv6 address. Assuming an entry like
    2001:470:abcd::1    mygateway.localdomain
in /etc/hosts, an entry of
    mygateway.localdomain
in /etc/mygate would not match line 258 of /etc/netstart, 
    [[ $gw == @(*:*) ]] && continue
which checks whether the gateway we're adding is an IPv6 address.
netstart would then proceed to try
    route -qn add -host default $gw && break
resulting in a
    route: mygateway.localdomain: bad address
and exit code of 1, in contrast to no output and an exit code of 0 if
the hosts(5) entry were
    192.168.1.1 mygateway.localdomain

The attached patch fixes the issue with the comment. Alternatively, if
the intended behaviour is to permit symbolic names in mygate, mygate(5)
and lines 258 and 263 of /etc/netstart should be updated accordingly.

Best wishes,
Ryan

-- 
|_)|_/  Ryan Kavanagh           | Debian Developer
| \| \  http://ryanak.ca/       | GPG Key 4A11C97A
Index: etc/netstart
===================================================================
RCS file: /cvs/src/etc/netstart,v
retrieving revision 1.137
diff -u -r1.137 netstart
--- etc/netstart	5 Dec 2012 07:08:38 -0000	1.137
+++ etc/netstart	18 Mar 2013 23:40:51 -0000
@@ -252,8 +252,7 @@
 	fi
 fi
 
-# /etc/mygate, if it exists, contains the name of my gateway host
-# that name must be in /etc/hosts.
+# /etc/mygate, if it exists, contains the address of my gateway host.
 [[ -z $dhcpif ]] && stripcom /etc/mygate | while read gw; do
 		[[ $gw == @(*:*) ]] && continue
 		route -qn delete default > /dev/null 2>&1

Reply via email to