summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpoorthi K <spk@redhat.com>2023-01-23 09:04:04 +0530
committerSpoorthi K <spk@redhat.com>2023-01-24 09:48:21 +0530
commit4a563f2714e90a4426dd7922ee0f42404cc7c3cd (patch)
treef85ad21272744cd542fedf02cce7b1bebaa92f76
parentde2e2d5ef09477ff03c17c18eeb1b2cb8da80f84 (diff)
zebra_fpm: Add support for other protocols in fpm:netlink
fpm:netlink format doesn't indicate the protocol information in routes of BGP, OSPF and other protocols. Routes of those protocols just indicate protocol as zebra. The below route is actually BGP route but 'proto': 11 indicates that it is zebra. {'attrs': [('RTA_DST', 'dummy'), ('RTA_PRIORITY', 0), ('RTA_GATEWAY', 'dummy'), ('RTA_OIF', 2)], 'dst_len': 32, 'family': 2, 'flags': 0, 'header': {'flags': 1025, 'length': 60, 'pid': 3160253895, 'sequence_number': 0, 'type': 24}, 'proto': 11, 'scope': 0, 'src_len': 0, 'table': 254, 'tos': 0, 'type': 1} with this change it is now seen with 'proto': 186 indicates that it is BGP. {'attrs': [('RTA_DST', 'dummy'), ('RTA_PRIORITY', 0), ('RTA_GATEWAY', 'dummy'), ('RTA_OIF', 2)], 'dst_len': 32, 'family': 2, 'flags': 0, 'header': {'flags': 1025, 'length': 60, 'pid': 3160253895, 'sequence_number': 0, 'type': 24}, 'proto': 186, 'scope': 0, 'src_len': 0, 'table': 254, 'tos': 0, 'type': 1} Signed-off-by: Spoorthi K <spk@redhat.com>
-rw-r--r--zebra/rt_netlink.c2
-rw-r--r--zebra/rt_netlink.h3
-rw-r--r--zebra/zebra_fpm_netlink.c9
3 files changed, 5 insertions, 9 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 1a090c78e3..79d79d74be 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -223,7 +223,7 @@ static inline bool is_selfroute(int proto)
return false;
}
-static inline int zebra2proto(int proto)
+int zebra2proto(int proto)
{
switch (proto) {
case ZEBRA_ROUTE_BABEL:
diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h
index 351f98a2ca..8506367ae4 100644
--- a/zebra/rt_netlink.h
+++ b/zebra/rt_netlink.h
@@ -150,6 +150,9 @@ const char *ifa_flags2str(uint32_t flags, char *buf, size_t buflen);
const char *nh_flags2str(uint32_t flags, char *buf, size_t buflen);
void nl_dump(void *msg, size_t msglen);
+
+extern int zebra2proto(int proto);
+
#endif /* NETLINK_DEBUG */
#ifdef __cplusplus
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c
index 628d4a2a87..06c45578a6 100644
--- a/zebra/zebra_fpm_netlink.c
+++ b/zebra/zebra_fpm_netlink.c
@@ -253,14 +253,7 @@ static int netlink_route_info_add_nh(struct netlink_route_info *ri,
*/
static uint8_t netlink_proto_from_route_type(int type)
{
- switch (type) {
- case ZEBRA_ROUTE_KERNEL:
- case ZEBRA_ROUTE_CONNECT:
- return RTPROT_KERNEL;
-
- default:
- return RTPROT_ZEBRA;
- }
+ return zebra2proto(type);
}
/*