]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
EVPN: Add VNI labels
authorOndrej Zajicek <santiago@crfreenet.org>
Sat, 10 Feb 2024 17:16:15 +0000 (18:16 +0100)
committerOndrej Zajicek <santiago@crfreenet.org>
Sun, 15 Jun 2025 00:51:51 +0000 (02:51 +0200)
Add VNI labels that are necessary for VLAN-aware VXLAN tunnels.

proto/evpn/evpn.c
sysdep/linux/netlink.c

index 73d3006e59417d6f1c4b1b0e265de796951f0b7a..4f204447be0436bd55d336ff6622a0a7dbc217a7 100644 (file)
@@ -242,6 +242,9 @@ evpn_receive_mac(struct evpn_proto *p, const net_addr_evpn_mac *n0, rte *new)
     a->nh.labels = MIN(ms->u.ptr->length / 4, MPLS_MAX_LABEL_STACK);
     memcpy(a->nh.label, ms->u.ptr->data, a->nh.labels * 4);
 
+    /* Hack to handle src_vni in bridge code */
+    ea_set_attr_u32(&a->eattrs, tmp_linpool, EA_MPLS_LABEL, 0, EAF_TYPE_INT, p->vni);
+
     rte *e = rte_get_temp(a, p->p.main_source);
     rte_update2(c, n, e, p->p.main_source);
   }
@@ -284,6 +287,9 @@ evpn_receive_imet(struct evpn_proto *p, const net_addr_evpn_imet *n0, rte *new)
     a->nh.labels = 1;
     a->nh.label[0] = bgp_pmsi_get_label(pt->u.ptr);
 
+    /* Hack to handle src_vni in bridge code */
+    ea_set_attr_u32(&a->eattrs, tmp_linpool, EA_MPLS_LABEL, 0, EAF_TYPE_INT, p->vni);
+
     rte *e = rte_get_temp(a, s);
     rte_update2(c, n, e, s);
   }
index 4798944b0646ca7e0664a2c52cc5b20ef16beb2f..62e6d5a682fdb521ba1f154e2c89b46640f3e4fc 100644 (file)
@@ -2047,6 +2047,10 @@ nl_send_fdb(const net_addr *n0, rte *e, int op, int tunnel)
     if (nh->labels)
       nl_add_attr_u32(&r->h, rsize, NDA_VNI, nh->label[0]);
 
+    eattr *ea = ea_find(e->attrs->eattrs, EA_MPLS_LABEL);
+    if (ea)
+      nl_add_attr_u32(&r->h, rsize, NDA_SRC_VNI, ea->u.data);
+
     r->n.ndm_state |= NUD_PERMANENT;
   }