Module Name:    src
Committed By:   maxv
Date:           Sat Dec  9 10:30:30 UTC 2017

Modified Files:
        src/sys/net: if_mpls.c

Log Message:
Kick MPLS packets earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_mpls.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_mpls.c
diff -u src/sys/net/if_mpls.c:1.31 src/sys/net/if_mpls.c:1.32
--- src/sys/net/if_mpls.c:1.31	Fri Dec  8 17:49:54 2017
+++ src/sys/net/if_mpls.c	Sat Dec  9 10:30:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mpls.c,v 1.31 2017/12/08 17:49:54 maxv Exp $ */
+/*	$NetBSD: if_mpls.c,v 1.32 2017/12/09 10:30:30 maxv Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.31 2017/12/08 17:49:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.32 2017/12/09 10:30:30 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -360,6 +360,12 @@ mpls_lse(struct mbuf *m)
 	uint psize = sizeof(struct sockaddr_mpls);
 	bool push_back_alert = false;
 
+	/* If we're not accepting MPLS frames, leave now. */
+	if (!mpls_frame_accept) {
+		error = EINVAL;
+		goto done;
+	}
+
 	if (m->m_len < sizeof(union mpls_shim) &&
 	    (m = m_pullup(m, sizeof(union mpls_shim))) == NULL)
 		goto done;
@@ -368,10 +374,7 @@ mpls_lse(struct mbuf *m)
 	dst.smpls_family = AF_MPLS;
 	dst.smpls_addr.s_addr = ntohl(mtod(m, union mpls_shim *)->s_addr);
 
-	/* Check if we're accepting MPLS Frames */
 	error = EINVAL;
-	if (!mpls_frame_accept)
-		goto done;
 
 	/* TTL decrement */
 	if ((m = mpls_ttl_dec(m)) == NULL)

Reply via email to