6917433 Can create undeletable routes
authorNitin Hande <Nitin.Hande@Sun.COM>
Mon, 08 Feb 2010 10:05:14 -0800
changeset 11634 ae6532b08887
parent 11633 0ee7d746875a
child 11635 2d03b93bcbc0
6917433 Can create undeletable routes
usr/src/uts/common/inet/ip/ip6_if.c
usr/src/uts/common/inet/ip/ip6_ire.c
usr/src/uts/common/inet/ip/ip_if.c
usr/src/uts/common/inet/ip/ip_ire.c
--- a/usr/src/uts/common/inet/ip/ip6_if.c	Sat Feb 06 19:03:34 2010 -0800
+++ b/usr/src/uts/common/inet/ip/ip6_if.c	Mon Feb 08 10:05:14 2010 -0800
@@ -2513,6 +2513,7 @@
 	char		buf[INET6_ADDRSTRLEN];
 	ire_t		*ire_local = NULL;	/* LOCAL or LOOPBACK */
 	ire_t		*ire_if = NULL;
+	in6_addr_t	*gw;
 
 	if (!IN6_IS_ADDR_UNSPECIFIED(&ipif->ipif_v6lcl_addr) &&
 	    !(ipif->ipif_flags & IPIF_NOLOCAL)) {
@@ -2532,6 +2533,11 @@
 				return (EINVAL);
 		}
 
+		if (loopback)
+			gw = &ipif->ipif_v6lcl_addr;
+		else
+			gw = NULL;
+
 		/* Register the source address for __sin6_src_id */
 		err = ip_srcid_insert(&ipif->ipif_v6lcl_addr,
 		    ipif->ipif_zoneid, ipst);
@@ -2551,7 +2557,7 @@
 		ire_local = ire_create_v6(
 		    &ipif->ipif_v6lcl_addr,		/* dest address */
 		    &ipv6_all_ones,			/* mask */
-		    NULL,				/* no gateway */
+		    gw,					/* gateway */
 		    ipif->ipif_ire_type,		/* LOCAL or LOOPBACK */
 		    ipif->ipif_ill,			/* interface */
 		    ipif->ipif_zoneid,
--- a/usr/src/uts/common/inet/ip/ip6_ire.c	Sat Feb 06 19:03:34 2010 -0800
+++ b/usr/src/uts/common/inet/ip/ip6_ire.c	Mon Feb 08 10:05:14 2010 -0800
@@ -101,8 +101,6 @@
 	/* Make sure we don't have stray values in some fields */
 	switch (type) {
 	case IRE_LOOPBACK:
-		ire->ire_gateway_addr_v6 = ire->ire_addr_v6;
-		/* FALLTHRU */
 	case IRE_HOST:
 	case IRE_LOCAL:
 	case IRE_IF_CLONE:
--- a/usr/src/uts/common/inet/ip/ip_if.c	Sat Feb 06 19:03:34 2010 -0800
+++ b/usr/src/uts/common/inet/ip/ip_if.c	Mon Feb 08 10:05:14 2010 -0800
@@ -14439,6 +14439,7 @@
 	int		err;
 	ire_t		*ire_local = NULL;	/* LOCAL or LOOPBACK */
 	ire_t		*ire_if = NULL;
+	uchar_t		*gw;
 
 	if ((ipif->ipif_lcl_addr != INADDR_ANY) &&
 	    !(ipif->ipif_flags & IPIF_NOLOCAL)) {
@@ -14459,11 +14460,16 @@
 			return (err);
 		}
 
+		if (loopback)
+			gw = (uchar_t *)&ipif->ipif_lcl_addr;
+		else
+			gw = NULL;
+
 		/* If the interface address is set, create the local IRE. */
 		ire_local = ire_create(
 		    (uchar_t *)&ipif->ipif_lcl_addr,	/* dest address */
 		    (uchar_t *)&ip_g_all_ones,		/* mask */
-		    NULL,				/* no gateway */
+		    gw,					/* gateway */
 		    ipif->ipif_ire_type,		/* LOCAL or LOOPBACK */
 		    ipif->ipif_ill,
 		    ipif->ipif_zoneid,
--- a/usr/src/uts/common/inet/ip/ip_ire.c	Sat Feb 06 19:03:34 2010 -0800
+++ b/usr/src/uts/common/inet/ip/ip_ire.c	Mon Feb 08 10:05:14 2010 -0800
@@ -516,8 +516,6 @@
 	/* Make sure we don't have stray values in some fields */
 	switch (type) {
 	case IRE_LOOPBACK:
-		bcopy(&ire->ire_addr, &ire->ire_gateway_addr, IP_ADDR_LEN);
-		/* FALLTHRU */
 	case IRE_HOST:
 	case IRE_BROADCAST:
 	case IRE_LOCAL: