Skip to content

Commit 628a463

Browse files
authored
Merge pull request #20289 from mjstapp/fix_dplane_netlink_neigh
zebra: don't access ifp from dplane pthread
2 parents 33342f8 + 2f446a8 commit 628a463

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

zebra/rt_netlink.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4451,7 +4451,6 @@ ssize_t netlink_macfdb_update_ctx(struct zebra_dplane_ctx *ctx, void *data,
44514451
static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
44524452
{
44534453
struct ndmsg *ndm;
4454-
struct interface *ifp;
44554454
struct rtattr *tb[NDA_MAX + 1];
44564455
struct ethaddr mac;
44574456
struct ipaddr ip;
@@ -4473,19 +4472,13 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
44734472

44744473
ndm = NLMSG_DATA(h);
44754474

4476-
/* The interface should exist. */
4477-
ifp = if_lookup_by_index_per_ns(zebra_ns_lookup(ns_id), ndm->ndm_ifindex);
4478-
if (!ifp || !ifp->info)
4479-
return 0;
4480-
44814475
/* Parse attributes and extract fields of interest. */
44824476
netlink_parse_rtattr(tb, NDA_MAX, NDA_RTA(ndm), len);
44834477

44844478
if (!tb[NDA_DST]) {
4485-
zlog_debug("%s family %s IF %s(%u) vrf %s(%u) - no DST",
4479+
zlog_debug("%s family %s IF %u NSID %u - no DST",
44864480
nl_msg_type_to_str(h->nlmsg_type),
4487-
nl_family_to_str(ndm->ndm_family), ifp->name,
4488-
ndm->ndm_ifindex, ifp->vrf->name, ifp->vrf->vrf_id);
4481+
nl_family_to_str(ndm->ndm_family), ndm->ndm_ifindex, ns_id);
44894482
return 0;
44904483
}
44914484

@@ -4543,14 +4536,12 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
45434536
if (RTA_PAYLOAD(tb[NDA_LLADDR]) != ETH_ALEN) {
45444537
if (IS_ZEBRA_DEBUG_KERNEL)
45454538
zlog_debug(
4546-
"%s family %s IF %s(%u) vrf %s(%u) - LLADDR is not MAC, len %lu",
4539+
"%s family %s IF %u NSID %u - LLADDR is not MAC, len %lu",
45474540
nl_msg_type_to_str(
45484541
h->nlmsg_type),
45494542
nl_family_to_str(
45504543
ndm->ndm_family),
4551-
ifp->name, ndm->ndm_ifindex,
4552-
ifp->vrf->name,
4553-
ifp->vrf->vrf_id,
4544+
ndm->ndm_ifindex, ns_id,
45544545
(unsigned long)RTA_PAYLOAD(
45554546
tb[NDA_LLADDR]));
45564547

@@ -4581,10 +4572,10 @@ static int netlink_ipneigh_change(struct nlmsghdr *h, int len, ns_id_t ns_id)
45814572
dplane_ctx_neigh_set_dp_static(ctx, dp_static);
45824573

45834574
if (IS_ZEBRA_DEBUG_KERNEL)
4584-
zlog_debug("Rx %s family %s IF %s(%u) vrf %s(%u) IP %pIA MAC %s state 0x%x flags 0x%x ext_flags 0x%x, proto %u",
4575+
zlog_debug("Rx %s family %s IF %u NSID %u IP %pIA MAC %s state 0x%x flags 0x%x ext_flags 0x%x, proto %u",
45854576
nl_msg_type_to_str(h->nlmsg_type),
4586-
nl_family_to_str(ndm->ndm_family), ifp->name, ndm->ndm_ifindex,
4587-
ifp->vrf->name, ifp->vrf->vrf_id, &ip,
4577+
nl_family_to_str(ndm->ndm_family), ndm->ndm_ifindex,
4578+
ns_id, &ip,
45884579
mac_present ? prefix_mac2str(&mac, buf, sizeof(buf)) : "",
45894580
ndm->ndm_state, ndm->ndm_flags, ext_flags, rtprot);
45904581

0 commit comments

Comments
 (0)