summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authoramaguire <none@none>2007-04-27 02:36:22 -0700
committeramaguire <none@none>2007-04-27 02:36:22 -0700
commit032ae3d9dc781b45931a4e8b7c4c527ff1419ddc (patch)
tree305b2e9affbe0afb21366d73cba8445cae4ed71d /usr/src
parent038a8f41fc75478546db55fe98bd9c7fc5e08b96 (diff)
downloadillumos-gate-032ae3d9dc781b45931a4e8b7c4c527ff1419ddc.tar.gz
6545585 t_optmgmt System error message appears when rebooting after installation/upgrade
6548363 incorrect formatting of AF_LINK interface name in nwamd
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cmd-inet/lib/nwamd/events.c14
-rw-r--r--usr/src/cmd/cmd-inet/lib/nwamd/interface.c37
-rw-r--r--usr/src/cmd/svc/milestone/net-routing-setup27
-rw-r--r--usr/src/cmd/svc/milestone/net-svc35
-rw-r--r--usr/src/cmd/svc/shell/net_include.sh61
5 files changed, 114 insertions, 60 deletions
diff --git a/usr/src/cmd/cmd-inet/lib/nwamd/events.c b/usr/src/cmd/cmd-inet/lib/nwamd/events.c
index 8d23d0816c..0269d775eb 100644
--- a/usr/src/cmd/cmd-inet/lib/nwamd/events.c
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/events.c
@@ -353,6 +353,11 @@ routing_events(void *arg)
if ((addr_dl = (struct sockaddr_dl *)getaddr
(RTA_IFP, ifa->ifam_addrs, addrs)) == NULL)
break;
+ /*
+ * We don't use the lladdr in this structure so we can
+ * run over it.
+ */
+ addr_dl->sdl_data[addr_dl->sdl_nlen] = 0;
if_name = addr_dl->sdl_data;
ifp = get_interface(if_name);
if (ifp == NULL) {
@@ -386,6 +391,11 @@ routing_events(void *arg)
if ((addr_dl = (struct sockaddr_dl *)getaddr(RTA_IFP,
ifm->ifm_addrs, addrs)) == NULL)
break;
+ /*
+ * We don't use the lladdr in this structure so we can
+ * run over it.
+ */
+ addr_dl->sdl_data[addr_dl->sdl_nlen] = 0;
if_name = addr_dl->sdl_data;
ifp = get_interface(if_name);
if (ifp == NULL) {
@@ -545,8 +555,8 @@ printaddr(void **address)
*address = (char *)*address + sizeof (*s6);
break;
case AF_LINK:
- (void) snprintf(buffer, sizeof (buffer), "link %s",
- dl->sdl_data);
+ (void) snprintf(buffer, sizeof (buffer), "link %.*s",
+ dl->sdl_nlen, dl->sdl_data);
*address = (char *)*address + sizeof (*dl);
break;
default:
diff --git a/usr/src/cmd/cmd-inet/lib/nwamd/interface.c b/usr/src/cmd/cmd-inet/lib/nwamd/interface.c
index 3724275f6e..c4fbc7dc92 100644
--- a/usr/src/cmd/cmd-inet/lib/nwamd/interface.c
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/interface.c
@@ -429,25 +429,26 @@ activate_upper_layer_profile(boolean_t do_dhcp, const char *ifname)
size_t buflen;
size_t offset;
const char bringup[] = "/bringup";
+ boolean_t should;
+ int res;
- if (do_dhcp) {
- boolean_t should;
- int res;
-
- res = lookup_boolean_property(OUR_PG, "use_net_svc", &should);
- /*
- * If the look-up failed, try anyway: only avoid this if we
- * know for sure not to.
- */
- if ((res == 0 && should) || (res == -1)) {
- if (check_svc_up(NET_SVC_FMRI, 5)) {
- (void) start_child(NET_SVC_METHOD, "start",
- ifname, NULL);
- } else {
- syslog(LOG_WARNING, "timed out when waiting "
- "for %s to come up, start method %s not "
- "executed", NET_SVC_FMRI, NET_SVC_METHOD);
- }
+ res = lookup_boolean_property(OUR_PG, "use_net_svc", &should);
+ /*
+ * If the look-up failed, try anyway: only avoid this if we
+ * know for sure not to.
+ */
+ if ((res == 0 && should) || (res == -1)) {
+ if (check_svc_up(NET_SVC_FMRI, 5)) {
+ /*
+ * If doing dhcp, pass in specific interface
+ * name to net-svc so dhcpinfo can specify it.
+ */
+ (void) start_child(NET_SVC_METHOD, "start",
+ do_dhcp ? ifname : NULL, NULL);
+ } else {
+ syslog(LOG_WARNING, "timed out when waiting "
+ "for %s to come up, start method %s not "
+ "executed", NET_SVC_FMRI, NET_SVC_METHOD);
}
}
f = popen(ULP_DIR "/check-conditions", "r");
diff --git a/usr/src/cmd/svc/milestone/net-routing-setup b/usr/src/cmd/svc/milestone/net-routing-setup
index dbc879e5e1..83078cc607 100644
--- a/usr/src/cmd/svc/milestone/net-routing-setup
+++ b/usr/src/cmd/svc/milestone/net-routing-setup
@@ -28,6 +28,7 @@
# This script configures IP routing.
. /lib/svc/share/smf_include.sh
+. /lib/svc/share/net_include.sh
#
# In a shared-IP zone we need this service to be up, but all of the work
@@ -61,28 +62,10 @@ if [ -n "$dynamic_routing_test" ]; then
dynamic_routing="true"
fi
-/usr/sbin/ifconfig -a6u >/etc/svc/volatile/ifconfig.$$
-numv6ifs=`/usr/bin/grep -c inet6 /etc/svc/volatile/ifconfig.$$`
-
-if [ $numv6ifs -gt 1 ]; then
- #
- # Add a static route for multicast packets out of a link-local
- # interface, although would like to specify multicast interface using
- # an interface name!
- #
- set -- `/usr/bin/awk '
- /inet6 fe80:/ {
- print substr($2, 1, index($2, "/") - 1)
- }' /etc/svc/volatile/ifconfig.$$`
-
- if [ -n "$1" ]; then
- echo "Setting default IPv6 interface for multicast:" \
- "add net ff00::/8: gateway $1"
- /usr/sbin/route -n add -interface -inet6 "ff00::/8" "$1" \
- >/dev/null
- fi
-fi
-/usr/bin/rm -f /etc/svc/volatile/ifconfig.$$
+#
+# Add a static route for IPv6 multicast packets.
+#
+update_v6_multicast_route
#
# Configure default IPv4 routers using the local "/etc/defaultrouter"
diff --git a/usr/src/cmd/svc/milestone/net-svc b/usr/src/cmd/svc/milestone/net-svc
index f987e91dc4..2aa8139736 100644
--- a/usr/src/cmd/svc/milestone/net-svc
+++ b/usr/src/cmd/svc/milestone/net-svc
@@ -32,6 +32,7 @@
#
. /lib/svc/share/smf_include.sh
+. /lib/svc/share/net_include.sh
case "$1" in
'start')
@@ -237,20 +238,6 @@ if /usr/bin/grep '# Added by DHCP$' /etc/inet/hosts >/dev/null 2>&1; then
mv_file /tmp/hosts.$$ /etc/inet/hosts 444
fi
-if [ -z "$SMF_FMRI" ] || [ "$SMF_FMRI" = "svc:/network/physical:nwam" ]; then
- exit 0
-fi
-
-#
-# Load the IPQoS configuration.
-# This is backgrounded so that any remote hostname lookups it performs
-# don't unduely delay startup. Any messages go via syslog.
-#
-
-if [ -f /usr/sbin/ipqosconf -a -f /etc/inet/ipqosinit.conf ]; then
- /usr/sbin/ipqosconf -s -a /etc/inet/ipqosinit.conf &
-fi
-
#
# Add a static route for multicast packets out our default interface.
# The default interface is the interface that corresponds to the node name.
@@ -269,3 +256,23 @@ echo "Setting default IPv4 interface for multicast:" \
/usr/sbin/route -n add -interface 224.0/4 -gateway "$mcastif" >/dev/null
) &
+
+#
+# NWAM-triggered interface changes may necessitate updating IPv6 multicast
+# route.
+#
+update_v6_multicast_route
+
+if [ -z "$SMF_FMRI" ] || [ "$SMF_FMRI" = "svc:/network/physical:nwam" ]; then
+ exit 0
+fi
+
+#
+# Load the IPQoS configuration.
+# This is backgrounded so that any remote hostname lookups it performs
+# don't unduely delay startup. Any messages go via syslog.
+#
+
+if [ -f /usr/sbin/ipqosconf -a -f /etc/inet/ipqosinit.conf ]; then
+ /usr/sbin/ipqosconf -s -a /etc/inet/ipqosinit.conf &
+fi
diff --git a/usr/src/cmd/svc/shell/net_include.sh b/usr/src/cmd/svc/shell/net_include.sh
index d39e610345..5dab31b2be 100644
--- a/usr/src/cmd/svc/shell/net_include.sh
+++ b/usr/src/cmd/svc/shell/net_include.sh
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -581,3 +580,57 @@ move_addresses()
done
echo "."
}
+
+#
+# Add IPv6 multicast route, either for link-local interface (if present)
+# or loopback interface.
+#
+update_v6_multicast_route()
+{
+ #
+ # If we have a persistent multicast route installed, do nothing.
+ #
+ if `/usr/sbin/route -p show | /usr/bin/grep ff00::/8 > /dev/null 2>&1`
+ then
+ return
+ fi
+ #
+ # If we had a previous non-persistent v6 multicast route for link-local
+ # or loopback address, then remove it.
+ #
+ mcast_gateways=`/usr/bin/netstat -f inet6 -rn | /usr/bin/awk \
+ '/ff00::\/8[ \t]+(::1|fe80:)/ { print $2 }'`
+ for gateway in $mcast_gateways
+ do
+ /usr/sbin/route -n delete -interface -inet6 \
+ ff00::/8 $gateway > /dev/null
+ done
+
+ ifconfig_out="/etc/svc/volatile/ifconfig.$$"
+
+ /usr/sbin/ifconfig -a6u > $ifconfig_out
+ numv6ifs=`/usr/bin/grep -c inet6 $ifconfig_out`
+
+ if [ $numv6ifs -gt 1 ]; then
+ #
+ # Add a static route for multicast packets out of a link-local
+ # interface, although would like to specify multicast interface
+ # using an interface name!
+ #
+ link_local=`/usr/bin/awk '/inet6 fe80:/ \
+ { print substr($2, 1, index($2, "/") - 1) }' $ifconfig_out`
+ if [ -n "$link_local" ]; then
+ echo "Setting default IPv6 interface for multicast:" \
+ "add net ff00::/8: gateway $link_local"
+ for link in $link_local
+ do
+ /usr/sbin/route -n add -interface -inet6 \
+ ff00::/8 $link > /dev/null
+ done
+ fi
+ elif [ $numv6ifs -eq 1 ]; then
+ /usr/sbin/route -n add -interface -inet6 "ff00::/8" ::1 \
+ > /dev/null
+ fi
+ /usr/bin/rm -f $ifconfig_out
+}