Date: Tue, 29 Apr 2014 06:14:36 +0000 (UTC) From: Bryan Venteicher <bryanv@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r265082 - in projects/vxlan/sys: netinet netinet6 Message-ID: <201404290614.s3T6EaUc069491@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404290614.s3T6EaUc069491>