diff mbox

lib utils: use a correct variable to get address length

Message ID 1427145369-29477-1-git-send-email-avagin@openvz.org
State Superseded, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Andrei Vagin March 23, 2015, 9:16 p.m. UTC
dst->famaly is initialized in get_addr_1()

This patch fixes errors like this:
$ ip r a 10.31.0.0/16 dev br0
Error: an inet prefix is expected rather than "10.31.0.0/16".

Cc: Vadim Kochan <vadim4j@gmail.com>
Fixes: f3a2ddc124e0 ("lib utils: Use helpers to get AF bit/byte len")
Signed-off-by: Andrew Vagin <avagin@openvz.org>
---
 lib/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Roopa Prabhu March 23, 2015, 9:53 p.m. UTC | #1
On 3/23/15, 2:16 PM, Andrew Vagin wrote:
> dst->famaly is initialized in get_addr_1()
>
> This patch fixes errors like this:
> $ ip r a 10.31.0.0/16 dev br0
> Error: an inet prefix is expected rather than "10.31.0.0/16".
>
> Cc: Vadim Kochan <vadim4j@gmail.com>
> Fixes: f3a2ddc124e0 ("lib utils: Use helpers to get AF bit/byte len")
> Signed-off-by: Andrew Vagin <avagin@openvz.org>

I have already submitted similar patch 
https://patchwork.ozlabs.org/patch/451210/

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)