diff options
author | henning <> | 2003-04-25 19:40:25 +0000 |
---|---|---|
committer | henning <> | 2003-04-25 19:40:25 +0000 |
commit | 2b1ab92acce00647d494879860486069d0d105b3 (patch) | |
tree | 7f69ab60b54f50f7c974688db87e3226122f5aa8 | |
parent | 7f7aa15f5be4823b7a344578e769349a2e1d0235 (diff) | |
download | openbsd-2b1ab92acce00647d494879860486069d0d105b3.tar.gz openbsd-2b1ab92acce00647d494879860486069d0d105b3.tar.bz2 openbsd-2b1ab92acce00647d494879860486069d0d105b3.zip |
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@
-rw-r--r-- | src/lib/libc/net/inet_net_pton.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libc/net/inet_net_pton.c b/src/lib/libc/net/inet_net_pton.c index 932531eb5d..3c72efac6b 100644 --- a/src/lib/libc/net/inet_net_pton.c +++ b/src/lib/libc/net/inet_net_pton.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: inet_net_pton.c,v 1.2 2002/02/17 19:42:23 millert Exp $ */ | 1 | /* $OpenBSD: inet_net_pton.c,v 1.3 2003/04/25 19:40:25 henning Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1996 by Internet Software Consortium. | 4 | * Copyright (c) 1996 by Internet Software Consortium. |
@@ -21,7 +21,7 @@ | |||
21 | #if 0 | 21 | #if 0 |
22 | static const char rcsid[] = "$From: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp $"; | 22 | static const char rcsid[] = "$From: inet_net_pton.c,v 8.3 1996/11/11 06:36:52 vixie Exp $"; |
23 | #else | 23 | #else |
24 | static const char rcsid[] = "$OpenBSD: inet_net_pton.c,v 1.2 2002/02/17 19:42:23 millert Exp $"; | 24 | static const char rcsid[] = "$OpenBSD: inet_net_pton.c,v 1.3 2003/04/25 19:40:25 henning Exp $"; |
25 | #endif | 25 | #endif |
26 | #endif | 26 | #endif |
27 | 27 | ||
@@ -185,7 +185,7 @@ inet_net_pton_ipv4(src, dst, size) | |||
185 | else /* Class A */ | 185 | else /* Class A */ |
186 | bits = 8; | 186 | bits = 8; |
187 | /* If imputed mask is narrower than specified octets, widen. */ | 187 | /* If imputed mask is narrower than specified octets, widen. */ |
188 | if (bits >= 8 && bits < ((dst - odst) * 8)) | 188 | if (bits < ((dst - odst) * 8)) |
189 | bits = (dst - odst) * 8; | 189 | bits = (dst - odst) * 8; |
190 | } | 190 | } |
191 | /* Extend network to cover the actual mask. */ | 191 | /* Extend network to cover the actual mask. */ |