summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornorby <norby@openbsd.org>2008-04-30 07:39:48 +0000
committernorby <norby@openbsd.org>2008-04-30 07:39:48 +0000
commit0bdd936342c92db0e048e07c027438cd417d4881 (patch)
tree7cca7fe8f57d41187e5b2d29e87222d2d05d4deb
parentRemove duplicate psignal(3) and sys_siglist definitions. signal.h (diff)
downloadwireguard-openbsd-0bdd936342c92db0e048e07c027438cd417d4881.tar.xz
wireguard-openbsd-0bdd936342c92db0e048e07c027438cd417d4881.zip
Drop all MPLS packets when MPLS is not enabled.
Discussed with claudio@ dlg@ laurent@ Remember to enable MPLS vith sysctl(8). sysctl -w net.mpls.enable=1 ok claudio@ dlg@ laurent@
-rw-r--r--sys/netmpls/mpls.h3
-rw-r--r--sys/netmpls/mpls_input.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/netmpls/mpls.h b/sys/netmpls/mpls.h
index f23e2a85220..d721027cedb 100644
--- a/sys/netmpls/mpls.h
+++ b/sys/netmpls/mpls.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls.h,v 1.3 2008/04/23 12:28:49 norby Exp $ */
+/* $OpenBSD: mpls.h,v 1.4 2008/04/30 07:39:48 norby Exp $ */
/*
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
@@ -142,6 +142,7 @@ extern int mpls_raw_usrreq(struct socket *, int, struct mbuf *,
extern struct ifqueue mplsintrq; /* MPLS input queue */
extern int mplsqmaxlen; /* MPLS input queue length */
+extern int mpls_enable;
void mpls_init(void);
void mplsintr(void);
diff --git a/sys/netmpls/mpls_input.c b/sys/netmpls/mpls_input.c
index 9d6c7f71909..6bcd9299543 100644
--- a/sys/netmpls/mpls_input.c
+++ b/sys/netmpls/mpls_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpls_input.c,v 1.4 2008/04/24 11:36:39 dlg Exp $ */
+/* $OpenBSD: mpls_input.c,v 1.5 2008/04/30 07:39:48 norby Exp $ */
/*
* Copyright (c) 2008 Claudio Jeker <claudio@openbsd.org>
@@ -75,6 +75,11 @@ mpls_input(struct mbuf *m)
u_int32_t ttl;
int i;
+ if (!mpls_enable) {
+ m_freem(m);
+ return;
+ }
+
if (m->m_len < sizeof(*shim))
if ((m = m_pullup(m, sizeof(*shim))) == NULL)
return;