From: roopa <roopa@cumulusnetworks.com>
To: "Rosen, Rami" <rami.rosen@intel.com>
Cc: "hadi@mojatatu.com" <hadi@mojatatu.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"hannes@stressinduktion.org" <hannes@stressinduktion.org>
Subject: Re: [PATCH net-next RFC] ipv4 neigh: match add/del dev lookup behaviour to SIOCSARP/SIOCDARP
Date: Tue, 24 Feb 2015 06:35:15 -0800 [thread overview]
Message-ID: <54EC8C23.5060204@cumulusnetworks.com> (raw)
In-Reply-To: <9B0331B6EBBD0E4684FBFAEDA55776F9189654A5@HASMSX110.ger.corp.intel.com>
On 2/24/15, 6:01 AM, Rosen, Rami wrote:
> Hi,
>
> @@ -1692,24 +1703,31 @@ static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh)
> goto out;
>
> ndm = nlmsg_data(nlh);
> + tbl = neigh_find_table(ndm->ndm_family);
> + if (tbl == NULL)
> + return -EAFNOSUPPORT;
> +
> + if (nla_len(tb[NDA_DST]) < tbl->key_len)
> + goto out;
> +
> + dst = nla_data(tb[NDA_DST]);
> if (ndm->ndm_ifindex) {
> dev = __dev_get_by_index(net, ndm->ndm_ifindex);
> if (dev == NULL) {
> err = -ENODEV;
> goto out;
> }
>
> If ip_route_output() fails, then the neigh_add() method will return -EINVAL (as it was initialized thus);
I was intentionally trying not to return any special error code if
ip_route_output() fails. So the patch tries to make the ip_route_output
failure same as the case where the user did not specify a device.
> or, in cases when the NTF_PROXY flag is set, it can return 0 or ENOBUFS, according to the result of the pneigh_lookup(), which is called immediately subsequently in this path. But in fact __ip_route_output_key(), which is invoked by ip_route_output(), can return different error codes, like -EINVAL,-ENODEV, -ENETUNREACH and more, via ERR_PTR.
>
> So maybe better is (in order to reflect the cause of the error):
> + if (!IS_ERR(rt)) {
> + dev = rt->dst.dev;
> + ip_rt_put(rt);
> + } else
> return PTR_ERR(rt);
I intentionally don't return here ..because from the original code, the
NTF_PROXY case seemed to be ok with the device being NULL. The device
NULL check was after the NTF_PROXY code.
>
> We can exit the method at this point with "return PTR_ERR(rt)" because we are assured at this point that dev is NULL.
>
> Error handling in neigh_delete() method maybe also be better changed accordingly.
I intend to do some testing for the NTF_PROXY case, however, AFAICT,
this patch should not have introduced any functional changes in that path.
Thanks!.
next prev parent reply other threads:[~2015-02-24 14:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 5:42 [PATCH net-next RFC] ipv4 neigh: match add/del dev lookup behaviour to SIOCSARP/SIOCDARP roopa
2015-02-24 14:01 ` Rosen, Rami
2015-02-24 14:35 ` roopa [this message]
2015-02-24 14:38 ` Eric Dumazet
2015-02-24 21:03 ` David Miller
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=54EC8C23.5060204@cumulusnetworks.com \
--to=roopa@cumulusnetworks.com \
--cc=davem@davemloft.net \
--cc=hadi@mojatatu.com \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
--cc=rami.rosen@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.