From: Roopa Prabhu Date: Wed, 18 Mar 2015 02:18:28 +0000 (-0700) Subject: lib utils: fix family during af_bit_len calculation X-Git-Tag: v4.0.0~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=106ca2779ebc0d6a17ce7fae073aa38cdbdae6bb;p=thirdparty%2Fiproute2.git lib utils: fix family during af_bit_len calculation 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 Signed-off-by: Roopa Prabhu --- diff --git a/lib/utils.c b/lib/utils.c index 9cda26810..0d08a8687 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)