PERFORCE change 177906 for review

Ana Kukec anchie at FreeBSD.org
Fri May 7 14:48:32 UTC 2010


http://p4web.freebsd.org/@@177906?ac=10

Change 177906 by anchie at anchie_malimis on 2010/05/07 14:48:07

	Minor modifications of netinet6/send.c	

Affected files ...

.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#40 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#30 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6_nbr.c#17 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#44 edit

Differences ...

==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#40 (text+ko) ====

@@ -786,15 +786,11 @@
 				error = send_sendso_input_hook(m, 
 				    SND_IN, ip6len);
 				/* -1 == no app on SEND socket */
-				if (!error)
-				    return (IPPROTO_DONE);
+				if (error == -1)
+				    nd6_rs_input(m, off, icmp6len);
 			}
-			if ((send_sendso_input_hook != NULL 
-			    && error == -1) || 
-			    send_sendso_input_hook == NULL) {
-				/* give up local */
+			if (send_sendso_input_hook == NULL)
 				nd6_rs_input(m, off, icmp6len);
-			}
 			m = NULL;
 			goto freeit;
 		}
@@ -804,13 +800,11 @@
                         error = send_sendso_input_hook(n, 
 			    SND_IN, ip6len);
 			/* -1 == no app on SEND socket */
-			if (!error)
-			    return (IPPROTO_DONE);
+			if (error == -1)
+			    nd6_rs_input(n, off, icmp6len);
 		}
-		if ((send_sendso_input_hook != NULL && error == -1)
-		    || (send_sendso_input_hook == NULL)) {
+		if (send_sendso_input_hook == NULL)
 			nd6_rs_input(n, off, icmp6len);
-		}
 		/* m stays. */
 		break;
 
@@ -826,27 +820,22 @@
 			if (send_sendso_input_hook != NULL) {
 				error = send_sendso_input_hook(m, 
 				    SND_IN, ip6len);	
-				if (!error)
-				    return (IPPROTO_DONE);
+				if (error == -1)
+				    nd6_ra_input(m, off, icmp6len);
 			}
-			if ((send_sendso_input_hook != NULL
-			    && error == -1) ||
-			    send_sendso_input_hook == NULL) {
+			if (send_sendso_input_hook == NULL)
 				nd6_ra_input(m, off, icmp6len);
-			}
 			m = NULL;
 			goto freeit;
 		}
 		if (send_sendso_input_hook != NULL) {
 			error = send_sendso_input_hook(n, 
 			    SND_IN, ip6len);	
-			if (!error)
-			    return (IPPROTO_DONE);
+			if (error == -1)
+			    nd6_ra_input(n, off, icmp6len);
 		}
-		if ((send_sendso_input_hook != NULL && error == -1)
-		    || (send_sendso_input_hook == NULL)) {
+		if (send_sendso_input_hook == NULL)
 			nd6_ra_input(n, off, icmp6len);
-		}
 		/* m stays. */
 		break;
 
@@ -860,24 +849,23 @@
 			if (send_sendso_input_hook != NULL) { 
 				error = send_sendso_input_hook(m, 
 				    SND_IN, ip6len);	
+				if (error == -1)
+				    nd6_ns_input(m, off, icmp6len);
+					
 			}
-			if ((send_sendso_input_hook != NULL
-			    && error == -1) ||
-			    send_sendso_input_hook == NULL) {
-				/* give up local */
+			if (send_sendso_input_hook == NULL)
 				nd6_ns_input(m, off, icmp6len);
-			}
 			m = NULL;
 			goto freeit;
 		}
 		if (send_sendso_input_hook != NULL) { 
 			error = send_sendso_input_hook(n, 
 			    SND_IN, ip6len);
+			if (error == -1)
+			    nd6_ns_input(n, off, icmp6len);
 		} 
-		if ((send_sendso_input_hook != NULL && error == -1)
-		    || (send_sendso_input_hook == NULL)) {
+		if (send_sendso_input_hook == NULL)
 			nd6_ns_input(n, off, icmp6len);
-		}
 		/* m stays. */
 		break;
 
@@ -893,26 +881,22 @@
 			if (send_sendso_input_hook != NULL) {
 				error = send_sendso_input_hook(m, 
 				    SND_IN, ip6len);
-				if (!error)
-				    return (IPPROTO_DONE);
+				if (error == -1)
+				    nd6_na_input(m, off, icmp6len);
 			}
-			if ((send_sendso_input_hook != NULL
-			    && error == -1) ||
-			    send_sendso_input_hook == NULL) {
-				/* give up local */
+			if (send_sendso_input_hook == NULL)
 				nd6_na_input(m, off, icmp6len);
-			}
 			m = NULL;
 			goto freeit;
 		}
 		if (send_sendso_input_hook != NULL) { 
 			error = send_sendso_input_hook(n, 
 			    SND_IN, ip6len);
+			if (error == -1)
+			    nd6_na_input(n, off, icmp6len);
 		}
-		if ((send_sendso_input_hook != NULL && error == -1)
-		    || (send_sendso_input_hook == NULL)) {
+		if (send_sendso_input_hook == NULL)
 			nd6_na_input(n, off, icmp6len);
-		}
 		/* m stays. */
 		break;
 
@@ -924,34 +908,24 @@
 			goto badlen;
 		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
 			if (send_sendso_input_hook != NULL) { 
-				error = send_sendso_input_hook(m, 
+			    error = send_sendso_input_hook(m, 
 				    SND_IN, ip6len);	
-				if (!error)
-				    return (IPPROTO_DONE);
-				else
-				   goto freeit;
+			    if (error == -1)	
+				icmp6_redirect_input(m, off);
 			}
-			if ((send_sendso_input_hook != NULL
-			    && error == -1) ||
-			    send_sendso_input_hook == NULL) {		
-				/* give up local */
+			if (send_sendso_input_hook == NULL) 
 				icmp6_redirect_input(m, off);
-			}
 			m = NULL;
 			goto freeit;
 		}
 		if (send_sendso_input_hook != NULL) { 
-			error = send_sendso_input_hook(n, 
-			    SND_IN, ip6len);
-			if (!error)
-			    return (IPPROTO_DONE);
-			else 
-			    goto freeit;
+		    error = send_sendso_input_hook(n, 
+			SND_IN, ip6len);
+		    if (error == -1)
+			icmp6_redirect_input(n, off);
 		}
-		if ((send_sendso_input_hook != NULL && error == -1)
-		    || (send_sendso_input_hook == NULL)) {
+		if (send_sendso_input_hook == NULL)
 			icmp6_redirect_input(n, off);
-		}
 		/* m stays. */
 		break;
 

==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#30 (text+ko) ====


==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6_nbr.c#17 (text+ko) ====


==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#44 (text+ko) ====

@@ -91,7 +91,7 @@
     icmp6 = (struct icmp6_hdr *)(ip6 + 1);
 
     /*
-     * Output the packet as icmp6.c:incpm6_input() would do.
+     * Output the packet as icmp6.c:icpm6_input() would do.
      * The mbuf is always consumed, so we do not have to
      * care about that.
      */
@@ -202,7 +202,7 @@
     struct snd_hdr *snd_hdr = NULL;
 
     if (V_send_so == NULL)
-	goto freeit;
+	return (-1);
 
     /*
      * Make sure to clear any possible internally embedded scope before
@@ -232,10 +232,6 @@
     sbappendrecord_locked(&s->so_rcv, m);
     sorwakeup_locked(s);
     return (0);
-
-freeit:
-    m_freem(m);
-    return (-1);
 }
 
 static void


More information about the p4-projects mailing list