aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_vlan.c
diff options
context:
space:
mode:
authorYaroslav Tykhiy <ytykhiy@gmail.com>2006-08-03 09:59:08 +0000
committerYaroslav Tykhiy <ytykhiy@gmail.com>2006-08-03 09:59:08 +0000
commit60c60618829d149bd7eb02de3871a0a2c487c432 (patch)
tree46e34c4a1af559b2e070bd591fe632ef6e4eb0db /sys/net/if_vlan.c
parentdb8b5973e7482e032a7ce10a11855abd0e3134b5 (diff)
downloadsrc-60c60618829d149bd7eb02de3871a0a2c487c432.tar.gz
src-60c60618829d149bd7eb02de3871a0a2c487c432.zip
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)
Notes
Notes: svn path=/head/; revision=160951
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 34ef7eef4078..98830669d200 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;
}
}