summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2003-07-06 03:24:25 +0000
committerwpaul <wpaul@FreeBSD.org>2003-07-06 03:24:25 +0000
commit0721598de290cba8b6600384f5349b552d4c7f4c (patch)
treebd343ec552f09ad8a4a812566a0744b3e37eff03 /sys/net
parentd8255b79a730f09b7042de514cea037221a16512 (diff)
downloadFreeBSD-src-0721598de290cba8b6600384f5349b552d4c7f4c.zip
FreeBSD-src-0721598de290cba8b6600384f5349b552d4c7f4c.tar.gz
Testing VLANs with the new 8139C+ chip (which does hardware tag
insertion and extraction) has revealed two bugs: - In vlan_start(), we're supposed to check the underlying interface to see if it has the IFCAP_VLAN_HWTAGGING cabability set and, if so, set things up for the VLAN_OUTPUT_TAG() routine. However the code checks ifp->if_capabilities, which is the vlan pseudo-interface's capabilities when it should be checking p->if_capabilities, which relates to the underlying physical interface. Change ifp->if_capabilities to p->if_capabilities so this works. - In vlan_input(), we have to extract the 16-bit tag value from the received frame and use it to figure out which vlan interface gets the frame. The code that we use to track down the desired vlan pseudo-interface is: for (ifv = LIST_FIRST(&ifv_list); ifv != NULL; ifv = LIST_NEXT(ifv, ifv_list)) if (ifp == ifv->ifv_p && tag == ifv->ifv_tag) break; The problem is that 'tag' is not computed consistently. In the case where the interface supports hardware VLAN tag extraction and calls VLAN_INPUT_TAG(), we do this: tag = *(u_int*)(mtag+1); But in the software emulation case, we do this tag = EVL_VLANOFTAG(ntohs(evl->evl_tag)); The problem here is the EVL_VLANOFTAG() macro is only ever applied in this one case. It's never applied to ifv->ifv_tag or anwhere else. We must be consistent: either it's applied everywhere or nowhere. To see how this can be a problem, do something like ifconfig vlan0 vlan 12345 vlandev foo0 and observe the results. I'm not quite sure what the right thing is to do here. Neither the vlan(4) nor ifconfig(8) man pages suggest which way to go. For now, I've removed this use of EVL_VLANOFTAG() so that the tag will match correctly in all cases. I will not get upset if somebody makes a compelling argument for using EVL_VLANOFTAG() everywhere instead, as long as the use is consistent.
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if_vlan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 5fe0a0a..99b1dcf 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -319,7 +319,7 @@ vlan_start(struct ifnet *ifp)
* knows how to find the VLAN tag to use, so we attach a
* packet tag that holds it.
*/
- if (ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) {
+ if (p->if_capabilities & IFCAP_VLAN_HWTAGGING) {
struct m_tag *mtag = m_tag_alloc(MTAG_VLAN,
MTAG_VLAN_TAG,
sizeof (u_int),
@@ -409,7 +409,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
("vlan_input: bad encapsulated protocols (%u)",
ntohs(evl->evl_encap_proto)));
- tag = EVL_VLANOFTAG(ntohs(evl->evl_tag));
+ tag = ntohs(evl->evl_tag);
/*
* Restore the original ethertype. We'll remove
OpenPOWER on IntegriCloud