]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
lib utils: fix family during af_bit_len calculation
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Wed, 18 Mar 2015 02:18:28 +0000 (19:18 -0700)
committerStephen Hemminger <shemming@brocade.com>
Tue, 24 Mar 2015 22:03:35 +0000 (15:03 -0700)
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

index 9cda26810da1f48ed1998dc9a07e4199dd2fe468..0d08a86872c9c1f27908e5b5a9b4cd9856bef469 100644 (file)
@@ -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)