public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2] lib utils: fix family during af_bit_len calculation
@ 2015-03-18  2:18 roopa
  2015-03-24 22:05 ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: roopa @ 2015-03-18  2:18 UTC (permalink / raw)
  To: stephen; +Cc: netdev, vadim4j

From: Roopa Prabhu <roopa@cumulusnetworks.com>

commit f3a2ddc124e0 ("lib utils: Use helpers to get AF bit/byte len")
used a wrong family or family of zero in the default case
during af_bit_len calculation causing ip route commands to
fail with below error

Error: an inet prefix is expected rather than "10.0.2.14/24".

Reported-by: Sven-Haegar Koch <haegar@sdinet.de>
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 lib/utils.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/utils.c b/lib/utils.c
index 9cda268..0d08a86 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -477,7 +477,7 @@ int get_prefix_1(inet_prefix *dst, char *arg, int family)
 
 	err = get_addr_1(dst, arg, family);
 	if (err == 0) {
-		dst->bitlen = af_bit_len(family);
+		dst->bitlen = af_bit_len(dst->family);
 
 		if (slash) {
 			if (get_netmask(&plen, slash+1, 0)
-- 
1.7.10.4

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

end of thread, other threads:[~2015-03-26 16:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18  2:18 [PATCH iproute2] lib utils: fix family during af_bit_len calculation roopa
2015-03-24 22:05 ` Stephen Hemminger
2015-03-25 13:32   ` Eric Dumazet
2015-03-25 13:31     ` Vadim Kochan
2015-03-25 16:13     ` Vadim Kochan
2015-03-25 17:07       ` Eric Dumazet
2015-03-26 14:04         ` Vadim Kochan
2015-03-26 16:34           ` Eric Dumazet
2015-03-26 16:28             ` Vadim Kochan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox