Ok.. really get it right this time (that's ntohs, not htons.. need coffee).

This commit is contained in:
fvdl 2000-06-08 09:01:05 +00:00
parent da693d7595
commit 4810a01fcf
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: security.c,v 1.4 2000/06/08 08:21:42 fvdl Exp $ */ /* $NetBSD: security.c,v 1.5 2000/06/08 09:01:05 fvdl Exp $ */
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
@ -134,14 +134,14 @@ is_loopback(struct netbuf *nbuf)
return 0; return 0;
sin = (struct sockaddr_in *)addr; sin = (struct sockaddr_in *)addr;
return ((sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && return ((sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) &&
(htons(sin->sin_port) < IPPORT_RESERVED)); (ntohs(sin->sin_port) < IPPORT_RESERVED));
#ifdef INET6 #ifdef INET6
case AF_INET6: case AF_INET6:
if (!oldstyle_local) if (!oldstyle_local)
return 0; return 0;
sin6 = (struct sockaddr_in6 *)addr; sin6 = (struct sockaddr_in6 *)addr;
return (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) && return (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr) &&
(htons(sin6->sin6_port) < IPV6PORT_RESERVED)); (ntohs(sin6->sin6_port) < IPV6PORT_RESERVED));
#endif #endif
case AF_LOCAL: case AF_LOCAL:
return 1; return 1;