Merge pull request #10469 from mjstapp/fix_dplane_netlink_groups

zebra: reduce incoming netlink messages for dplane thread
This commit is contained in:
Donatas Abraitis 2022-02-04 17:51:31 +02:00 committed by GitHub
commit 66a59f8743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1455,7 +1455,7 @@ void kernel_update_multi(struct dplane_ctx_q *ctx_list)
netlink_socket (). */ netlink_socket (). */
void kernel_init(struct zebra_ns *zns) void kernel_init(struct zebra_ns *zns)
{ {
uint32_t groups; uint32_t groups, dplane_groups;
#if defined SOL_NETLINK #if defined SOL_NETLINK
int one, ret; int one, ret;
#endif #endif
@ -1480,6 +1480,10 @@ void kernel_init(struct zebra_ns *zns)
((uint32_t) 1 << (RTNLGRP_IPV6_RULE - 1)) | ((uint32_t) 1 << (RTNLGRP_IPV6_RULE - 1)) |
((uint32_t) 1 << (RTNLGRP_NEXTHOP - 1)); ((uint32_t) 1 << (RTNLGRP_NEXTHOP - 1));
dplane_groups = (RTMGRP_LINK |
RTMGRP_IPV4_IFADDR |
RTMGRP_IPV6_IFADDR);
snprintf(zns->netlink.name, sizeof(zns->netlink.name), snprintf(zns->netlink.name, sizeof(zns->netlink.name),
"netlink-listen (NS %u)", zns->ns_id); "netlink-listen (NS %u)", zns->ns_id);
zns->netlink.sock = -1; zns->netlink.sock = -1;
@ -1514,7 +1518,8 @@ void kernel_init(struct zebra_ns *zns)
sizeof(zns->netlink_dplane_in.name), "netlink-dp-in (NS %u)", sizeof(zns->netlink_dplane_in.name), "netlink-dp-in (NS %u)",
zns->ns_id); zns->ns_id);
zns->netlink_dplane_in.sock = -1; zns->netlink_dplane_in.sock = -1;
if (netlink_socket(&zns->netlink_dplane_in, groups, zns->ns_id) < 0) { if (netlink_socket(&zns->netlink_dplane_in, dplane_groups,
zns->ns_id) < 0) {
zlog_err("Failure to create %s socket", zlog_err("Failure to create %s socket",
zns->netlink_dplane_in.name); zns->netlink_dplane_in.name);
exit(-1); exit(-1);