summaryrefslogtreecommitdiffstats
path: root/sys/net/if_vlan.c
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2006-08-03 09:59:08 +0000
committeryar <yar@FreeBSD.org>2006-08-03 09:59:08 +0000
commitd0aaec359fd46d2e4ee51f1079a060a0bd9f2b84 (patch)
tree46e34c4a1af559b2e070bd591fe632ef6e4eb0db /sys/net/if_vlan.c
parent3ff2ef88e741ff06a7de9813d21b5394b85e9f1b (diff)
downloadFreeBSD-src-d0aaec359fd46d2e4ee51f1079a060a0bd9f2b84.zip
FreeBSD-src-d0aaec359fd46d2e4ee51f1079a060a0bd9f2b84.tar.gz
Should vlan_input() ever be called with ifp pointing to a non-Ethernet
interface, do not just assign -1 to tag because it breaks the logic of the code to follow. The better way is to handle this case as an unsupported protocol and return unless INVARIANTS is in effect and we can panic. Panic is good there because the scenario can happen only because of a coding error elsewhere. We also should show the interface name in the panic message for easier debugging of the problem, should it ever emerge. Submitted by: qingli (initially)
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r--sys/net/if_vlan.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 34ef7ee..9883066 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -926,12 +926,13 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
evl->evl_encap_proto = evl->evl_proto;
break;
default:
- tag = (uint16_t) -1;
#ifdef INVARIANTS
- panic("%s: unsupported if_type (%u)",
- __func__, ifp->if_type);
+ panic("%s: %s has unsupported if_type %u",
+ __func__, ifp->if_xname, ifp->if_type);
#endif
- break;
+ m_freem(m);
+ ifp->if_noproto++;
+ return;
}
}
OpenPOWER on IntegriCloud