pointer is forthcoming.
-/* $OpenBSD: inet.c,v 1.127 2013/12/23 22:39:50 tedu Exp $ */
+/* $OpenBSD: inet.c,v 1.128 2013/12/24 22:26:19 tedu Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
istcp = strcmp(name, "tcp") == 0;
israw = strncmp(name, "ip", 2) == 0;
kread(off, &table, sizeof table);
- prev = next = TAILQ_FIRST(&table.inpt_queue);
+ prev = NULL;
+ next = TAILQ_FIRST(&table.inpt_queue);
while (next != NULL) {
kread((u_long)next, &inpcb, sizeof inpcb);
- if (TAILQ_PREV(&inpcb, inpthead, inp_queue) != prev) {
- printf("???\n");
- break;
- }
prev = next;
next = TAILQ_NEXT(&inpcb, inp_queue);
-/* $OpenBSD: netstat.c,v 1.37 2013/12/20 02:04:09 krw Exp $ */
+/* $OpenBSD: netstat.c,v 1.38 2013/12/24 22:26:20 tedu Exp $ */
/* $NetBSD: netstat.c,v 1.3 1995/06/18 23:53:07 cgd Exp $ */
/*-
read_ns(void)
{
struct inpcbtable pcbtable;
- struct inpcb *head, *prev, *next;
+ struct inpcb *next;
struct inpcb inpcb;
struct socket sockb;
struct tcpcb tcpcb;
again:
KREAD(off, &pcbtable, sizeof (struct inpcbtable));
- prev = head = (struct inpcb *)&((struct inpcbtable *)off)->inpt_queue;
next = TAILQ_FIRST(&pcbtable.inpt_queue);
- while (next != head) {
+ while (next != NULL) {
KREAD(next, &inpcb, sizeof (inpcb));
- if (TAILQ_PREV(&inpcb, inpthead, inp_queue) != prev) {
- error("Kernel state in transition");
- return 0;
- }
- prev = next;
next = TAILQ_NEXT(&inpcb, inp_queue);
if (!aflag) {
kfind_tcb(int sock)
{
struct inpcbtable tcbtab;
- struct inpcb *head, *next, *prev;
+ struct inpcb *next, *prev;
struct inpcb inpcb;
struct tcpcb tcpcb;
fprintf(stderr, "Using PCB table at %lu\n", ptb->ktcbtab);
retry:
kget(ptb->ktcbtab, &tcbtab, sizeof(tcbtab));
- prev = head = (struct inpcb *)&TAILQ_FIRST(
- &((struct inpcbtable *)ptb->ktcbtab)->inpt_queue);
+ prev = NULL;
next = TAILQ_FIRST(&tcbtab.inpt_queue);
if (ptb->vflag >= 2)
- fprintf(stderr, "PCB head at %p\n", head);
- while (next != head) {
+ fprintf(stderr, "PCB start at %p\n", next);
+ while (next != NULL) {
if (ptb->vflag >= 2)
fprintf(stderr, "Checking PCB %p\n", next);
kget((u_long)next, &inpcb, sizeof(inpcb));
- if (TAILQ_PREV(&inpcb, inpthead, inp_queue) != prev) {
- if (nretry--) {
- warnx("pcb prev pointer insane");
- goto retry;
- } else
- errx(1, "pcb prev pointer insane,"
- " all attempts exausted");
- }
prev = next;
next = TAILQ_NEXT(&inpcb, inp_queue);