Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177957428
D34883.1795646913.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D34883.1795646913.diff
View Options
Index: sys/net/if_vxlan.c
===================================================================
--- sys/net/if_vxlan.c
+++ sys/net/if_vxlan.c
@@ -363,7 +363,7 @@
const union vxlan_sockaddr *, struct mbuf *);
static int vxlan_transmit(struct ifnet *, struct mbuf *);
static void vxlan_qflush(struct ifnet *);
-static void vxlan_rcv_udp_packet(struct mbuf *, int, struct inpcb *,
+static bool vxlan_rcv_udp_packet(struct mbuf *, int, struct inpcb *,
const struct sockaddr *, void *);
static int vxlan_input(struct vxlan_socket *, uint32_t, struct mbuf **,
const struct sockaddr *);
@@ -2758,7 +2758,7 @@
{
}
-static void
+static bool
vxlan_rcv_udp_packet(struct mbuf *m, int offset, struct inpcb *inpcb,
const struct sockaddr *srcsa, void *xvso)
{
@@ -2802,6 +2802,8 @@
out:
if (m != NULL)
m_freem(m);
+
+ return (true);
}
static int
Index: sys/netinet/ip_gre.c
===================================================================
--- sys/netinet/ip_gre.c
+++ sys/netinet/ip_gre.c
@@ -219,7 +219,7 @@
}
}
-static void
+static bool
in_gre_udp_input(struct mbuf *m, int off, struct inpcb *inp,
const struct sockaddr *sa, void *ctx)
{
@@ -237,9 +237,11 @@
}
if (sc != NULL && (GRE2IFP(sc)->if_flags & IFF_UP) != 0){
gre_input(m, off + sizeof(struct udphdr), IPPROTO_UDP, sc);
- return;
+ return (true);
}
m_freem(m);
+
+ return (true);
}
static int
Index: sys/netinet/sctputil.c
===================================================================
--- sys/netinet/sctputil.c
+++ sys/netinet/sctputil.c
@@ -7094,7 +7094,7 @@
}
#endif
-static void
+static bool
sctp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
const struct sockaddr *sa SCTP_UNUSED, void *ctx SCTP_UNUSED)
{
@@ -7172,9 +7172,11 @@
goto out;
break;
}
- return;
+ return (true);
out:
m_freem(m);
+
+ return (true);
}
#ifdef INET
Index: sys/netinet/tcp_subr.c
===================================================================
--- sys/netinet/tcp_subr.c
+++ sys/netinet/tcp_subr.c
@@ -590,7 +590,7 @@
}
}
-static void
+static bool
tcp_recv_udp_tunneled_packet(struct mbuf *m, int off, struct inpcb *inp,
const struct sockaddr *sa, void *ctx)
{
@@ -659,9 +659,11 @@
goto out;
break;
}
- return;
+ return (true);
out:
m_freem(m);
+
+ return (true);
}
static int
Index: sys/netinet/udp_usrreq.c
===================================================================
--- sys/netinet/udp_usrreq.c
+++ sys/netinet/udp_usrreq.c
@@ -278,6 +278,7 @@
struct sockaddr_in6 udp_in6;
#endif
struct udpcb *up;
+ bool filtered;
INP_LOCK_ASSERT(inp);
@@ -288,10 +289,11 @@
if (up->u_tun_func != NULL) {
in_pcbref(inp);
INP_RUNLOCK(inp);
- (*up->u_tun_func)(n, off, inp, (struct sockaddr *)&udp_in[0],
+ filtered = (*up->u_tun_func)(n, off, inp, (struct sockaddr *)&udp_in[0],
up->u_tun_ctx);
INP_RLOCK(inp);
- return (in_pcbrele_rlocked(inp));
+ if (filtered)
+ return (in_pcbrele_rlocked(inp));
}
off += sizeof(struct udphdr);
Index: sys/netinet/udp_var.h
===================================================================
--- sys/netinet/udp_var.h
+++ sys/netinet/udp_var.h
@@ -36,6 +36,7 @@
#ifndef _NETINET_UDP_VAR_H_
#define _NETINET_UDP_VAR_H_
+#include <sys/types.h>
#include <netinet/ip_var.h>
#include <netinet/udp.h>
@@ -60,7 +61,8 @@
struct inpcb;
struct mbuf;
-typedef void(*udp_tun_func_t)(struct mbuf *, int, struct inpcb *,
+#ifdef _KERNEL
+typedef bool(*udp_tun_func_t)(struct mbuf *, int, struct inpcb *,
const struct sockaddr *, void *);
typedef void(*udp_tun_icmp_t)(int, struct sockaddr *, void *, void *);
@@ -78,6 +80,7 @@
#define intoudpcb(ip) ((struct udpcb *)(ip)->inp_ppcb)
#define sotoudpcb(so) (intoudpcb(sotoinpcb(so)))
+#endif
/* IPsec: ESP in UDP tunneling: */
#define UF_ESPINUDP_NON_IKE 0x00000001 /* w/ non-IKE marker .. */
Index: sys/netinet6/ip6_gre.c
===================================================================
--- sys/netinet6/ip6_gre.c
+++ sys/netinet6/ip6_gre.c
@@ -212,7 +212,7 @@
}
}
-static void
+static bool
in6_gre_udp_input(struct mbuf *m, int off, struct inpcb *inp,
const struct sockaddr *sa, void *ctx)
{
@@ -226,7 +226,7 @@
dst = *(const struct sockaddr_in6 *)sa;
if (sa6_embedscope(&dst, 0)) {
m_freem(m);
- return;
+ return (true);
}
CK_LIST_FOREACH(sc, &gs->list, chain) {
if (IN6_ARE_ADDR_EQUAL(&sc->gre_oip6.ip6_dst, &dst.sin6_addr))
@@ -234,9 +234,11 @@
}
if (sc != NULL && (GRE2IFP(sc)->if_flags & IFF_UP) != 0){
gre_input(m, off + sizeof(struct udphdr), IPPROTO_UDP, sc);
- return;
+ return (true);
}
m_freem(m);
+
+ return (true);
}
static int
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 25, 10:48 PM (20 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42000946
Default Alt Text
D34883.1795646913.diff (4 KB)
Attached To
Mode
D34883: udp: allow udp_tun_func_t() to indicate it did not eat the packet
Attached
Detach File
Event Timeline