diff options
Diffstat (limited to 'zebra/kernel_netlink.c')
| -rw-r--r-- | zebra/kernel_netlink.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index 5d64f57b3e..c77a357e9f 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -383,7 +383,7 @@ static int netlink_information_fetch(struct nlmsghdr *h, ns_id_t ns_id, * it to be sent up to us */ flog_err(EC_ZEBRA_UNKNOWN_NLMSG, - "Unknown netlink nlmsg_type %s(%d) vrf %u\n", + "Unknown netlink nlmsg_type %s(%d) vrf %u", nl_msg_type_to_str(h->nlmsg_type), h->nlmsg_type, ns_id); break; @@ -485,10 +485,23 @@ static void netlink_install_filter(int sock, __u32 pid, __u32 dplane_pid) if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog)) < 0) - flog_err_sys(EC_LIB_SOCKET, "Can't install socket filter: %s\n", + flog_err_sys(EC_LIB_SOCKET, "Can't install socket filter: %s", safe_strerror(errno)); } +void netlink_parse_rtattr_flags(struct rtattr **tb, int max, + struct rtattr *rta, int len, unsigned short flags) +{ + unsigned short type; + + while (RTA_OK(rta, len)) { + type = rta->rta_type & ~flags; + if ((type <= max) && (!tb[type])) + tb[type] = rta; + rta = RTA_NEXT(rta, len); + } +} + void netlink_parse_rtattr(struct rtattr **tb, int max, struct rtattr *rta, int len) { @@ -1123,9 +1136,11 @@ static int nl_batch_read_resp(struct nl_batch *bth) * associated with any dplane context object. */ if (ctx == NULL) { - zlog_debug( - "%s: skipping unassociated response, seq number %d NS %u", - __func__, h->nlmsg_seq, bth->zns->ns_id); + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug( + "%s: skipping unassociated response, seq number %d NS %u", + __func__, h->nlmsg_seq, + bth->zns->ns_id); continue; } @@ -1136,8 +1151,9 @@ static int nl_batch_read_resp(struct nl_batch *bth) dplane_ctx_set_status( ctx, ZEBRA_DPLANE_REQUEST_FAILURE); - zlog_debug("%s: netlink error message seq=%d ", - __func__, h->nlmsg_seq); + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: netlink error message seq=%d ", + __func__, h->nlmsg_seq); continue; } @@ -1146,9 +1162,11 @@ static int nl_batch_read_resp(struct nl_batch *bth) * the error and instead received some other message in an * unexpected way. */ - zlog_debug("%s: ignoring message type 0x%04x(%s) NS %u", - __func__, h->nlmsg_type, - nl_msg_type_to_str(h->nlmsg_type), bth->zns->ns_id); + if (IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("%s: ignoring message type 0x%04x(%s) NS %u", + __func__, h->nlmsg_type, + nl_msg_type_to_str(h->nlmsg_type), + bth->zns->ns_id); } return 0; |
