Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Return EINVAL in vlan_config() when a VLAN ID is 0 o...



details:   https://anonhg.NetBSD.org/src/rev/5e2d54fd89ca
branches:  trunk
changeset: 357703:5e2d54fd89ca
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Nov 22 04:56:52 2017 +0000

description:
Return EINVAL in vlan_config() when a VLAN ID is 0 or 65535. The spec states
0 and 65535 are reserved.

diffstat:

 sys/net/if_vlan.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 44a73426a960 -r 5e2d54fd89ca sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Wed Nov 22 04:27:57 2017 +0000
+++ b/sys/net/if_vlan.c Wed Nov 22 04:56:52 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vlan.c,v 1.110 2017/11/22 03:45:15 msaitoh Exp $    */
+/*     $NetBSD: if_vlan.c,v 1.111 2017/11/22 04:56:52 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.110 2017/11/22 03:45:15 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.111 2017/11/22 04:56:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -415,6 +415,10 @@
        bool omib_cleanup = false;
        struct psref psref;
 
+       /* VLAN ID 0 and 65535 are reserved in the spec */
+       if ((vid == 0) || (vid == 0xfff))
+               return EINVAL;
+
        nmib = kmem_alloc(sizeof(*nmib), KM_SLEEP);
 
        mutex_enter(&ifv->ifv_lock);



Home | Main Index | Thread Index | Old Index