From 106ca2779ebc0d6a17ce7fae073aa38cdbdae6bb Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Tue, 17 Mar 2015 19:18:28 -0700 Subject: [PATCH] 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 --- lib/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.c b/lib/utils.c index 9cda2681..0d08a868 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)