diff options
author | 2013-12-20 02:04:08 +0000 | |
---|---|---|
committer | 2013-12-20 02:04:08 +0000 | |
commit | 6e324f49479260f2fc95ef7c90e7619c112916c8 (patch) | |
tree | 5d10f81e83fc9001da1aacfb771a7ad3ff9514b5 | |
parent | delete 4 includes we do not need (diff) | |
download | wireguard-openbsd-6e324f49479260f2fc95ef7c90e7619c112916c8.tar.xz wireguard-openbsd-6e324f49479260f2fc95ef7c90e7619c112916c8.zip |
Switch inpt_queue from CIRCLEQ to TAILQ. Thus ending use of CIRCLEQ
in the base. Ports fixes to follow shortly for the two ports (gkrellm
and net-snmp) affected.
ok zhuk@ millert@
-rw-r--r-- | sys/netinet/in_pcb.c | 22 | ||||
-rw-r--r-- | sys/netinet/in_pcb.h | 6 | ||||
-rw-r--r-- | sys/netinet/ip_divert.c | 6 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 4 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 4 | ||||
-rw-r--r-- | sys/netinet6/icmp6.c | 4 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.c | 7 | ||||
-rw-r--r-- | sys/netinet6/ip6_divert.c | 6 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 4 | ||||
-rw-r--r-- | usr.bin/netstat/inet.c | 10 | ||||
-rw-r--r-- | usr.bin/systat/netstat.c | 8 | ||||
-rw-r--r-- | usr.bin/tcpbench/tcpbench.c | 8 |
12 files changed, 40 insertions, 49 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index bf1a5208c8b..0c57d1140b4 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.145 2013/10/23 19:57:49 deraadt Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.146 2013/12/20 02:04:08 krw Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -134,7 +134,7 @@ void in_pcbinit(struct inpcbtable *table, int hashsize) { - CIRCLEQ_INIT(&table->inpt_queue); + TAILQ_INIT(&table->inpt_queue); table->inpt_hashtbl = hashinit(hashsize, M_PCB, M_NOWAIT, &table->inpt_hash); if (table->inpt_hashtbl == NULL) @@ -191,7 +191,7 @@ in_pcballoc(struct socket *so, struct inpcbtable *table) inp->inp_seclevel[SL_IPCOMP] = IPSEC_IPCOMP_LEVEL_DEFAULT; inp->inp_rtableid = curproc->p_p->ps_rtableid; s = splnet(); - CIRCLEQ_INSERT_HEAD(&table->inpt_queue, inp, inp_queue); + TAILQ_INSERT_HEAD(&table->inpt_queue, inp, inp_queue); LIST_INSERT_HEAD(INPCBLHASH(table, inp->inp_lport, inp->inp_rtableid), inp, inp_lhash); LIST_INSERT_HEAD(INPCBHASH(table, &inp->inp_faddr, inp->inp_fport, @@ -501,7 +501,7 @@ in_pcbdetach(struct inpcb *inp) s = splnet(); LIST_REMOVE(inp, inp_lhash); LIST_REMOVE(inp, inp_hash); - CIRCLEQ_REMOVE(&inp->inp_table->inpt_queue, inp, inp_queue); + TAILQ_REMOVE(&inp->inp_table->inpt_queue, inp, inp_queue); splx(s); pool_put(&inpcb_pool, inp); } @@ -555,7 +555,7 @@ void in_pcbnotifyall(struct inpcbtable *table, struct sockaddr *dst, u_int rdomain, int errno, void (*notify)(struct inpcb *, int)) { - struct inpcb *inp, *oinp; + struct inpcb *inp, *ninp; struct in_addr faddr; splsoftassert(IPL_SOFTNET); @@ -575,24 +575,18 @@ in_pcbnotifyall(struct inpcbtable *table, struct sockaddr *dst, u_int rdomain, return; rdomain = rtable_l2(rdomain); - for (inp = CIRCLEQ_FIRST(&table->inpt_queue); - inp != CIRCLEQ_END(&table->inpt_queue);) { + TAILQ_FOREACH_SAFE(inp, &table->inpt_queue, inp_queue, ninp) { #ifdef INET6 - if (inp->inp_flags & INP_IPV6) { - inp = CIRCLEQ_NEXT(inp, inp_queue); + if (inp->inp_flags & INP_IPV6) continue; - } #endif if (inp->inp_faddr.s_addr != faddr.s_addr || rtable_l2(inp->inp_rtableid) != rdomain || inp->inp_socket == 0) { - inp = CIRCLEQ_NEXT(inp, inp_queue); continue; } - oinp = inp; - inp = CIRCLEQ_NEXT(inp, inp_queue); if (notify) - (*notify)(oinp, errno); + (*notify)(inp, errno); } } diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index fe0745c5dd4..185a41b4903 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.81 2013/10/23 19:57:50 deraadt Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.82 2013/12/20 02:04:08 krw Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -90,7 +90,7 @@ union inpaddru { struct inpcb { LIST_ENTRY(inpcb) inp_hash; LIST_ENTRY(inpcb) inp_lhash; /* extra hash for lport */ - CIRCLEQ_ENTRY(inpcb) inp_queue; + TAILQ_ENTRY(inpcb) inp_queue; struct inpcbtable *inp_table; union inpaddru inp_faddru; /* Foreign address. */ union inpaddru inp_laddru; /* Local address. */ @@ -154,7 +154,7 @@ struct inpcb { }; struct inpcbtable { - CIRCLEQ_HEAD(, inpcb) inpt_queue; + TAILQ_HEAD(inpthead, inpcb) inpt_queue; LIST_HEAD(inpcbhead, inpcb) *inpt_hashtbl, *inpt_lhashtbl; u_long inpt_hash, inpt_lhash; u_int16_t inpt_lastport; diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 60d1a9d512e..2296197ecbc 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_divert.c,v 1.14 2013/11/15 16:46:15 lteo Exp $ */ +/* $OpenBSD: ip_divert.c,v 1.15 2013/12/20 02:04:08 krw Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -221,7 +221,7 @@ divert_packet(struct mbuf *m, int dir) return (0); } - CIRCLEQ_FOREACH(inp, &divbtable.inpt_queue, inp_queue) { + TAILQ_FOREACH(inp, &divbtable.inpt_queue, inp_queue) { if (inp->inp_lport != divert->port) continue; if (inp->inp_divertfl == 0) @@ -254,7 +254,7 @@ divert_packet(struct mbuf *m, int dir) if (dir == PF_OUT) in_proto_cksum_out(m, NULL); - if (inp != CIRCLEQ_END(&divbtable.inpt_queue)) { + if (inp) { sa = inp->inp_socket; if (sbappendaddr(&sa->so_rcv, (struct sockaddr *)&addr, m, NULL) == 0) { diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 7478906d4f0..43680eba733 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.66 2013/04/10 08:50:59 mpi Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.67 2013/12/20 02:04:08 krw Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -127,7 +127,7 @@ rip_input(struct mbuf *m, ...) struct mbuf *opts = NULL; ripsrc.sin_addr = ip->ip_src; - CIRCLEQ_FOREACH(inp, &rawcbtable.inpt_queue, inp_queue) { + TAILQ_FOREACH(inp, &rawcbtable.inpt_queue, inp_queue) { if (inp->inp_socket->so_state & SS_CANTRCVMORE) continue; #ifdef INET6 diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index cce2b10495b..b498a1db8f3 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.171 2013/11/22 07:59:09 mpi Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.172 2013/12/20 02:04:08 krw Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -438,7 +438,7 @@ udp_input(struct mbuf *m, ...) * (Algorithm copied from raw_intr().) */ last = NULL; - CIRCLEQ_FOREACH(inp, &udbtable.inpt_queue, inp_queue) { + TAILQ_FOREACH(inp, &udbtable.inpt_queue, inp_queue) { if (inp->inp_socket->so_state & SS_CANTRCVMORE) continue; #ifdef INET6 diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index df5f129acbc..8173cb55b6b 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.136 2013/11/11 09:15:35 mpi Exp $ */ +/* $OpenBSD: icmp6.c,v 1.137 2013/12/20 02:04:08 krw Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1877,7 +1877,7 @@ icmp6_rip6_input(struct mbuf **mp, int off) /* KAME hack: recover scopeid */ (void)in6_recoverscope(&rip6src, &ip6->ip6_src, m->m_pkthdr.rcvif); - CIRCLEQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) { + TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) { if (!(in6p->inp_flags & INP_IPV6)) continue; if (in6p->inp_ipv6.ip6_nxt != IPPROTO_ICMPV6) diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 6061d25deb2..633b8586125 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.57 2013/10/20 11:03:02 phessler Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.58 2013/12/20 02:04:09 krw Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -526,10 +526,7 @@ in6_pcbnotify(struct inpcbtable *head, struct sockaddr_in6 *dst, } errno = inet6ctlerrmap[cmd]; - for (inp = CIRCLEQ_FIRST(&head->inpt_queue); - inp != CIRCLEQ_END(&head->inpt_queue); inp = ninp) { - ninp = CIRCLEQ_NEXT(inp, inp_queue); - + TAILQ_FOREACH_SAFE(inp, &head->inpt_queue, inp_queue, ninp) { if ((inp->inp_flags & INP_IPV6) == 0) continue; diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c index 445e3dd7fb9..d9dc3c0dcec 100644 --- a/sys/netinet6/ip6_divert.c +++ b/sys/netinet6/ip6_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.c,v 1.16 2013/11/22 07:59:09 mpi Exp $ */ +/* $OpenBSD: ip6_divert.c,v 1.17 2013/12/20 02:04:09 krw Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -217,7 +217,7 @@ divert6_packet(struct mbuf *m, int dir) return (0); } - CIRCLEQ_FOREACH(inp, &divb6table.inpt_queue, inp_queue) { + TAILQ_FOREACH(inp, &divb6table.inpt_queue, inp_queue) { if (inp->inp_lport != divert->port) continue; if (inp->inp_divertfl == 0) @@ -249,7 +249,7 @@ divert6_packet(struct mbuf *m, int dir) if (dir == PF_OUT) in6_proto_cksum_out(m, NULL); - if (inp != CIRCLEQ_END(&divb6table.inpt_queue)) { + if (inp) { sa = inp->inp_socket; if (sbappendaddr(&sa->so_rcv, sin6tosa(&addr), m, NULL) == 0) { div6stat.divs_fullsock++; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index a0fc81ca57a..80f8e9af9f3 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.62 2013/11/22 07:59:09 mpi Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.63 2013/12/20 02:04:09 krw Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -146,7 +146,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto) /* KAME hack: recover scopeid */ (void)in6_recoverscope(&rip6src, &ip6->ip6_src, m->m_pkthdr.rcvif); - CIRCLEQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) { + TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) { if (in6p->inp_socket->so_state & SS_CANTRCVMORE) continue; if (!(in6p->inp_flags & INP_IPV6)) diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 8b51c7ec77c..07444a98a22 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet.c,v 1.125 2013/10/24 09:33:20 deraadt Exp $ */ +/* $OpenBSD: inet.c,v 1.126 2013/12/20 02:04:09 krw Exp $ */ /* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */ /* @@ -125,17 +125,17 @@ protopr(u_long off, char *name, int af, u_int tableid, u_long pcbaddr) israw = strncmp(name, "ip", 2) == 0; kread(off, &table, sizeof table); prev = head = - (struct inpcb *)&CIRCLEQ_FIRST(&((struct inpcbtable *)off)->inpt_queue); - next = CIRCLEQ_FIRST(&table.inpt_queue); + (struct inpcb *)&TAILQ_FIRST(&((struct inpcbtable *)off)->inpt_queue); + next = TAILQ_FIRST(&table.inpt_queue); while (next != head) { kread((u_long)next, &inpcb, sizeof inpcb); - if (CIRCLEQ_PREV(&inpcb, inp_queue) != prev) { + if (TAILQ_PREV(&inpcb, inpthead, inp_queue) != prev) { printf("???\n"); break; } prev = next; - next = CIRCLEQ_NEXT(&inpcb, inp_queue); + next = TAILQ_NEXT(&inpcb, inp_queue); switch (af) { case AF_INET: diff --git a/usr.bin/systat/netstat.c b/usr.bin/systat/netstat.c index 5ad3ebd27ce..652aa32f94d 100644 --- a/usr.bin/systat/netstat.c +++ b/usr.bin/systat/netstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netstat.c,v 1.36 2013/03/20 06:55:24 deraadt Exp $ */ +/* $OpenBSD: netstat.c,v 1.37 2013/12/20 02:04:09 krw Exp $ */ /* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */ /*- @@ -263,16 +263,16 @@ again: KREAD(off, &pcbtable, sizeof (struct inpcbtable)); prev = head = (struct inpcb *)&((struct inpcbtable *)off)->inpt_queue; - next = CIRCLEQ_FIRST(&pcbtable.inpt_queue); + next = TAILQ_FIRST(&pcbtable.inpt_queue); while (next != head) { KREAD(next, &inpcb, sizeof (inpcb)); - if (CIRCLEQ_PREV(&inpcb, inp_queue) != prev) { + if (TAILQ_PREV(&inpcb, inpthead, inp_queue) != prev) { error("Kernel state in transition"); return 0; } prev = next; - next = CIRCLEQ_NEXT(&inpcb, inp_queue); + next = TAILQ_NEXT(&inpcb, inp_queue); if (!aflag) { if (!(inpcb.inp_flags & INP_IPV6) && diff --git a/usr.bin/tcpbench/tcpbench.c b/usr.bin/tcpbench/tcpbench.c index f6c000cbf8d..ce295c5319d 100644 --- a/usr.bin/tcpbench/tcpbench.c +++ b/usr.bin/tcpbench/tcpbench.c @@ -322,9 +322,9 @@ kfind_tcb(int sock) fprintf(stderr, "Using PCB table at %lu\n", ptb->ktcbtab); retry: kget(ptb->ktcbtab, &tcbtab, sizeof(tcbtab)); - prev = head = (struct inpcb *)&CIRCLEQ_FIRST( + prev = head = (struct inpcb *)&TAILQ_FIRST( &((struct inpcbtable *)ptb->ktcbtab)->inpt_queue); - next = CIRCLEQ_FIRST(&tcbtab.inpt_queue); + next = TAILQ_FIRST(&tcbtab.inpt_queue); if (ptb->vflag >= 2) fprintf(stderr, "PCB head at %p\n", head); @@ -332,7 +332,7 @@ retry: if (ptb->vflag >= 2) fprintf(stderr, "Checking PCB %p\n", next); kget((u_long)next, &inpcb, sizeof(inpcb)); - if (CIRCLEQ_PREV(&inpcb, inp_queue) != prev) { + if (TAILQ_PREV(&inpcb, inpthead, inp_queue) != prev) { if (nretry--) { warnx("pcb prev pointer insane"); goto retry; @@ -341,7 +341,7 @@ retry: " all attempts exausted"); } prev = next; - next = CIRCLEQ_NEXT(&inpcb, inp_queue); + next = TAILQ_NEXT(&inpcb, inp_queue); if (me.ss_family == AF_INET) { if ((inpcb.inp_flags & INP_IPV6) != 0) { |