summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorrrs <rrs@FreeBSD.org>2016-04-28 15:53:10 +0000
committerrrs <rrs@FreeBSD.org>2016-04-28 15:53:10 +0000
commit64e463c093d95eb52edc8c49b8e9e00db6e4840b (patch)
tree3a6517c36d65bb8d50cdb69df4ceeff85cc6d0ab /sys/netinet6
parent24450dfc979ddb1ae32739738ad4437e896b9078 (diff)
downloadFreeBSD-src-64e463c093d95eb52edc8c49b8e9e00db6e4840b.zip
FreeBSD-src-64e463c093d95eb52edc8c49b8e9e00db6e4840b.tar.gz
Complete the UDP tunneling of ICMP msgs to those protocols
interested in having tunneled UDP and finding out about the ICMP (tested by Michael Tuexen with SCTP.. soon to be using this feature). Differential Revision: http://reviews.freebsd.org/D5875
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/udp6_usrreq.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index 03479fd..f6f4d58 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -553,6 +553,29 @@ udp6_common_ctlinput(int cmd, struct sockaddr *sa, void *d,
bzero(&uh, sizeof(uh));
m_copydata(m, off, sizeof(*uhp), (caddr_t)&uh);
+ if (!PRC_IS_REDIRECT(cmd)) {
+ /* Check to see if its tunneled */
+ struct inpcb *inp;
+ inp = in6_pcblookup_mbuf(pcbinfo, &ip6->ip6_src,
+ uh.uh_sport, &ip6->ip6_dst, uh.uh_dport,
+ INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB,
+ m->m_pkthdr.rcvif, m);
+ if (inp != NULL) {
+ struct udpcb *up;
+
+ up = intoudpcb(inp);
+ if (up->u_icmp_func) {
+ /* Yes it is. */
+ INP_RUNLOCK(inp);
+ (*up->u_icmp_func)(cmd, (struct sockaddr *)ip6cp->ip6c_src,
+ d, up->u_tun_ctx);
+ return;
+ } else {
+ /* Can't find it. */
+ INP_RUNLOCK(inp);
+ }
+ }
+ }
(void)in6_pcbnotify(pcbinfo, sa, uh.uh_dport,
(struct sockaddr *)ip6cp->ip6c_src, uh.uh_sport, cmd,
cmdarg, notify);
OpenPOWER on IntegriCloud