summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn.c6
-rw-r--r--bgpd/bgp_evpn.h3
-rw-r--r--bgpd/bgp_evpn_vty.c4
-rw-r--r--bgpd/bgp_zebra.c10
-rw-r--r--bgpd/bgpd.h3
-rw-r--r--zebra/zebra_vxlan.c25
-rw-r--r--zebra/zebra_vxlan_private.h3
7 files changed, 44 insertions, 10 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 0558c04dde..e5d7d369c2 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -3709,7 +3709,8 @@ static void link_l2vni_hash_to_l3vni(struct hash_backet *backet,
int bgp_evpn_local_l3vni_add(vni_t l3vni,
vrf_id_t vrf_id,
- struct ethaddr *rmac)
+ struct ethaddr *rmac,
+ struct in_addr originator_ip)
{
struct bgp *bgp_vrf = NULL; /* bgp VRF instance */
struct bgp *bgp_def = NULL; /* default bgp instance */
@@ -3757,6 +3758,9 @@ int bgp_evpn_local_l3vni_add(vni_t l3vni,
/* set the router mac - to be used in mac-ip routes for this vrf */
memcpy(&bgp_vrf->rmac, rmac, sizeof(struct ethaddr));
+ /* set the originator ip */
+ bgp_vrf->originator_ip = originator_ip;
+
/* auto derive RD/RT */
if (!CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_IMPORT_RT_CFGD))
evpn_auto_rt_import_add_for_vrf(bgp_vrf);
diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h
index 14de479007..e43fab9a7e 100644
--- a/bgpd/bgp_evpn.h
+++ b/bgpd/bgp_evpn.h
@@ -46,7 +46,8 @@ extern int bgp_evpn_local_macip_del(struct bgp *bgp, vni_t vni,
extern int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni,
struct ethaddr *mac, struct ipaddr *ip,
u_char flags);
-extern int bgp_evpn_local_l3vni_add(vni_t, vrf_id_t, struct ethaddr *);
+extern int bgp_evpn_local_l3vni_add(vni_t, vrf_id_t, struct ethaddr *,
+ struct in_addr originator_ip);
extern int bgp_evpn_local_l3vni_del(vni_t, vrf_id_t);
extern int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni);
extern int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni,
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index c22e6770e4..cb3c5eeb4d 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -3484,6 +3484,8 @@ DEFUN (show_bgp_vrf_l3vni_info,
if (!json) {
vty_out(vty, "BGP VRF: %s\n", name);
+ vty_out(vty, " Local-Ip: %s\n",
+ inet_ntoa(bgp->originator_ip));
vty_out(vty, " L3-VNI: %u\n", bgp->l3vni);
vty_out(vty, " Rmac: %s\n",
prefix_mac2str(&bgp->rmac, buf, sizeof(buf)));
@@ -3506,6 +3508,8 @@ DEFUN (show_bgp_vrf_l3vni_info,
prefix_rd2str(&bgp->vrf_prd, buf1, RD_ADDRSTRLEN));
} else {
json_object_string_add(json, "vrf", name);
+ json_object_string_add(json, "local-ip",
+ inet_ntoa(bgp->originator_ip));
json_object_int_add(json, "l3vni", bgp->l3vni);
json_object_string_add(json, "rmac",
prefix_mac2str(&bgp->rmac, buf,
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 964603d3d9..3a8631f2f9 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1702,15 +1702,19 @@ static int bgp_zebra_process_local_l3vni(int cmd, struct zclient *zclient,
zebra_size_t length, vrf_id_t vrf_id)
{
char buf[ETHER_ADDR_STRLEN];
- vni_t l3vni;
+ vni_t l3vni = 0;
struct ethaddr rmac;
+ struct in_addr originator_ip;
struct stream *s;
memset(&rmac, 0, sizeof(struct ethaddr));
+ memset(&originator_ip, 0, sizeof(struct in_addr));
s = zclient->ibuf;
l3vni = stream_getl(s);
- if (cmd == ZEBRA_L3VNI_ADD)
+ if (cmd == ZEBRA_L3VNI_ADD) {
stream_get(&rmac, s, sizeof(struct ethaddr));
+ originator_ip.s_addr = stream_get_ipv4(s);
+ }
if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Rx L3-VNI %s VRF %s VNI %u RMAC %s",
@@ -1720,7 +1724,7 @@ static int bgp_zebra_process_local_l3vni(int cmd, struct zclient *zclient,
prefix_mac2str(&rmac, buf, sizeof(buf)));
if (cmd == ZEBRA_L3VNI_ADD)
- bgp_evpn_local_l3vni_add(l3vni, vrf_id, &rmac);
+ bgp_evpn_local_l3vni_add(l3vni, vrf_id, &rmac, originator_ip);
else
bgp_evpn_local_l3vni_del(l3vni, vrf_id);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 8087d3514a..449326ece5 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -418,6 +418,9 @@ struct bgp {
/* router-mac to be used in mac-ip routes for this vrf */
struct ethaddr rmac;
+ /* originator ip - to be used as NH for type-5 routes */
+ struct in_addr originator_ip;
+
/* vrf flags */
uint32_t vrf_flags;
#define BGP_VRF_AUTO (1 << 0)
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index f928554269..767fc03081 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -906,6 +906,8 @@ static void zl3vni_print(zebra_l3vni_t *zl3vni, void **ctx)
if (!json) {
vty_out(vty, "VNI: %u\n", zl3vni->vni);
+ vty_out(vty, " Local Vtep Ip: %s",
+ inet_ntoa(zl3vni->local_vtep_ip));
vty_out(vty, " Vxlan-Intf: %s\n",
zl3vni_vxlan_if_name(zl3vni));
vty_out(vty, " SVI-If: %s\n",
@@ -923,6 +925,8 @@ static void zl3vni_print(zebra_l3vni_t *zl3vni, void **ctx)
} else {
json_vni_list = json_object_new_array();
json_object_int_add(json, "vni", zl3vni->vni);
+ json_object_string_add(json, "local-vtep-ip",
+ inet_ntoa(zl3vni->local_vtep_ip));
json_object_string_add(json, "vxlan-intf",
zl3vni_vxlan_if_name(zl3vni));
json_object_string_add(json, "svi-if",
@@ -1043,8 +1047,9 @@ static void zl3vni_print_hash(struct hash_backet *backet,
return;
if (!json) {
- vty_out(vty, "%-10u %-20s %-20s %-5s %-37s %-18s\n",
+ vty_out(vty, "%-10u %-15s %-20s %-20s %-5s %-37s %-18s\n",
zl3vni->vni,
+ inet_ntoa(zl3vni->local_vtep_ip),
zl3vni_vxlan_if_name(zl3vni),
zl3vni_svi_if_name(zl3vni),
zl3vni_state2str(zl3vni),
@@ -1056,6 +1061,8 @@ static void zl3vni_print_hash(struct hash_backet *backet,
snprintf(vni_str, VNI_STR_LEN, "%u", zl3vni->vni);
json_vni = json_object_new_object();
json_object_int_add(json_vni, "vni", zl3vni->vni);
+ json_object_string_add(json_vni, "local-ip",
+ inet_ntoa(zl3vni->local_vtep_ip));
json_object_string_add(json_vni, "vxlan-if",
zl3vni_vxlan_if_name(zl3vni));
json_object_string_add(json_vni, "svi-if",
@@ -2615,6 +2622,7 @@ static void zvni_build_hash_table()
}
/* associate with vxlan_if */
+ zl3vni->local_vtep_ip = vxl->vtep_ip;
zl3vni->vxlan_if = ifp;
/* we need to associate with SVI.
@@ -3393,8 +3401,10 @@ static struct interface *zl3vni_map_to_vxlan_if(zebra_l3vni_t *zl3vni)
continue;
vxl = &zif->l2info.vxl;
- if (vxl->vni == zl3vni->vni)
+ if (vxl->vni == zl3vni->vni) {
+ zl3vni->local_vtep_ip = vxl->vtep_ip;
return ifp;
+ }
}
return NULL;
@@ -3526,14 +3536,16 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni)
zl3vni_vrf_id(zl3vni));
stream_putl(s, zl3vni->vni);
stream_put(s, &rmac, sizeof(struct ethaddr));
+ stream_put_in_addr(s, &zl3vni->local_vtep_ip);
/* Write packet size. */
stream_putw_at(s, 0, stream_get_endp(s));
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("Send L3_VNI_ADD %u VRF %s RMAC %s to %s",
+ zlog_debug("Send L3_VNI_ADD %u VRF %s RMAC %s local-ip %s to %s",
zl3vni->vni, vrf_id_to_name(zl3vni_vrf_id(zl3vni)),
prefix_mac2str(&rmac, buf, sizeof(buf)),
+ inet_ntoa(zl3vni->local_vtep_ip),
zebra_route_string(client->proto));
client->l3vniadd_cnt++;
@@ -4052,8 +4064,9 @@ void zebra_vxlan_print_l3vnis(struct vty *vty, u_char use_json)
json_object_int_add(json, "numVnis", num_vnis);
} else {
vty_out(vty, "Number of L3 VNIs: %u\n", num_vnis);
- vty_out(vty, "%-10s %-20s %-20s %-5s %-37s %-18s\n", "VNI",
- "Vx-intf", "L3-SVI", "State", "VRF", "Rmac");
+ vty_out(vty, "%-10s %-15s %-20s %-20s %-5s %-37s %-18s\n",
+ "VNI", "Local-ip", "Vx-intf", "L3-SVI", "State",
+ "VRF", "Rmac");
}
args[0] = vty;
@@ -5965,6 +5978,7 @@ int zebra_vxlan_if_del(struct interface *ifp)
zebra_vxlan_process_l3vni_oper_down(zl3vni);
/* remove the association with vxlan_if */
+ memset(&zl3vni->local_vtep_ip, 0, sizeof(struct in_addr));
zl3vni->vxlan_if = NULL;
} else {
@@ -6201,6 +6215,7 @@ int zebra_vxlan_if_add(struct interface *ifp)
}
/* associate with vxlan_if */
+ zl3vni->local_vtep_ip = vxl->vtep_ip;
zl3vni->vxlan_if = ifp;
/* Associate with SVI, if any. We can associate with svi-if only
diff --git a/zebra/zebra_vxlan_private.h b/zebra/zebra_vxlan_private.h
index bde70ba25a..8aeb46c945 100644
--- a/zebra/zebra_vxlan_private.h
+++ b/zebra/zebra_vxlan_private.h
@@ -97,6 +97,9 @@ struct zebra_l3vni_t_ {
/* vrf_id */
vrf_id_t vrf_id;
+ /* Local IP */
+ struct in_addr local_vtep_ip;
+
/* kernel interface for l3vni */
struct interface *vxlan_if;