From owner-p4-projects@FreeBSD.ORG Thu Jun 25 15:45:29 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9A8501065679; Thu, 25 Jun 2009 15:45:29 +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 5ABB81065675 for ; Thu, 25 Jun 2009 15:45:29 +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 478478FC0C for ; Thu, 25 Jun 2009 15:45:29 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PFjTGq011631 for ; Thu, 25 Jun 2009 15:45:29 GMT (envelope-from anchie@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5PFjT63011629 for perforce@freebsd.org; Thu, 25 Jun 2009 15:45:29 GMT (envelope-from anchie@FreeBSD.org) Date: Thu, 25 Jun 2009 15:45:29 GMT Message-Id: <200906251545.n5PFjT63011629@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 Cc: Subject: PERFORCE change 165172 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 15:45:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=165172 Change 165172 by anchie@anchie_malimis on 2009/06/25 15:44:49 Added m_tags for outgoing NS/NA/Redirect packets that must be sent to sendd in the userspace. Affected files ... .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#12 edit .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#10 edit .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6_nbr.c#3 edit .. //depot/projects/soc2009/anchie_send/src/sys/sys/mbuf.h#4 edit Differences ... ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#12 (text+ko) ==== @@ -768,12 +768,18 @@ /* give up local */ /* send incoming SeND-protected/ND packet to sendd */ - - nd6_rs_input(m, off, icmp6len); + if (send_output_hook != NULL) { + send_output_hook(in, ifp, m, ip6len); + } else { + nd6_rs_input(m, off, icmp6len); + } m = NULL; goto freeit; } - nd6_rs_input(n, off, icmp6len); + if (send_output_hook != NULL) + send_output_hook(in, ifp, n, ip6len); + else + nd6_rs_input(n, off, icmp6len); /* m stays. */ break; @@ -786,13 +792,19 @@ if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* send incoming SeND-protected/ND packet to sendd */ - - /* give up local */ - nd6_ra_input(m, off, icmp6len); + if (send_output_hook != NULL) { + send_output_hook(in, ifp, m, ip6len); + } else { + /* give up local */ + nd6_ra_input(m, off, icmp6len); + } m = NULL; goto freeit; } - nd6_ra_input(n, off, icmp6len); + if (send_output_hook != NULL) + send_output_hook(in, ifp, n, ip6len); + else + nd6_ra_input(n, off, icmp6len); /* m stays. */ break; @@ -805,25 +817,20 @@ if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* send incoming SeND-protected/ND packet to sendd */ - /* ip6len should be the same as icmp6len + off! */ if (send_output_hook != NULL) { - printf("%s %d: send_output_hook != NULL\n", __FUNCTION__, __LINE__); send_output_hook(in, ifp, m, ip6len); /* nd6_ns_input() will be called in X_send_input_hook() */ } else { /* give up local */ - printf("%s %d: send_output_hook == NULL\n", __FUNCTION__, __LINE__); nd6_ns_input(m, off, icmp6len); } m = NULL; goto freeit; } if (send_output_hook != NULL) { - printf("%s %d: send_output_hook != NULL \n", __FUNCTION__, __LINE__); send_output_hook(in, ifp, n, ip6len); /* nd6_ns_input() will be called in X_send_input_hook() */ } else { - printf("%s %d: send_output_hook == NULL \n", __FUNCTION__, __LINE__); nd6_ns_input(n, off, icmp6len); } /* m stays. */ @@ -838,13 +845,19 @@ if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* send incoming SeND-protected/ND packet to sendd */ - - /* give up local */ - nd6_na_input(m, off, icmp6len); + if (send_output_hook != NULL) { + send_output_hook(in, ifp, m, ip6len); + } else { + /* give up local */ + nd6_na_input(m, off, icmp6len); + } m = NULL; goto freeit; } - nd6_na_input(n, off, icmp6len); + if (send_output_hook != NULL) + send_output_hook(in, ifp, n, ip6len); + else + nd6_na_input(n, off, icmp6len); /* m stays. */ break; @@ -857,13 +870,19 @@ if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) { /* send incoming SeND-protected/ND packet to sendd */ - - /* give up local */ - icmp6_redirect_input(m, off); + if (send_output_hook != NULL) { + send_output_hook(in, ifp, m, ip6len); + } else { + /* give up local */ + icmp6_redirect_input(m, off); + } m = NULL; goto freeit; } - icmp6_redirect_input(n, off); + if (send_output_hook != NULL) + send_output_hook(in, ifp, n, ip6len); + else + icmp6_redirect_input(n, off); /* m stays. */ break; @@ -2520,6 +2539,7 @@ struct in6_addr *router_ll6; struct ip6_hdr *sip6; /* m0 as struct ip6_hdr */ struct mbuf *m = NULL; /* newly allocated one */ + struct m_tag *mtag; struct ip6_hdr *ip6; /* m as struct ip6_hdr */ struct nd_redirect *nd_rd; struct llentry *ln = NULL; @@ -2779,6 +2799,14 @@ nd_rd->nd_rd_cksum = in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), ntohs(ip6->ip6_plen)); + if (send_output_hook != NULL) { + mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); + if (mtag == NULL) + goto fail; + *(unsigned short *)(mtag + 1) = nd_rd->nd_rd_type; + m_tag_prepend(m, mtag); + } + /* send the packet to outside... */ ip6_output(m, NULL, NULL, 0, NULL, &outif, NULL); if (outif) { ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6.c#10 (text+ko) ==== @@ -1728,7 +1728,7 @@ int error = 0; int flags = 0; int ip6len; - unsigned short nd_type; + unsigned short *nd_type; printf("%s %d\n", __FUNCTION__, __LINE__); @@ -1911,12 +1911,15 @@ #endif /* send outgoing NS/NA/RS/RA/REDIRECT packet to sendd. */ - mtag = m_tag_find(m, PACKET_TAG_ND_OUTGOING, NULL); - if (mtag != NULL) { - printf("%s %d: ND_OUTGOING tag found.\n", __FUNCTION__, __LINE__); - /*nd_type = (unsigned short *)(mtag + 1);*/ - if (send_output_hook != NULL) { - send_output_hook(0, ifp, m, ip6len); + if (send_output_hook != NULL) { + mtag = m_tag_find(m, PACKET_TAG_ND_OUTGOING, NULL); + if (mtag != NULL) { + printf("%s %d: ND_OUTGOING tag found.\n", __FUNCTION__, __LINE__); + nd_type = (unsigned short *)(mtag + 1); + } else + return(error); + + send_output_hook(0, ifp, m, ip6len); } else { /* ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/nd6_nbr.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/*- +/* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. * @@ -74,6 +74,7 @@ #include #include #include +#include #include #ifdef DEV_CARP @@ -563,11 +564,15 @@ nd_ns->nd_ns_cksum = in6_cksum(m, IPPROTO_ICMPV6, sizeof(*ip6), icmp6len); - mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); - if (mtag == NULL) - goto bad; - /* *(unsigned short *)(mtag + 1) = nd_ns->nd_ns_type;*/ - m_tag_prepend(m, mtag); + if (send_output_hook != NULL) { + mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); + if (mtag == NULL) + goto bad; + else + printf("%s: PACKET_TAG_ND_OUTGOING added.\n", __FUNCTION__); + *(unsigned short *)(mtag + 1) = nd_ns->nd_ns_type; + m_tag_prepend(m, mtag); + } ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); @@ -884,7 +889,6 @@ * we assume ifp is not a loopback here, so just set * the 2nd argument as the 1st one. */ - printf("%s %d: before ned6_output_lle()\n", __FUNCTION__, __LINE__); nd6_output_lle(ifp, ifp, m_hold, L3_ADDR_SIN6(ln), NULL, ln, &chain); } } @@ -930,6 +934,7 @@ { INIT_VNET_INET6(ifp->if_vnet); struct mbuf *m; + struct m_tag *mtag; struct ip6_hdr *ip6; struct nd_neighbor_advert *nd_na; struct ip6_moptions im6o; @@ -1074,6 +1079,14 @@ nd_na->nd_na_cksum = in6_cksum(m, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), icmp6len); + if (send_output_hook != NULL) { + mtag = m_tag_get(PACKET_TAG_ND_OUTGOING, sizeof(unsigned short), M_NOWAIT); + if (mtag == NULL) + goto bad; + *(unsigned short *)(mtag + 1) = nd_na->nd_na_type; + m_tag_prepend(m, mtag); + } + ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); ==== //depot/projects/soc2009/anchie_send/src/sys/sys/mbuf.h#4 (text+ko) ====