From owner-p4-projects@FreeBSD.ORG Thu Apr 1 12:17:54 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2D4501065670; Thu, 1 Apr 2010 12:17:54 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5F05106566B for ; Thu, 1 Apr 2010 12:17:53 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id D2F468FC0A for ; Thu, 1 Apr 2010 12:17:53 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o31CHrQv040576 for ; Thu, 1 Apr 2010 12:17:53 GMT (envelope-from anchie@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o31CHrtL040574 for perforce@freebsd.org; Thu, 1 Apr 2010 12:17:53 GMT (envelope-from anchie@FreeBSD.org) Date: Thu, 1 Apr 2010 12:17:53 GMT Message-Id: <201004011217.o31CHrtL040574@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to anchie@FreeBSD.org using -f From: Ana Kukec To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 176404 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Apr 2010 12:17:54 -0000 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 #include +#include #include #define L3_ADDR_SIN6(le) ((struct sockaddr_in6 *) L3_ADDR(le)) #include @@ -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 #include +#include #include #include #include @@ -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; }