diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-04-25 19:40:26 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-04-25 19:40:26 +0000 |
commit | cbf9e0e4d981e70d17401e7e26efbbb3fecabdc0 (patch) | |
tree | c319507b84145eee55d59721e4544e37ea63621f /lib/libc | |
parent | d888b460fc9ca99c51662b26f9338d676786e204 (diff) |
always widen the imputed netmask if it is narrower than the specified octets.
fixes a strange behaviour where inet_net_pton would always return 4 (bits)
for multicast addresses no matter how many octets were specified.
negotiated with Paul Vixie, original author of this function.
ok millert@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/inet_net_pton.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/net/inet_net_pton.c b/lib/libc/net/inet_net_pton.c index 932531eb5d1..3c72efac6b7 100644 --- a/lib/libc/net/inet_net_pton.c +++ b/lib/libc/net/inet_net_pton.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_net_pton.c,v 1.2 2002/02/17 19:42:23 millert Exp $ */ +/* $OpenBSD: inet_net_pton.c,v 1.3 2003/04/25 19:40:25 henning Exp $ */ /* * Copyright (c) 1996 by Internet Software Consortium. @@ -21,7 +21,7 @@ #if 0 static const char rcsid[] = "$From: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp $"; #else -static const char rcsid[] = "$OpenBSD: inet_net_pton.c,v 1.2 2002/02/17 19:42:23 millert Exp $"; +static const char rcsid[] = "$OpenBSD: inet_net_pton.c,v 1.3 2003/04/25 19:40:25 henning Exp $"; #endif #endif @@ -185,7 +185,7 @@ inet_net_pton_ipv4(src, dst, size) else /* Class A */ bits = 8; /* If imputed mask is narrower than specified octets, widen. */ - if (bits >= 8 && bits < ((dst - odst) * 8)) + if (bits < ((dst - odst) * 8)) bits = (dst - odst) * 8; } /* Extend network to cover the actual mask. */ |