summaryrefslogtreecommitdiffstats
path: root/sys/net/switchofp.c
diff options
context:
space:
mode:
authorrzalamena <rzalamena@openbsd.org>2017-01-17 12:34:21 +0000
committerrzalamena <rzalamena@openbsd.org>2017-01-17 12:34:21 +0000
commit881236eea14bfe198764b3e81f7b0cebcbf607dc (patch)
treed4cc97ac3e306b95603ae4e2381236745f865a0c /sys/net/switchofp.c
parentClean-up switch(4) device by removing excess prototypes, verbose debugs (diff)
downloadwireguard-openbsd-881236eea14bfe198764b3e81f7b0cebcbf607dc.tar.xz
wireguard-openbsd-881236eea14bfe198764b3e81f7b0cebcbf607dc.zip
Fix a panic when set-field with VLAN is set, but no VLANs were
classified in the packet.
Diffstat (limited to 'sys/net/switchofp.c')
-rw-r--r--sys/net/switchofp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/net/switchofp.c b/sys/net/switchofp.c
index 4561ff87840..33ca18310f1 100644
--- a/sys/net/switchofp.c
+++ b/sys/net/switchofp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchofp.c,v 1.55 2017/01/17 12:30:35 rzalamena Exp $ */
+/* $OpenBSD: switchofp.c,v 1.56 2017/01/17 12:34:21 rzalamena Exp $ */
/*
* Copyright (c) 2016 Kazuya GODA <goda@openbsd.org>
@@ -4074,8 +4074,11 @@ swofp_apply_set_field_ether(struct mbuf *m, int off,
default:
break;
}
- memcpy(swfcl->swfcl_vlan, pre_swfcl->swfcl_vlan,
- sizeof(*swfcl->swfcl_vlan));
+
+ /* Update the classifier if it exists. */
+ if (swfcl->swfcl_vlan)
+ memcpy(swfcl->swfcl_vlan, pre_swfcl->swfcl_vlan,
+ sizeof(*swfcl->swfcl_vlan));
}
if (pre_swfcl->swfcl_ether) {