Hello,
On 03/12/16(Sat) 19:59, Hrvoje Popovski wrote:
> I don't have ip6 in network where em0 interface is.
> It seems, that when I add inet6 autoconf in hostname.em0 and
> when I do sh netstart em0 I loose ip4 default route. If I do
> ifconfig em0 inet6 autoconf everything is ok. I think that this behavior
> is not intended so i'm sending this to bugs@
Thanks for the report. This is a regression introduced by the removal
of all routes attached to an address. When you run "sh netstart em0"
the kernel delete and create a new address for the interface. So the
correct fix is to always try to add the route in this case.
Could you confirm the diff below fix the issue?
Are ksh(1) people ok with this?
Index: netstart
===================================================================
RCS file: /cvs/src/etc/netstart,v
retrieving revision 1.171
diff -u -p -r1.171 netstart
--- netstart 27 Sep 2016 09:19:11 -0000 1.171
+++ netstart 5 Dec 2016 15:21:59 -0000
@@ -167,6 +167,21 @@ ifv6autoconf() {
done
}
+# Parse /etc/mygate and add default routes for IPv4 and IPv6
+# Usage: defaultroute
+defaultroute() {
+ [[ -z $dhcpif ]] && stripcom /etc/mygate | while read gw; do
+ [[ $gw == @(*:*) ]] && continue
+ route -qn delete default >/dev/null 2>&1
+ route -qn add -host default $gw && break
+ done
+ [[ -z $rtsolif ]] && stripcom /etc/mygate | while read gw; do
+ [[ $gw == !(*:*) ]] && continue
+ route -qn delete -inet6 default >/dev/null 2>&1
+ route -qn add -host -inet6 default $gw && break
+ done
+}
+
# Make sure the invoking user has the right privileges.
if (($(id -u) != 0)); then
echo "${0##*/}: need root privileges"
@@ -178,10 +193,11 @@ FUNCS_ONLY=1 . /etc/rc.d/rc.subr
_rc_parse_conf
# If we were invoked with a list of interface names, just reconfigure these
-# interfaces (or bridges) and return.
+# interfaces (or bridges), add default routes and return.
if (($# > 0)); then
for _if; do ifstart $_if; done
ifv6autoconf
+ defaultroute
return
fi
@@ -262,16 +278,7 @@ ifmstart "trunk svlan vlan carp"
ifv6autoconf
# Look for default routes in /etc/mygate.
-[[ -z $dhcpif ]] && stripcom /etc/mygate | while read gw; do
- [[ $gw == @(*:*) ]] && continue
- route -qn delete default >/dev/null 2>&1
- route -qn add -host default $gw && break
-done
-[[ -z $rtsolif ]] && stripcom /etc/mygate | while read gw; do
- [[ $gw == !(*:*) ]] && continue
- route -qn delete -inet6 default >/dev/null 2>&1
- route -qn add -host -inet6 default $gw && break
-done
+defaultroute
# Multicast routing.
if [[ $multicast != YES ]]; then