All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2] utils: Do not reset family for default, any, all addresses
@ 2018-04-13 16:36 David Ahern
  2018-04-15 19:14 ` Thomas Deutschmann
  2018-04-17  0:01 ` Stephen Hemminger
  0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2018-04-13 16:36 UTC (permalink / raw)
  To: stephen; +Cc: netdev, whissi, David Ahern, Serhey Popovych

Thomas reported a change in behavior with respect to autodectecting
address families. Specifically, 'ip ro add default via fe80::1'
syntax was failing to treat fe80::1 as an IPv6 address as it did in
prior releases. The root causes appears to be a change in family when
the default keyword is parsed.

'default', 'any' and 'all' are relevant outside of AF_INET. Leave the
family arg as is for these when setting addr.

Fixes: 93fa12418dc6 ("utils: Always specify family and ->bytelen in get_prefix_1()")
Reported-by: Thomas Deutschmann <whissi@gentoo.org>
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Serhey Popovych <serhe.popovych@gmail.com>
---
 lib/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/utils.c b/lib/utils.c
index 60d7eb14b438..8a0bff0babeb 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -568,7 +568,7 @@ static int __get_addr_1(inet_prefix *addr, const char *name, int family)
 	if (strcmp(name, "default") == 0) {
 		if ((family == AF_DECnet) || (family == AF_MPLS))
 			return -1;
-		addr->family = (family != AF_UNSPEC) ? family : AF_INET;
+		addr->family = family;
 		addr->bytelen = af_byte_len(addr->family);
 		addr->bitlen = -2;
 		addr->flags |= PREFIXLEN_SPECIFIED;
@@ -579,7 +579,7 @@ static int __get_addr_1(inet_prefix *addr, const char *name, int family)
 	    strcmp(name, "any") == 0) {
 		if ((family == AF_DECnet) || (family == AF_MPLS))
 			return -1;
-		addr->family = AF_UNSPEC;
+		addr->family = family;
 		addr->bytelen = 0;
 		addr->bitlen = -2;
 		return 0;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2] utils: Do not reset family for default, any, all addresses
  2018-04-13 16:36 [PATCH iproute2] utils: Do not reset family for default, any, all addresses David Ahern
@ 2018-04-15 19:14 ` Thomas Deutschmann
  2018-04-17  0:01 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Deutschmann @ 2018-04-15 19:14 UTC (permalink / raw)
  To: David Ahern, stephen; +Cc: netdev, Serhey Popovych

Hi,

I can confirm that this patch solves the issue for us and restores
previous behavior.

Thank you.


-- 
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2] utils: Do not reset family for default, any, all addresses
  2018-04-13 16:36 [PATCH iproute2] utils: Do not reset family for default, any, all addresses David Ahern
  2018-04-15 19:14 ` Thomas Deutschmann
@ 2018-04-17  0:01 ` Stephen Hemminger
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2018-04-17  0:01 UTC (permalink / raw)
  To: David Ahern; +Cc: netdev, whissi, Serhey Popovych

On Fri, 13 Apr 2018 09:36:33 -0700
David Ahern <dsahern@gmail.com> wrote:

> Thomas reported a change in behavior with respect to autodectecting
> address families. Specifically, 'ip ro add default via fe80::1'
> syntax was failing to treat fe80::1 as an IPv6 address as it did in
> prior releases. The root causes appears to be a change in family when
> the default keyword is parsed.
> 
> 'default', 'any' and 'all' are relevant outside of AF_INET. Leave the
> family arg as is for these when setting addr.
> 
> Fixes: 93fa12418dc6 ("utils: Always specify family and ->bytelen in get_prefix_1()")
> Reported-by: Thomas Deutschmann <whissi@gentoo.org>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Serhey Popovych <serhe.popovych@gmail.com>

Looks good, thanks for fixing.
Applied

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-04-17  0:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-13 16:36 [PATCH iproute2] utils: Do not reset family for default, any, all addresses David Ahern
2018-04-15 19:14 ` Thomas Deutschmann
2018-04-17  0:01 ` 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.