Index: lwip/src/core/netif.c =================================================================== RCS file: /home/ianw/cvs/lwip/lwip/src/core/netif.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- lwip/src/core/netif.c 4 Feb 2004 01:40:42 -0000 1.1.1.1 +++ lwip/src/core/netif.c 4 Feb 2004 02:21:34 -0000 1.2 @@ -186,7 +186,7 @@ pcb = pcb->next; } } - for (lpcb = tcp_listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { /* PCB bound to current local interface address? */ if (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr))) { /* The PCB is listening to the old ipaddr and Index: lwip/src/core/tcp.c =================================================================== RCS file: /home/ianw/cvs/lwip/lwip/src/core/tcp.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- lwip/src/core/tcp.c 4 Feb 2004 01:40:42 -0000 1.1.1.1 +++ lwip/src/core/tcp.c 4 Feb 2004 02:21:34 -0000 1.2 @@ -62,7 +62,9 @@ { 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7}; /* The TCP PCB lists. */ -struct tcp_pcb_listen *tcp_listen_pcbs; /* List of all TCP PCBs in LISTEN state. */ + +/* List of all TCP PCBs in LISTEN state. */ +union tcp_listen_pcbs_t tcp_listen_pcbs; struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a state in which they accept or send data. */ @@ -85,7 +87,7 @@ tcp_init(void) { /* Clear globals. */ - tcp_listen_pcbs = NULL; + tcp_listen_pcbs.listen_pcbs = NULL; tcp_active_pcbs = NULL; tcp_tw_pcbs = NULL; tcp_tmp_pcb = NULL; @@ -136,7 +138,7 @@ switch (pcb->state) { case LISTEN: err = ERR_OK; - tcp_pcb_remove((struct tcp_pcb **)&tcp_listen_pcbs, pcb); + tcp_pcb_remove((struct tcp_pcb **)&tcp_listen_pcbs.pcbs, pcb); memp_free(MEMP_TCP_PCB_LISTEN, pcb); pcb = NULL; break; @@ -251,7 +253,7 @@ } #ifndef SO_REUSE /* Check if the address already is in use. */ - for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs; + for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; cpcb != NULL; cpcb = cpcb->next) { if (cpcb->local_port == port) { if (ip_addr_isany(&(cpcb->local_ip)) || @@ -284,7 +286,7 @@ When the two options aren't set and specified port is already bound, ERR_USE is returned saying that address is already in use. */ - for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs; cpcb != NULL; cpcb = cpcb->next) { + for(cpcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; cpcb != NULL; cpcb = cpcb->next) { if(cpcb->local_port == port) { if(ip_addr_cmp(&(cpcb->local_ip), ipaddr)) { if(pcb->so_options & SOF_REUSEPORT) { @@ -421,7 +423,7 @@ #if LWIP_CALLBACK_API lpcb->accept = tcp_accept_null; #endif /* LWIP_CALLBACK_API */ - TCP_REG(&tcp_listen_pcbs, lpcb); + TCP_REG(&tcp_listen_pcbs.listen_pcbs, lpcb); return (struct tcp_pcb *)lpcb; } @@ -483,7 +485,7 @@ goto again; } } - for(pcb = (struct tcp_pcb *)tcp_listen_pcbs; pcb != NULL; pcb = pcb->next) { + for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) { if (pcb->local_port == port) { goto again; } @@ -1253,7 +1255,7 @@ tcp_debug_print_state(pcb->state); } LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n")); - for(pcb = (struct tcp_pcb *)tcp_listen_pcbs; pcb != NULL; pcb = pcb->next) { + for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) { LWIP_DEBUGF(TCP_DEBUG, ("Local port %u, foreign port %u snd_nxt %lu rcv_nxt %lu ", pcb->local_port, pcb->remote_port, pcb->snd_nxt, pcb->rcv_nxt)); Index: lwip/src/core/tcp_in.c =================================================================== RCS file: /home/ianw/cvs/lwip/lwip/src/core/tcp_in.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- lwip/src/core/tcp_in.c 4 Feb 2004 01:40:42 -0000 1.1.1.1 +++ lwip/src/core/tcp_in.c 4 Feb 2004 02:21:34 -0000 1.2 @@ -255,7 +255,7 @@ /* Finally, if we still did not get a match, we check all PCBs that are LISTENing for incoming connections. */ prev = NULL; - for(lpcb = tcp_listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { if ((ip_addr_isany(&(lpcb->local_ip)) || ip_addr_cmp(&(lpcb->local_ip), &(iphdr->dest))) && lpcb->local_port == tcphdr->dest) { @@ -265,9 +265,9 @@ if (prev != NULL) { ((struct tcp_pcb_listen *)prev)->next = lpcb->next; /* our successor is the remainder of the listening list */ - lpcb->next = tcp_listen_pcbs; + lpcb->next = tcp_listen_pcbs.listen_pcbs; /* put this listening pcb at the head of the listening list */ - tcp_listen_pcbs = lpcb; + tcp_listen_pcbs.listen_pcbs = lpcb; } LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n")); Index: lwip/src/include/lwip/tcp.h =================================================================== RCS file: /home/ianw/cvs/lwip/lwip/src/include/lwip/tcp.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- lwip/src/include/lwip/tcp.h 4 Feb 2004 01:40:42 -0000 1.1.1.1 +++ lwip/src/include/lwip/tcp.h 4 Feb 2004 02:21:39 -0000 1.2 @@ -457,7 +457,11 @@ #endif /* The TCP PCB lists. */ -extern struct tcp_pcb_listen *tcp_listen_pcbs; /* List of all TCP PCBs in LISTEN state. */ +union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */ + struct tcp_pcb_listen *listen_pcbs; + struct tcp_pcb *pcbs; +}; +extern union tcp_listen_pcbs_t tcp_listen_pcbs; extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a state in which they accept or send data. */