Date: Thu, 1 Apr 2010 12:17:53 GMT From: Ana Kukec <anchie@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 176404 for review Message-ID: <201004011217.o31CHrtL040574@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=176404 Change 176404 by anchie@anchie_malimis on 2010/04/01 12:17:03 Apply the send_sendso_input hook only in case that SEND application is still running. If SEND application crashes, kernel will fail back to pure Neighbor Discovery. Affected files ... .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#35 edit .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#26 edit .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6_nbr.c#14 edit .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/raw_ip6.c#9 edit .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#41 edit Differences ... ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#35 (text+ko) ==== @@ -779,7 +779,7 @@ /* give up local */ /* Send incoming SeND-protected/ND packet to user space. */ - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { IP6_EXTHDR_CHECK(m, off, icmp6len, IPPROTO_DONE); printf("send_sendso_input_hook\n"); send_sendso_input_hook(V_send_so, m, SND_IN, ip6len); @@ -790,7 +790,7 @@ m = NULL; goto freeit; } - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { IP6_EXTHDR_CHECK(m, off, icmp6len, IPPROTO_DONE); printf("send_sendso_input_hook\n"); send_sendso_input_hook(V_send_so, n, SND_IN, ip6len); @@ -809,7 +809,7 @@ if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* Send incoming SeND-protected/ND packet to user space. */ - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { send_sendso_input_hook(V_send_so, m, SND_IN, ip6len); return (IPPROTO_DONE); @@ -818,7 +818,7 @@ m = NULL; goto freeit; } - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { send_sendso_input_hook(V_send_so, n, SND_IN, ip6len); return (IPPROTO_DONE); } else @@ -833,7 +833,7 @@ if (icmp6len < sizeof(struct nd_neighbor_solicit)) goto badlen; if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { /* Send incoming SeND/ND packet to user space. */ printf("%s: send_sendso_input_hook m=%p\n", __func__, m); send_sendso_input_hook(V_send_so, m, SND_IN, ip6len); @@ -844,7 +844,7 @@ m = NULL; goto freeit; } - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { /* Send incoming SeND/ND packet to user space. */ printf("%s: send_sendso_input_hook n=%p\n", __func__, n); send_sendso_input_hook(V_send_so, n, SND_IN, ip6len); @@ -862,7 +862,7 @@ if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* Send incoming SeND-protected/ND packet to user space. */ - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { send_sendso_input_hook(V_send_so, m, SND_IN, ip6len); return (IPPROTO_DONE); } else { @@ -888,7 +888,7 @@ if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* Send incoming SeND-protected/ND packet to user space. */ - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { send_sendso_input_hook(V_send_so, m, SND_IN, ip6len); return (IPPROTO_DONE); } else { @@ -898,7 +898,7 @@ m = NULL; goto freeit; } - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { send_sendso_input_hook(V_send_so, n, SND_IN, ip6len); return (IPPROTO_DONE); } else @@ -2804,7 +2804,7 @@ nd_rd->nd_rd_cksum = in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), ntohs(ip6->ip6_plen)); - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); if (mtag == NULL) ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#26 (text+ko) ==== @@ -113,8 +113,6 @@ static struct sockaddr_in6 all1_sa; -int (*send_input_hook)(struct mbuf *, struct ifnet *, int, int); -int (*send_output_hook)(struct mbuf *, struct ifnet *, int); int (*send_sendso_input_hook)(struct socket *, struct mbuf *, int, int); static int nd6_is_new_addr_neighbor __P((struct sockaddr_in6 *, @@ -298,6 +296,8 @@ nd6_option_init(void *opt, int icmp6len, union nd_opts *ndopts) { +printf("XXX-AK: nd6.c: nd6_option_init(), icmp6len = %d\n", icmp6len); + bzero(ndopts, sizeof(*ndopts)); ndopts->nd_opts_search = (struct nd_opt_hdr *)opt; ndopts->nd_opts_last @@ -330,7 +330,9 @@ nd_opt = ndopts->nd_opts_search; /* make sure nd_opt_len is inside the buffer */ +printf("nd6.c: nd6_option(), nd_opt->nd_opt_len: %d\n", nd_opt->nd_opt_len); if ((caddr_t)&nd_opt->nd_opt_len >= (caddr_t)ndopts->nd_opts_last) { +printf("nd_opt->nd_opt_len >= ndopts->nd_opts_last\n"); bzero(ndopts, sizeof(*ndopts)); return NULL; } @@ -1987,15 +1989,11 @@ #endif /* send outgoing NS/NA/REDIRECT packet to sendd. */ - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { mtag = m_tag_find(m, PACKET_TAG_ND_OUTGOING, NULL); if (mtag != NULL) { skip = 1; nd_type = (unsigned short *)(mtag + 1); -#if 0 - XXX-AK: - send_input_hook(m, ifp, SND_OUT, ip6len); -#endif /* Use the SEND socket */ printf("send_sendso_input_hook\n"); error = send_sendso_input_hook(V_send_so, m, SND_OUT, ip6len); ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6_nbr.c#14 (text+ko) ==== @@ -64,6 +64,7 @@ #include <netinet/in.h> #include <netinet/in_var.h> +#include <netinet/ip_var.h> #include <net/if_llatbl.h> #define L3_ADDR_SIN6(le) ((struct sockaddr_in6 *) L3_ADDR(le)) #include <netinet6/in6_var.h> @@ -570,7 +571,7 @@ nd_ns->nd_ns_cksum = in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), icmp6len); - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); if (mtag == NULL) @@ -897,7 +898,7 @@ * the 2nd argument as the 1st one. */ - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); if (mtag == NULL) @@ -1092,7 +1093,7 @@ nd_na->nd_na_cksum = in6_cksum(m, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), icmp6len); - if (send_sendso_input_hook != NULL) { + if (send_sendso_input_hook != NULL && V_send_so != NULL) { mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); if (mtag == NULL) ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/raw_ip6.c#9 (text+ko) ==== @@ -92,6 +92,7 @@ #include <netinet/icmp6.h> #include <netinet/ip6.h> +#include <netinet/ip_var.h> #include <netinet6/ip6protosw.h> #include <netinet6/ip6_mroute.h> #include <netinet6/in6_pcb.h> @@ -535,6 +536,7 @@ * them to rtadvd/rtsol. */ if (send_sendso_input_hook != NULL && + V_send_so != NULL && so->so_proto->pr_protocol == IPPROTO_ICMPV6) { switch (type) { case ND_ROUTER_ADVERT: ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#41 (text+ko) ==== @@ -254,6 +254,7 @@ static void send_close(struct socket *so) { + if (V_send_so) V_send_so = NULL; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004011217.o31CHrtL040574>