From owner-svn-src-projects@FreeBSD.ORG Tue Apr 29 06:14:37 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C3D4A19B; Tue, 29 Apr 2014 06:14:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0FAE16BB; Tue, 29 Apr 2014 06:14:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3T6EbDB069496; Tue, 29 Apr 2014 06:14:37 GMT (envelope-from bryanv@svn.freebsd.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3T6EaUc069491; Tue, 29 Apr 2014 06:14:36 GMT (envelope-from bryanv@svn.freebsd.org) Message-Id: <201404290614.s3T6EaUc069491@svn.freebsd.org> From: Bryan Venteicher Date: Tue, 29 Apr 2014 06:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r265082 - in projects/vxlan/sys: netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Apr 2014 06:14:37 -0000 Author: bryanv Date: Tue Apr 29 06:14:36 2014 New Revision: 265082 URL: http://svnweb.freebsd.org/changeset/base/265082 Log: Provide the source sockaddr to the UDP tunnel callback vxlan needs this to populate its forwarding table. And while here, make upd6_append() look a bit more like upd_append(). While I doubt there is an out of tree consumer of the UDP tunneling callback, this does make an MFC a pain. Modified: projects/vxlan/sys/netinet/sctputil.c projects/vxlan/sys/netinet/udp_usrreq.c projects/vxlan/sys/netinet/udp_var.h projects/vxlan/sys/netinet6/udp6_usrreq.c Modified: projects/vxlan/sys/netinet/sctputil.c ============================================================================== --- projects/vxlan/sys/netinet/sctputil.c Tue Apr 29 06:12:57 2014 (r265081) +++ projects/vxlan/sys/netinet/sctputil.c Tue Apr 29 06:14:36 2014 (r265082) @@ -6799,7 +6799,8 @@ sctp_log_trace(uint32_t subsys, const ch #endif static void -sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored) +sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored, + const struct sockaddr *sa SCTP_UNUSED) { struct ip *iph; Modified: projects/vxlan/sys/netinet/udp_usrreq.c ============================================================================== --- projects/vxlan/sys/netinet/udp_usrreq.c Tue Apr 29 06:12:57 2014 (r265081) +++ projects/vxlan/sys/netinet/udp_usrreq.c Tue Apr 29 06:14:36 2014 (r265082) @@ -303,7 +303,7 @@ udp_append(struct inpcb *inp, struct ip */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { - (*up->u_tun_func)(n, off, inp); + (*up->u_tun_func)(n, off, inp, (struct sockaddr *) udp_in); return; } Modified: projects/vxlan/sys/netinet/udp_var.h ============================================================================== --- projects/vxlan/sys/netinet/udp_var.h Tue Apr 29 06:12:57 2014 (r265081) +++ projects/vxlan/sys/netinet/udp_var.h Tue Apr 29 06:14:36 2014 (r265082) @@ -55,7 +55,8 @@ struct udpiphdr { struct inpcb; struct mbuf; -typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *); +typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *, + const struct sockaddr *); /* * UDP control block; one per udp. Modified: projects/vxlan/sys/netinet6/udp6_usrreq.c ============================================================================== --- projects/vxlan/sys/netinet6/udp6_usrreq.c Tue Apr 29 06:12:57 2014 (r265081) +++ projects/vxlan/sys/netinet6/udp6_usrreq.c Tue Apr 29 06:14:36 2014 (r265082) @@ -139,9 +139,18 @@ udp6_append(struct inpcb *inp, struct mb { struct socket *so; struct mbuf *opts; + struct udpcb *up; INP_LOCK_ASSERT(inp); + /* + * Engage the tunneling protocol. + */ + up = intoudpcb(inp); + if (up->u_tun_func != NULL) { + (*up->u_tun_func)(n, off, inp, (struct sockaddr *)fromsa); + return; + } #ifdef IPSEC /* Check AH/ESP integrity. */ if (ipsec6_in_reject(n, inp)) { @@ -354,20 +363,7 @@ udp6_input(struct mbuf **mp, int *offp, if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { INP_RLOCK(last); - up = intoudpcb(last); - if (up->u_tun_func == NULL) { - udp6_append(last, n, off, &fromsa); - } else { - /* - * Engage the tunneling - * protocol we will have to - * leave the info_lock up, - * since we are hunting - * through multiple UDP's. - * - */ - (*up->u_tun_func)(n, off, last); - } + udp6_append(last, n, off, &fromsa); INP_RUNLOCK(last); } } @@ -399,14 +395,7 @@ udp6_input(struct mbuf **mp, int *offp, INP_INFO_RUNLOCK(pcbinfo); up = intoudpcb(last); UDP_PROBE(receive, NULL, last, ip6, last, uh); - if (up->u_tun_func == NULL) { - udp6_append(last, m, off, &fromsa); - } else { - /* - * Engage the tunneling protocol. - */ - (*up->u_tun_func)(m, off, last); - } + udp6_append(last, m, off, &fromsa); INP_RUNLOCK(last); return (IPPROTO_DONE); } @@ -485,15 +474,7 @@ udp6_input(struct mbuf **mp, int *offp, } } UDP_PROBE(receive, NULL, inp, ip6, inp, uh); - if (up->u_tun_func == NULL) { - udp6_append(inp, m, off, &fromsa); - } else { - /* - * Engage the tunneling protocol. - */ - - (*up->u_tun_func)(m, off, inp); - } + udp6_append(inp, m, off, &fromsa); INP_RUNLOCK(inp); return (IPPROTO_DONE);