$OpenBSD: patch-src_sysdeps_bsd-net-open_c,v 1.4 2004/08/13 00:18:24 naddy Exp $
--- src/sysdeps/bsd-net-open.c.orig	Sat May  1 19:46:38 2004
+++ src/sysdeps/bsd-net-open.c	Thu Aug 12 23:06:35 2004
@@ -85,7 +85,7 @@ gkrellm_sys_disk_read_data(void)
 		/* Separate read/write stats were implemented in NetBSD 1.6K.
 		*/
 
-#if __NetBSD_Version__ >= 106110000
+#if (__NetBSD_Version__ >= 106110000) || defined(__OpenBSD__)
 		rbytes = d.dk_rbytes;
 		wbytes = d.dk_wbytes;
 #else
@@ -154,7 +154,7 @@ gkrellm_sys_inet_read_tcp_data(void)
    ActiveTCP tcp;
    gint	tcp_status;
    struct inpcbtable table;
-   struct inpcb inpcb, *next;
+   struct inpcb inpcb, *head, *next;
    struct tcpcb tcpcb;
    static struct nlist nl[] = {
 #define X_TCBTABLE    0
@@ -171,8 +171,11 @@ gkrellm_sys_inet_read_tcp_data(void)
 		sizeof(struct inpcbtable)) != sizeof(struct inpcbtable))
       return;
 
+   head = (struct inpcb *)
+       &((struct inpcbtable *)nl[X_TCBTABLE].n_value)->inpt_queue.cqh_first;
    next = (struct inpcb *)table.inpt_queue.cqh_first;
-   while(next != NULL) {
+
+   while(next != head) {
       
       if (kvm_read(kvmd, (u_long)next,
 		   (char *)&inpcb, sizeof(inpcb)) == sizeof(inpcb) &&
