summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorXiao Liang <shaw.leon@gmail.com>2022-02-22 17:22:45 +0800
committerXiao Liang <shaw.leon@gmail.com>2022-06-10 17:12:48 +0800
commit5609e70fb87a3b23b55629a33e5afb298974c142 (patch)
tree38ec901a91ed7504a7be9154d804dce195888e34 /lib
parentdb6d4c8375f32c11336f9542b558640c5c5915f2 (diff)
lib, zebra, bgpd: Move route EVPN flag to nexthop
Multipath route may have mixed nexthops of EVPN and IP unicast. Move EVPN flag to nexthop to support such cases. Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/nexthop.h1
-rw-r--r--lib/zclient.c7
-rw-r--r--lib/zclient.h1
3 files changed, 7 insertions, 2 deletions
diff --git a/lib/nexthop.h b/lib/nexthop.h
index 320b46315e..a407d3ca63 100644
--- a/lib/nexthop.h
+++ b/lib/nexthop.h
@@ -94,6 +94,7 @@ struct nexthop {
#define NEXTHOP_FLAG_RNH_FILTERED (1 << 5) /* rmap filtered, used by rnh */
#define NEXTHOP_FLAG_HAS_BACKUP (1 << 6) /* Backup nexthop index is set */
#define NEXTHOP_FLAG_SRTE (1 << 7) /* SR-TE color used for BGP traffic */
+#define NEXTHOP_FLAG_EVPN (1 << 8) /* nexthop is EVPN */
#define NEXTHOP_IS_ACTIVE(flags) \
(CHECK_FLAG(flags, NEXTHOP_FLAG_ACTIVE) \
diff --git a/lib/zclient.c b/lib/zclient.c
index a933b6bb2b..e556b768ac 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1038,7 +1038,7 @@ int zapi_nexthop_encode(struct stream *s, const struct zapi_nexthop *api_nh,
stream_putl(s, api_nh->weight);
/* Router MAC for EVPN routes. */
- if (CHECK_FLAG(api_flags, ZEBRA_FLAG_EVPN_ROUTE))
+ if (CHECK_FLAG(nh_flags, ZAPI_NEXTHOP_FLAG_EVPN))
stream_put(s, &(api_nh->rmac),
sizeof(struct ethaddr));
@@ -1402,7 +1402,7 @@ int zapi_nexthop_decode(struct stream *s, struct zapi_nexthop *api_nh,
STREAM_GETL(s, api_nh->weight);
/* Router MAC for EVPN routes. */
- if (CHECK_FLAG(api_flags, ZEBRA_FLAG_EVPN_ROUTE))
+ if (CHECK_FLAG(api_nh->flags, ZAPI_NEXTHOP_FLAG_EVPN))
STREAM_GET(&(api_nh->rmac), s,
sizeof(struct ethaddr));
@@ -1830,6 +1830,9 @@ int zapi_nexthop_from_nexthop(struct zapi_nexthop *znh,
if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_ONLINK))
SET_FLAG(znh->flags, ZAPI_NEXTHOP_FLAG_ONLINK);
+ if (CHECK_FLAG(nh->flags, NEXTHOP_FLAG_EVPN))
+ SET_FLAG(znh->flags, ZAPI_NEXTHOP_FLAG_EVPN);
+
if (nh->nh_label && (nh->nh_label->num_labels > 0)) {
/* Validate */
diff --git a/lib/zclient.h b/lib/zclient.h
index 9756923a69..c3ea2a16ff 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -452,6 +452,7 @@ struct zapi_nexthop {
#define ZAPI_NEXTHOP_FLAG_HAS_BACKUP 0x08 /* Nexthop has a backup */
#define ZAPI_NEXTHOP_FLAG_SEG6 0x10
#define ZAPI_NEXTHOP_FLAG_SEG6LOCAL 0x20
+#define ZAPI_NEXTHOP_FLAG_EVPN 0x40
/*
* ZAPI Nexthop Group. For use with protocol creation of nexthop groups.