Interpret 'prefixlen 0' as the maximum prefix length, as ifconfig

has always done.
This commit is contained in:
dyoung 2008-05-07 18:17:42 +00:00
parent ed7181ed99
commit e4942eb316
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: util.c,v 1.2 2008/05/06 16:09:18 dyoung Exp $ */
/* $NetBSD: util.c,v 1.3 2008/05/07 18:17:42 dyoung Exp $ */
/*-
* Copyright (c)2008 David Young. All rights reserved.
@ -175,6 +175,9 @@ prefixlen_to_mask(int af, int plen)
return NULL;
}
if (plen == 0)
plen = addrlen * NBBY;
memset(addr, 0xff, (plen + NBBY - 1) / NBBY);
nbit = plen % NBBY;