Date: Tue, 3 Jun 2014 04:29:11 +0000 (UTC) From: Bryan Venteicher <bryanv@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r266997 - in projects/vxlan/sys: netinet netinet6 Message-ID: <201406030429.s534TBkv027263@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bryanv Date: Tue Jun 3 04:29:10 2014 New Revision: 266997 URL: http://svnweb.freebsd.org/changeset/base/266997 Log: Add an opaque context pointer to the UDP tunneling callback 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 Jun 3 02:34:21 2014 (r266996) +++ projects/vxlan/sys/netinet/sctputil.c Tue Jun 3 04:29:10 2014 (r266997) @@ -6800,7 +6800,7 @@ sctp_log_trace(uint32_t subsys, const ch #endif static void sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *ignored, - const struct sockaddr *sa SCTP_UNUSED) + const struct sockaddr *sa SCTP_UNUSED, void *ctx SCTP_UNUSED) { struct ip *iph; @@ -6936,7 +6936,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp4_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } @@ -6960,7 +6960,7 @@ sctp_over_udp_start(void) } /* Call the special UDP hook. */ if ((ret = udp_set_kernel_tunneling(SCTP_BASE_INFO(udp6_tun_socket), - sctp_recv_udp_tunneled_packet))) { + sctp_recv_udp_tunneled_packet, NULL))) { sctp_over_udp_stop(); return (ret); } Modified: projects/vxlan/sys/netinet/udp_usrreq.c ============================================================================== --- projects/vxlan/sys/netinet/udp_usrreq.c Tue Jun 3 02:34:21 2014 (r266996) +++ projects/vxlan/sys/netinet/udp_usrreq.c Tue Jun 3 04:29:10 2014 (r266997) @@ -303,7 +303,8 @@ udp_append(struct inpcb *inp, struct ip */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { - (*up->u_tun_func)(n, off, inp, (struct sockaddr *) udp_in); + (*up->u_tun_func)(n, off, inp, (struct sockaddr *) udp_in, + up->u_tun_func_ctx); return; } @@ -1608,7 +1609,7 @@ udp_attach(struct socket *so, int proto, #endif /* INET */ int -udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f) +udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, void *ctx) { struct inpcb *inp; struct udpcb *up; @@ -1624,6 +1625,7 @@ udp_set_kernel_tunneling(struct socket * return (EBUSY); } up->u_tun_func = f; + up->u_tun_func_ctx = ctx; INP_WUNLOCK(inp); return (0); } Modified: projects/vxlan/sys/netinet/udp_var.h ============================================================================== --- projects/vxlan/sys/netinet/udp_var.h Tue Jun 3 02:34:21 2014 (r266996) +++ projects/vxlan/sys/netinet/udp_var.h Tue Jun 3 04:29:10 2014 (r266997) @@ -56,13 +56,14 @@ struct inpcb; struct mbuf; typedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *, - const struct sockaddr *); + const struct sockaddr *, void *); /* * UDP control block; one per udp. */ struct udpcb { udp_tun_func_t u_tun_func; /* UDP kernel tunneling callback. */ + void *u_tun_func_ctx;/* Tunneling callback context. */ u_int u_flags; /* Generic UDP flags. */ uint16_t u_rxcslen; /* Coverage for incoming datagrams. */ uint16_t u_txcslen; /* Coverage for outgoing datagrams. */ @@ -176,7 +177,8 @@ void udplite_input(struct mbuf *, int); struct inpcb *udp_notify(struct inpcb *inp, int errno); int udp_shutdown(struct socket *so); -int udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f); +int udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, + void *ctx); #endif /* _KERNEL */ Modified: projects/vxlan/sys/netinet6/udp6_usrreq.c ============================================================================== --- projects/vxlan/sys/netinet6/udp6_usrreq.c Tue Jun 3 02:34:21 2014 (r266996) +++ projects/vxlan/sys/netinet6/udp6_usrreq.c Tue Jun 3 04:29:10 2014 (r266997) @@ -148,7 +148,8 @@ udp6_append(struct inpcb *inp, struct mb */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { - (*up->u_tun_func)(n, off, inp, (struct sockaddr *)fromsa); + (*up->u_tun_func)(n, off, inp, (struct sockaddr *) fromsa, + up->u_tun_func_ctx); return; } #ifdef IPSEC
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406030429.s534TBkv027263>