PERFORCE change 166349 for review
Ana Kukec
anchie at FreeBSD.org
Tue Jul 21 08:23:12 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166349
Change 166349 by anchie at anchie_malimis on 2009/07/21 08:22:44
Call the input hook for each incoming ND packet, and return
IPPROTO_DONE after sending it to userspace SEND application.
Affected files ...
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#17 edit
Differences ...
==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#17 (text+ko) ====
@@ -765,18 +765,20 @@
/* give up local */
/* Send incoming SeND-protected/ND packet to user space. */
- if (send_input_hook != NULL)
- send_input_hook(m, ifp, SND_IN, ip6len);
- else {
+ if (send_output_hook != NULL) {
+ send_output_hook(m, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else {
/* give up local */
nd6_rs_input(m, off, icmp6len);
}
m = NULL;
goto freeit;
}
- if (send_input_hook != NULL)
- send_input_hook(n, ifp, SND_IN, ip6len);
- else
+ if (send_output_hook != NULL) {
+ send_output_hook(n, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else
nd6_rs_input(n, off, icmp6len);
/* m stays. */
break;
@@ -790,16 +792,18 @@
if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
/* Send incoming SeND-protected/ND packet to user space. */
- if (send_input_hook != NULL)
- send_input_hook(m, ifp, SND_IN, ip6len);
- else
+ if (send_output_hook != NULL) {
+ send_output_hook(m, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else
nd6_ra_input(m, off, icmp6len);
m = NULL;
goto freeit;
}
- if (send_input_hook != NULL)
- send_input_hook(n, ifp, SND_IN, ip6len);
- else
+ if (send_output_hook != NULL) {
+ send_output_hook(n, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else
nd6_ra_input(n, off, icmp6len);
/* m stays. */
break;
@@ -813,18 +817,20 @@
if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
/* Send incoming SeND-protected/ND packet to user space. */
- if (send_input_hook != NULL)
- send_input_hook(m, ifp, SND_IN, ip6len);
- else {
+ if (send_output_hook != NULL) {
+ send_output_hook(m, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else {
/* give up local */
nd6_ns_input(m, off, icmp6len);
}
m = NULL;
goto freeit;
}
- if (send_input_hook != NULL)
- send_input_hook(n, ifp, SND_IN, ip6len);
- else
+ if (send_output_hook != NULL) {
+ send_output_hook(n, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else
nd6_ns_input(n, off, icmp6len);
/* m stays. */
break;
@@ -838,18 +844,20 @@
if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
/* Send incoming SeND-protected/ND packet to user space. */
- if (send_input_hook != NULL)
- send_input_hook(m, ifp, SND_IN, ip6len);
- else {
+ if (send_output_hook != NULL) {
+ send_output_hook(m, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else {
/* give up local */
nd6_na_input(m, off, icmp6len);
}
m = NULL;
goto freeit;
}
- if (send_input_hook != NULL)
- send_input_hook(n, ifp, SND_IN, ip6len);
- else
+ if (send_output_hook != NULL) {
+ send_output_hook(n, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else
nd6_na_input(n, off, icmp6len);
/* m stays. */
break;
@@ -863,18 +871,20 @@
if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
/* Send incoming SeND-protected/ND packet to user space. */
- if (send_input_hook != NULL)
- send_input_hook(m, ifp, SND_IN, ip6len);
- else {
+ if (send_output_hook != NULL) {
+ send_output_hook(m, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else {
/* give up local */
icmp6_redirect_input(m, off);
}
m = NULL;
goto freeit;
}
- if (send_input_hook != NULL)
- send_input_hook(n, ifp, SND_IN, ip6len);
- else
+ if (send_output_hook != NULL) {
+ send_output_hook(n, ifp, SND_IN, ip6len);
+ return (IPPROTO_DONE);
+ } else
icmp6_redirect_input(n, off);
/* m stays. */
break;
@@ -2780,7 +2790,7 @@
nd_rd->nd_rd_cksum = in6_cksum(m, IPPROTO_ICMPV6,
sizeof(*ip6), ntohs(ip6->ip6_plen));
- if (send_input_hook != NULL) {
+ if (send_output_hook != NULL) {
mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short),
M_NOWAIT);
if (mtag == NULL)
More information about the p4-projects
mailing list