From: David Ahern <dsahern@gmail.com>
To: mcmahon@arista.com, davem@davemloft.net,
roopa@cumulusnetworks.com, christian@brauner.io,
khlebnikov@yandex-team.ru, lzgrablic@arista.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
mowat@arista.com, dmia@arista.com
Subject: Re: getneigh: add nondump to retrieve single entry
Date: Mon, 13 May 2019 16:01:04 -0600 [thread overview]
Message-ID: <d05e56d5-2677-3c03-7a25-df2ca2681a75@gmail.com> (raw)
In-Reply-To: <20190513160335.24128-1-mcmahon@arista.com>
On 5/13/19 10:03 AM, mcmahon@arista.com wrote:
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 30f6fd8f68e0..981f1568710b 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> +static int neigh_find_fill(struct neigh_table *tbl, const void *pkey,
> + struct net_device *dev, struct sk_buff *skb, u32 pid,
> + u32 seq)
> +{
> + struct neighbour *neigh;
> + int key_len = tbl->key_len;
> + u32 hash_val;
> + struct neigh_hash_table *nht;
> + int err;
reverse xmas tree ordering
...
> +static int neigh_get(struct sk_buff *skb, struct nlmsghdr *nlh)
> +{
> + struct net *net = sock_net(skb->sk);
> + struct ndmsg *ndm;
> + struct nlattr *dst_attr;
> + struct neigh_table *tbl;
> + struct net_device *dev = NULL;
> +
> + ASSERT_RTNL();
> + if (nlmsg_len(nlh) < sizeof(*ndm))
> + return -EINVAL;
> +
> + dst_attr = nlmsg_find_attr(nlh, sizeof(*ndm), NDA_DST);
> + if (dst_attr == NULL)
> + return -EINVAL;
> +
> + ndm = nlmsg_data(nlh);
> + if (ndm->ndm_ifindex) {
> + dev = __dev_get_by_index(net, ndm->ndm_ifindex);
> + if (dev == NULL)
> + return -ENODEV;
> + }
> +
> + read_lock(&neigh_tbl_lock);
this patch is clearly for a MUCH older kernel than 5.2 (like 3.18
maybe?) as that lock no longer exists.
> + for (tbl = neigh_tables; tbl; tbl = tbl->next) {
> + struct sk_buff *nskb;
> + int err;
> +
> + if (tbl->family != ndm->ndm_family)
> + continue;
Use neigh_find_table.
You need to update the patch to top of net-next tree and re-work the
locking. Run tests with RCU and lock debugging enabled to make sure you
have it right.
next prev parent reply other threads:[~2019-05-13 22:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 16:03 mcmahon
2019-05-13 22:01 ` David Ahern [this message]
2019-05-14 15:40 ` Roopa Prabhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d05e56d5-2677-3c03-7a25-df2ca2681a75@gmail.com \
--to=dsahern@gmail.com \
--cc=christian@brauner.io \
--cc=davem@davemloft.net \
--cc=dmia@arista.com \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=lzgrablic@arista.com \
--cc=mcmahon@arista.com \
--cc=mowat@arista.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®