Commit 6d8381c7 authored by Yonghong Song's avatar Yonghong Song

update ifindex/vlan info unconditionally in the map in vlan_learning example

Signed-off-by: default avatarYonghong Song <yhs@plumgrid.com>
parent 540d45a0
......@@ -33,14 +33,10 @@ int handle_phys2virt(struct __sk_buff *skb) {
int out_ifindex = leaf->out_ifindex;
struct ifindex_leaf_t zleaf = {0};
struct ifindex_leaf_t *out_leaf = egress.lookup_or_init(&out_ifindex, &zleaf);
// relearn when mac moves ifindex
if (out_leaf->out_ifindex != skb->ifindex)
out_leaf->out_ifindex = skb->ifindex;
// relearn when vlan_tci/vlan_proto changes
if (out_leaf->vlan_tci != skb->vlan_tci)
out_leaf->vlan_tci = skb->vlan_tci;
if (out_leaf->vlan_proto != skb->vlan_proto)
out_leaf->vlan_proto = skb->vlan_proto;
// to capture potential configuration changes
out_leaf->out_ifindex = skb->ifindex;
out_leaf->vlan_tci = skb->vlan_tci;
out_leaf->vlan_proto = skb->vlan_proto;
// pop the vlan header and send to the destination
bpf_skb_vlan_pop(skb);
bpf_clone_redirect(skb, leaf->out_ifindex, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment