diff options
author | Duncan Eastoe <duncan.eastoe@att.com> | 2021-01-15 17:06:17 +0100 |
---|---|---|
committer | Duncan Eastoe <duncan.eastoe@att.com> | 2021-01-15 17:28:06 +0100 |
commit | 869a5f71684a9735074557c4fac1c0c566e107d3 (patch) | |
tree | f620c3e59393956cf27aab95d9bba2f6f13ef997 /zebra/zebra_fpm_netlink.c | |
parent | Merge pull request #7844 from vishaldhingra/static (diff) | |
download | frr-869a5f71684a9735074557c4fac1c0c566e107d3.tar.xz frr-869a5f71684a9735074557c4fac1c0c566e107d3.zip |
zebra: set nlmsg_pid in netlink msgs sent by 'fpm'
Use nl_pid from the netlink socket used for programming the kernel
(netlink_dplane) in netlink route messages sent by the 'fpm' module.
This makes 'fpm' consistent with 'dplane_fpm_nl' which already
behaves this way, and allows FPM server implementations to determine
route origin via nlmsg_pid.
Signed-off-by: Duncan Eastoe <duncan.eastoe@att.com>
Diffstat (limited to 'zebra/zebra_fpm_netlink.c')
-rw-r--r-- | zebra/zebra_fpm_netlink.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/zebra/zebra_fpm_netlink.c b/zebra/zebra_fpm_netlink.c index 44f574073..f7c5da5de 100644 --- a/zebra/zebra_fpm_netlink.c +++ b/zebra/zebra_fpm_netlink.c @@ -133,6 +133,7 @@ struct netlink_nh_info { * A structure for holding information for a netlink route message. */ struct netlink_route_info { + uint32_t nlmsg_pid; uint16_t nlmsg_type; uint8_t rtm_type; uint32_t rtm_table; @@ -244,14 +245,20 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd, rib_dest_t *dest, struct route_entry *re) { struct nexthop *nexthop; + struct rib_table_info *table_info = + rib_table_info(rib_dest_table(dest)); + struct zebra_vrf *zvrf = table_info->zvrf; memset(ri, 0, sizeof(*ri)); ri->prefix = rib_dest_prefix(dest); ri->af = rib_dest_af(dest); + if (zvrf && zvrf->zns) + ri->nlmsg_pid = zvrf->zns->netlink_dplane.snl.nl_pid; + ri->nlmsg_type = cmd; - ri->rtm_table = rib_table_info(rib_dest_table(dest))->table_id; + ri->rtm_table = table_info->table_id; ri->rtm_protocol = RTPROT_UNSPEC; /* @@ -357,6 +364,7 @@ static int netlink_route_info_encode(struct netlink_route_info *ri, req->n.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg)); req->n.nlmsg_flags = NLM_F_CREATE | NLM_F_REQUEST; + req->n.nlmsg_pid = ri->nlmsg_pid; req->n.nlmsg_type = ri->nlmsg_type; req->r.rtm_family = ri->af; |