From aa0485c22be44d024eac93dcbe7efbb48dcc55b2 Mon Sep 17 00:00:00 2001 From: rwatson Date: Sun, 26 Mar 2006 15:41:44 +0000 Subject: [PATCH] Add a new ipxpcb flag, IPXP_SPX, which is set on ipxpcb's to mark them as belonging to SPX. This replaces the implicit assumption that the cb pointer for non-SPX pcb's will be NULL. This isn't required in TCP/IP as different pcb lists are maintained for different IP protocols; IPX stores all pcbs on the same global ipxpcb_list. Foot provided by: gnn MFC after: 1 month --- sys/netipx/ipx_pcb.h | 1 + sys/netipx/spx_usrreq.c | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/sys/netipx/ipx_pcb.h b/sys/netipx/ipx_pcb.h index 86071c1a1321..51fbdeab83ed 100644 --- a/sys/netipx/ipx_pcb.h +++ b/sys/netipx/ipx_pcb.h @@ -77,6 +77,7 @@ extern struct mtx ipxpcb_list_mtx; #define IPXP_ALL_PACKETS 0x8 /* Turn off higher proto processing. */ #define IPXP_CHECKSUM 0x10 /* Use checksum on this socket. */ #define IPXP_DROPPED 0x20 /* Connection dropped. */ +#define IPXP_SPX 0x40 /* SPX PCB. */ #define IPX_WILDCARD 1 diff --git a/sys/netipx/spx_usrreq.c b/sys/netipx/spx_usrreq.c index dad3cd934a84..4b1da0415642 100644 --- a/sys/netipx/spx_usrreq.c +++ b/sys/netipx/spx_usrreq.c @@ -1389,6 +1389,7 @@ spx_attach(struct socket *so, int proto, struct thread *td) return (error); } ipxp = sotoipxpcb(so); + ipxp->ipxp_flags |= IPXP_SPX; cb->s_ipx = mtod(mm, struct ipx *); cb->s_state = TCPS_LISTEN; @@ -1841,14 +1842,17 @@ spx_fasttimo(void) IPX_LIST_LOCK(); LIST_FOREACH(ipxp, &ipxpcb_list, ipxp_list) { IPX_LOCK(ipxp); - if (!(ipxp->ipxp_flags & IPXP_DROPPED)) { - cb = ipxtospxpcb(ipxp); - if (cb->s_flags & SF_DELACK) { - cb->s_flags &= ~SF_DELACK; - cb->s_flags |= SF_ACKNOW; - spxstat.spxs_delack++; - spx_output(cb, NULL); - } + if (!(ipxp->ipxp_flags & IPXP_SPX) || + (ipxp->ipxp_flags & IPXP_DROPPED)) { + IPX_UNLOCK(ipxp); + continue; + } + cb = ipxtospxpcb(ipxp); + if (cb->s_flags & SF_DELACK) { + cb->s_flags &= ~SF_DELACK; + cb->s_flags |= SF_ACKNOW; + spxstat.spxs_delack++; + spx_output(cb, NULL); } IPX_UNLOCK(ipxp); } @@ -1873,7 +1877,8 @@ spx_slowtimo(void) IPX_LIST_LOCK(); LIST_FOREACH(ipxp, &ipxpcb_list, ipxp_list) { IPX_LOCK(ipxp); - if (ipxp->ipxp_flags & IPXP_DROPPED) { + if (!(ipxp->ipxp_flags & IPXP_SPX) || + (ipxp->ipxp_flags & IPXP_DROPPED)) { IPX_UNLOCK(ipxp); continue; }