diff options
| author | matt <matt@NetBSD.org> | 2001-11-04 20:55:25 +0000 |
|---|---|---|
| committer | matt <matt@NetBSD.org> | 2001-11-04 20:55:25 +0000 |
| commit | da5a70805c8bc9b5b8a896516b5bd8bfd0948844 (patch) | |
| tree | b6a322981be1166580c82305db649b8e2a8283d0 /sys/netinet/ip_input.c | |
| parent | 8fef52258f7a11c42c20cb77e8b45d6eaa34b87f (diff) | |
Convert netinet to not use the internal <sys/queue.h> field names
but instead the access macros. Use the FOREACH macros where appropriate.
Diffstat (limited to 'sys/netinet/ip_input.c')
| -rw-r--r-- | sys/netinet/ip_input.c | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 79febc81421..1009b1f0a8b 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.139 2001/11/04 13:42:27 matt Exp $ */ +/* $NetBSD: ip_input.c,v 1.140 2001/11/04 20:55:27 matt Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -410,7 +410,7 @@ ip_input(struct mbuf *m) * If no IP addresses have been set yet but the interfaces * are receiving, can't do anything with incoming packets yet. */ - if (in_ifaddr.tqh_first == 0) + if (TAILQ_FIRST(&in_ifaddr) == 0) goto bad; ipstat.ips_total++; if (m->m_len < sizeof (struct ip) && @@ -573,9 +573,7 @@ ip_input(struct mbuf *m) * as not mine. */ downmatch = 0; - for (ia = IN_IFADDR_HASH(ip->ip_dst.s_addr).lh_first; - ia != NULL; - ia = ia->ia_hash.le_next) { + LIST_FOREACH(ia, &IN_IFADDR_HASH(ip->ip_dst.s_addr), ia_hash) { if (in_hosteq(ia->ia_addr.sin_addr, ip->ip_dst)) { if ((ia->ia_ifp->if_flags & IFF_UP) != 0) break; @@ -586,9 +584,9 @@ ip_input(struct mbuf *m) if (ia != NULL) goto ours; if (m->m_pkthdr.rcvif->if_flags & IFF_BROADCAST) { - for (ifa = m->m_pkthdr.rcvif->if_addrlist.tqh_first; - ifa != NULL; ifa = ifa->ifa_list.tqe_next) { - if (ifa->ifa_addr->sa_family != AF_INET) continue; + TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrlist, ifa_list) { + if (ifa->ifa_addr->sa_family != AF_INET) + continue; ia = ifatoia(ifa); if (in_hosteq(ip->ip_dst, ia->ia_broadaddr.sin_addr) || in_hosteq(ip->ip_dst, ia->ia_netbroadcast) || @@ -701,7 +699,7 @@ ours: * of this datagram. */ IPQ_LOCK(); - for (fp = ipq.lh_first; fp != NULL; fp = fp->ipq_q.le_next) + LIST_FOREACH(fp, &ipq, ipq_q) if (ip->ip_id == fp->ipq_id && in_hosteq(ip->ip_src, fp->ipq_src) && in_hosteq(ip->ip_dst, fp->ipq_dst) && @@ -857,8 +855,8 @@ ip_reass(ipqe, fp) /* * Find a segment which begins after this one does. */ - for (p = NULL, q = fp->ipq_fragq.lh_first; q != NULL; - p = q, q = q->ipqe_q.le_next) + for (p = NULL, q = LIST_FIRST(&fp->ipq_fragq); q != NULL; + p = q, q = LIST_NEXT(q, ipqe_q)) if (q->ipqe_ip->ip_off > ipqe->ipqe_ip->ip_off) break; @@ -893,7 +891,7 @@ ip_reass(ipqe, fp) m_adj(q->ipqe_m, i); break; } - nq = q->ipqe_q.le_next; + nq = LIST_NEXT(q, ipqe_q); m_freem(q->ipqe_m); LIST_REMOVE(q, ipqe_q); pool_put(&ipqent_pool, q); @@ -910,8 +908,8 @@ insert: LIST_INSERT_AFTER(p, ipqe, ipqe_q); } next = 0; - for (p = NULL, q = fp->ipq_fragq.lh_first; q != NULL; - p = q, q = q->ipqe_q.le_next) { + for (p = NULL, q = LIST_FIRST(&fp->ipq_fragq); q != NULL; + p = q, q = LIST_NEXT(q, ipqe_q)) { if (q->ipqe_ip->ip_off != next) return (0); next += q->ipqe_ip->ip_len; @@ -923,7 +921,7 @@ insert: * Reassembly is complete. Check for a bogus message size and * concatenate fragments. */ - q = fp->ipq_fragq.lh_first; + q = LIST_FIRST(&fp->ipq_fragq); ip = q->ipqe_ip; if ((next + (ip->ip_hl << 2)) > IP_MAXPACKET) { ipstat.ips_toolong++; @@ -934,11 +932,11 @@ insert: t = m->m_next; m->m_next = 0; m_cat(m, t); - nq = q->ipqe_q.le_next; + nq = LIST_NEXT(q, ipqe_q); pool_put(&ipqent_pool, q); for (q = nq; q != NULL; q = nq) { t = q->ipqe_m; - nq = q->ipqe_q.le_next; + nq = LIST_NEXT(q, ipqe_q); pool_put(&ipqent_pool, q); m_cat(m, t); } @@ -985,8 +983,8 @@ ip_freef(fp) IPQ_LOCK_CHECK(); - for (q = fp->ipq_fragq.lh_first; q != NULL; q = p) { - p = q->ipqe_q.le_next; + for (q = LIST_FIRST(&fp->ipq_fragq); q != NULL; q = p) { + p = LIST_NEXT(q, ipqe_q); m_freem(q->ipqe_m); LIST_REMOVE(q, ipqe_q); pool_put(&ipqent_pool, q); @@ -1008,8 +1006,8 @@ ip_slowtimo() int s = splsoftnet(); IPQ_LOCK(); - for (fp = ipq.lh_first; fp != NULL; fp = nfp) { - nfp = fp->ipq_q.le_next; + for (fp = LIST_FIRST(&ipq); fp != NULL; fp = nfp) { + nfp = LIST_NEXT(fp, ipq_q); if (--fp->ipq_ttl == 0) { ipstat.ips_fragtimeout++; ip_freef(fp); @@ -1023,8 +1021,8 @@ ip_slowtimo() if (ip_maxfragpackets < 0) ; else { - while (ip_nfragpackets > ip_maxfragpackets && ipq.lh_first) - ip_freef(ipq.lh_first); + while (ip_nfragpackets > ip_maxfragpackets && LIST_FIRST(&ipq)) + ip_freef(LIST_FIRST(&ipq)); } IPQ_UNLOCK(); #ifdef GATEWAY @@ -1047,9 +1045,9 @@ ip_drain() if (ipq_lock_try() == 0) return; - while (ipq.lh_first != NULL) { + while (LIST_FIRST(&ipq) != NULL) { ipstat.ips_fragdropped++; - ip_freef(ipq.lh_first); + ip_freef(LIST_FIRST(&ipq)); } IPQ_UNLOCK(); |
