aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorJonathan Lemon <jlemon@FreeBSD.org>2001-09-07 05:32:54 +0000
committerJonathan Lemon <jlemon@FreeBSD.org>2001-09-07 05:32:54 +0000
commit2defe5cdd7c71b81da3f385c2ed78deb6e1a48df (patch)
tree74398c18d47851594823af1b0424cd8b0b35c11b /sys/net/if.c
parentb525621aedbc2411d85a5826561d57221e9f54f4 (diff)
downloadsrc-2defe5cdd7c71b81da3f385c2ed78deb6e1a48df.tar.gz
src-2defe5cdd7c71b81da3f385c2ed78deb6e1a48df.zip
Fix sense of comparison in space test. Also eliminate a compile
warning and remove a previously existing off-by-one error.
Notes
Notes: svn path=/head/; revision=83184
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index ecce0bbb787b..5a2ad618ac95 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -708,7 +708,7 @@ ifaof_ifpforaddr(addr, ifp)
if (ifa->ifa_netmask == 0) {
if (equal(addr, ifa->ifa_addr) ||
(ifa->ifa_dstaddr && equal(addr, ifa->ifa_dstaddr)))
- return (ifa);
+ goto done;
continue;
}
if (ifp->if_flags & IFF_POINTOPOINT) {
@@ -723,7 +723,7 @@ ifaof_ifpforaddr(addr, ifp)
if ((*cp++ ^ *cp2++) & *cp3)
break;
if (cp3 == cplim)
- return (ifa);
+ goto done;
}
}
ifa = ifa_maybe;
@@ -1285,9 +1285,8 @@ ifconf(cmd, data)
char workbuf[64];
int ifnlen, addrs;
- if (space > sizeof(ifr))
+ if (space < sizeof(ifr))
break;
-
ifnlen = snprintf(workbuf, sizeof(workbuf),
"%s%d", ifp->if_name, ifp->if_unit);
if(ifnlen + 1 > sizeof ifr.ifr_name) {
@@ -1298,10 +1297,11 @@ ifconf(cmd, data)
}
addrs = 0;
- ifa = TAILQ_FIRST(&ifp->if_addrhead);
- for ( ; space > sizeof (ifr) && ifa;
- ifa = TAILQ_NEXT(ifa, ifa_link)) {
- register struct sockaddr *sa = ifa->ifa_addr;
+ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
+ struct sockaddr *sa = ifa->ifa_addr;
+
+ if (space < sizeof(ifr))
+ break;
if (jailed(curproc->p_ucred) &&
prison_if(curproc->p_ucred, sa))
continue;