Make it a tad easier to base other encapsulation schemes on this driver
by restoring the ifv_proto field in the vlan softc and putting it to use this time. It's a good companion for ifv_encaplen, which has already been used throughout this driver.
This commit is contained in:
parent
589201fd4e
commit
73f2233d9d
@ -108,11 +108,13 @@ struct ifvlan {
|
|||||||
int ifvm_encaplen; /* encapsulation length */
|
int ifvm_encaplen; /* encapsulation length */
|
||||||
int ifvm_mtufudge; /* MTU fudged by this much */
|
int ifvm_mtufudge; /* MTU fudged by this much */
|
||||||
int ifvm_mintu; /* min transmission unit */
|
int ifvm_mintu; /* min transmission unit */
|
||||||
|
uint16_t ifvm_proto; /* encapsulation ethertype */
|
||||||
uint16_t ifvm_tag; /* tag to apply on packets leaving if */
|
uint16_t ifvm_tag; /* tag to apply on packets leaving if */
|
||||||
} ifv_mib;
|
} ifv_mib;
|
||||||
SLIST_HEAD(, vlan_mc_entry) vlan_mc_listhead;
|
SLIST_HEAD(, vlan_mc_entry) vlan_mc_listhead;
|
||||||
LIST_ENTRY(ifvlan) ifv_list;
|
LIST_ENTRY(ifvlan) ifv_list;
|
||||||
};
|
};
|
||||||
|
#define ifv_proto ifv_mib.ifvm_proto
|
||||||
#define ifv_tag ifv_mib.ifvm_tag
|
#define ifv_tag ifv_mib.ifvm_tag
|
||||||
#define ifv_encaplen ifv_mib.ifvm_encaplen
|
#define ifv_encaplen ifv_mib.ifvm_encaplen
|
||||||
#define ifv_mtufudge ifv_mib.ifvm_mtufudge
|
#define ifv_mtufudge ifv_mib.ifvm_mtufudge
|
||||||
@ -888,7 +890,7 @@ vlan_start(struct ifnet *ifp)
|
|||||||
mtod(m, char *), ETHER_HDR_LEN);
|
mtod(m, char *), ETHER_HDR_LEN);
|
||||||
evl = mtod(m, struct ether_vlan_header *);
|
evl = mtod(m, struct ether_vlan_header *);
|
||||||
evl->evl_proto = evl->evl_encap_proto;
|
evl->evl_proto = evl->evl_encap_proto;
|
||||||
evl->evl_encap_proto = htons(ETHERTYPE_VLAN);
|
evl->evl_encap_proto = htons(ifv->ifv_proto);
|
||||||
evl->evl_tag = htons(ifv->ifv_tag);
|
evl->evl_tag = htons(ifv->ifv_tag);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("%s: %*D\n", __func__, (int)sizeof(*evl),
|
printf("%s: %*D\n", __func__, (int)sizeof(*evl),
|
||||||
@ -944,10 +946,6 @@ vlan_input(struct ifnet *ifp, struct mbuf *m)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
evl = mtod(m, struct ether_vlan_header *);
|
evl = mtod(m, struct ether_vlan_header *);
|
||||||
KASSERT(ntohs(evl->evl_encap_proto) == ETHERTYPE_VLAN,
|
|
||||||
("%s: bad encapsulation protocol (%u)",
|
|
||||||
__func__, ntohs(evl->evl_encap_proto)));
|
|
||||||
|
|
||||||
tag = EVL_VLANOFTAG(ntohs(evl->evl_tag));
|
tag = EVL_VLANOFTAG(ntohs(evl->evl_tag));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1058,6 +1056,7 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag)
|
|||||||
if (error)
|
if (error)
|
||||||
goto done;
|
goto done;
|
||||||
#endif
|
#endif
|
||||||
|
ifv->ifv_proto = ETHERTYPE_VLAN;
|
||||||
ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN;
|
ifv->ifv_encaplen = ETHER_VLAN_ENCAP_LEN;
|
||||||
ifv->ifv_mintu = ETHERMIN;
|
ifv->ifv_mintu = ETHERMIN;
|
||||||
ifv->ifv_pflags = 0;
|
ifv->ifv_pflags = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user