diff options
-rw-r--r-- | sys/netinet/sctputil.c | 7 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 6 | ||||
-rw-r--r-- | sys/netinet/udp_var.h | 7 | ||||
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 3 |
4 files changed, 15 insertions, 8 deletions
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index fde23ef..1e87a17 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -6832,7 +6832,8 @@ sctp_log_trace(uint32_t subsys, const char *str SCTP_UNUSED, uint32_t a, uint32_ #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, void *ctx SCTP_UNUSED) { struct ip *iph; @@ -6968,7 +6969,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); } @@ -6992,7 +6993,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); } diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index ce449cd..3a3d60e 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -312,7 +312,8 @@ udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, */ 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, + up->u_tun_ctx); return; } @@ -1717,7 +1718,7 @@ udp_attach(struct socket *so, int proto, struct thread *td) #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; @@ -1733,6 +1734,7 @@ udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f) return (EBUSY); } up->u_tun_func = f; + up->u_tun_ctx = ctx; INP_WUNLOCK(inp); return (0); } diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h index 04b4dbb..2e0a4f8 100644 --- a/sys/netinet/udp_var.h +++ b/sys/netinet/udp_var.h @@ -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 *, void *); /* * UDP control block; one per udp. @@ -65,6 +66,7 @@ struct udpcb { u_int u_flags; /* Generic UDP flags. */ uint16_t u_rxcslen; /* Coverage for incoming datagrams. */ uint16_t u_txcslen; /* Coverage for outgoing datagrams. */ + void *u_tun_ctx; /* Tunneling callback context. */ }; #define intoudpcb(ip) ((struct udpcb *)(ip)->inp_ppcb) @@ -176,7 +178,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 */ diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 529df24..de79816 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -150,7 +150,8 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, */ 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 *)fromsa, + up->u_tun_ctx); return; } #ifdef IPSEC |