diff options
author | jlemon <jlemon@FreeBSD.org> | 2001-09-07 05:32:54 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2001-09-07 05:32:54 +0000 |
commit | fad843fe5a1e0e1634a83728ae987d08b0235f0f (patch) | |
tree | 74398c18d47851594823af1b0424cd8b0b35c11b /sys/net | |
parent | cb3e386fb281ad7c4dad9e4bd11412ba4adbc768 (diff) | |
download | FreeBSD-src-fad843fe5a1e0e1634a83728ae987d08b0235f0f.zip FreeBSD-src-fad843fe5a1e0e1634a83728ae987d08b0235f0f.tar.gz |
Fix sense of comparison in space test. Also eliminate a compile
warning and remove a previously existing off-by-one error.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index ecce0bb..5a2ad61 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; |