* [PATCH iproute2] lib: suppress error msg when filling the cache
@ 2019-05-24 8:59 Nicolas Dichtel
2019-05-24 16:08 ` David Ahern
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Dichtel @ 2019-05-24 8:59 UTC (permalink / raw)
To: stephen; +Cc: netdev, dsahern, Nicolas Dichtel, Philippe Guibert
Before the patch:
$ ip netns add foo
$ ip link add name veth1 address 2a:a5:5c:b9:52:89 type veth peer name veth2 address 2a:a5:5c:b9:53:90 netns foo
RTNETLINK answers: No such device
RTNETLINK answers: No such device
But the command was successful. This may break script. Let's remove those
error messages.
Fixes: 55870dfe7f8b ("Improve batch and dump times by caching link lookups")
Reported-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
lib/ll_map.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ll_map.c b/lib/ll_map.c
index 2d7b65dcb8f7..e0ed54bf77c9 100644
--- a/lib/ll_map.c
+++ b/lib/ll_map.c
@@ -177,7 +177,7 @@ static int ll_link_get(const char *name, int index)
addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name,
strlen(name) + 1);
- if (rtnl_talk(&rth, &req.n, &answer) < 0)
+ if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0)
goto out;
/* add entry to cache */
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] lib: suppress error msg when filling the cache
2019-05-24 8:59 [PATCH iproute2] lib: suppress error msg when filling the cache Nicolas Dichtel
@ 2019-05-24 16:08 ` David Ahern
2019-05-28 19:25 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2019-05-24 16:08 UTC (permalink / raw)
To: Nicolas Dichtel, stephen; +Cc: netdev, Philippe Guibert
On 5/24/19 2:59 AM, Nicolas Dichtel wrote:
> Before the patch:
> $ ip netns add foo
> $ ip link add name veth1 address 2a:a5:5c:b9:52:89 type veth peer name veth2 address 2a:a5:5c:b9:53:90 netns foo
> RTNETLINK answers: No such device
> RTNETLINK answers: No such device
>
> But the command was successful. This may break script. Let's remove those
> error messages.
>
> Fixes: 55870dfe7f8b ("Improve batch and dump times by caching link lookups")
> Reported-by: Philippe Guibert <philippe.guibert@6wind.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> lib/ll_map.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/ll_map.c b/lib/ll_map.c
> index 2d7b65dcb8f7..e0ed54bf77c9 100644
> --- a/lib/ll_map.c
> +++ b/lib/ll_map.c
> @@ -177,7 +177,7 @@ static int ll_link_get(const char *name, int index)
> addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name,
> strlen(name) + 1);
>
> - if (rtnl_talk(&rth, &req.n, &answer) < 0)
> + if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0)
> goto out;
>
> /* add entry to cache */
>
In general, ll_link_get suppressing the error message seems like the
right thing to do.
For the example above, seems like nl_get_ll_addr_len is the cause of the
error messages, and it should not be called for this use case (NEWLINK
with NLM_F_CREATE set)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] lib: suppress error msg when filling the cache
2019-05-24 16:08 ` David Ahern
@ 2019-05-28 19:25 ` Stephen Hemminger
2019-05-29 14:42 ` [PATCH iproute2] iplink: don't try to get ll addr len when creating an iface Nicolas Dichtel
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2019-05-28 19:25 UTC (permalink / raw)
To: David Ahern; +Cc: Nicolas Dichtel, netdev, Philippe Guibert
On Fri, 24 May 2019 10:08:28 -0600
David Ahern <dsahern@gmail.com> wrote:
> On 5/24/19 2:59 AM, Nicolas Dichtel wrote:
> > Before the patch:
> > $ ip netns add foo
> > $ ip link add name veth1 address 2a:a5:5c:b9:52:89 type veth peer name veth2 address 2a:a5:5c:b9:53:90 netns foo
> > RTNETLINK answers: No such device
> > RTNETLINK answers: No such device
> >
> > But the command was successful. This may break script. Let's remove those
> > error messages.
> >
> > Fixes: 55870dfe7f8b ("Improve batch and dump times by caching link lookups")
> > Reported-by: Philippe Guibert <philippe.guibert@6wind.com>
> > Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> > ---
> > lib/ll_map.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/ll_map.c b/lib/ll_map.c
> > index 2d7b65dcb8f7..e0ed54bf77c9 100644
> > --- a/lib/ll_map.c
> > +++ b/lib/ll_map.c
> > @@ -177,7 +177,7 @@ static int ll_link_get(const char *name, int index)
> > addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name,
> > strlen(name) + 1);
> >
> > - if (rtnl_talk(&rth, &req.n, &answer) < 0)
> > + if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0)
> > goto out;
> >
> > /* add entry to cache */
> >
>
> In general, ll_link_get suppressing the error message seems like the
> right thing to do.
>
> For the example above, seems like nl_get_ll_addr_len is the cause of the
> error messages, and it should not be called for this use case (NEWLINK
> with NLM_F_CREATE set)
Agree. I merged the patch to ll_link_get but send another to avoid
the cause of unnecessary query.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH iproute2] iplink: don't try to get ll addr len when creating an iface
2019-05-28 19:25 ` Stephen Hemminger
@ 2019-05-29 14:42 ` Nicolas Dichtel
2019-05-30 18:05 ` Stephen Hemminger
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Dichtel @ 2019-05-29 14:42 UTC (permalink / raw)
To: stephen; +Cc: netdev, dsahern, Nicolas Dichtel
It will obviously fail. This is a follow up of the commit
757837230a65 ("lib: suppress error msg when filling the cache").
Suggested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
ip/iplink.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 7952cb2be364..d275efa9d087 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -945,7 +945,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req, char **type)
else if (!strcmp(name, dev))
name = dev;
- if (dev && addr_len) {
+ if (dev && addr_len &&
+ !(req->n.nlmsg_flags & NLM_F_CREATE)) {
int halen = nl_get_ll_addr_len(dev);
if (halen >= 0 && halen != addr_len) {
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH iproute2] iplink: don't try to get ll addr len when creating an iface
2019-05-29 14:42 ` [PATCH iproute2] iplink: don't try to get ll addr len when creating an iface Nicolas Dichtel
@ 2019-05-30 18:05 ` Stephen Hemminger
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2019-05-30 18:05 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: netdev, dsahern
On Wed, 29 May 2019 16:42:10 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> It will obviously fail. This is a follow up of the commit
> 757837230a65 ("lib: suppress error msg when filling the cache").
>
> Suggested-by: David Ahern <dsahern@gmail.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Looks good, thanks for following up.
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-05-30 18:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-24 8:59 [PATCH iproute2] lib: suppress error msg when filling the cache Nicolas Dichtel
2019-05-24 16:08 ` David Ahern
2019-05-28 19:25 ` Stephen Hemminger
2019-05-29 14:42 ` [PATCH iproute2] iplink: don't try to get ll addr len when creating an iface Nicolas Dichtel
2019-05-30 18:05 ` Stephen Hemminger
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.