From cbf9e0e4d981e70d17401e7e26efbbb3fecabdc0 Mon Sep 17 00:00:00 2001 From: Henning Brauer Date: Fri, 25 Apr 2003 19:40:26 +0000 Subject: 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@ --- lib/libc/net/inet_net_pton.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/libc/net') 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. */ -- cgit v1.2.3