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
This commit is contained in:
Robert Watson 2006-03-26 15:41:44 +00:00
parent 49874f6ea3
commit 722542bc34
2 changed files with 15 additions and 9 deletions

View File

@ -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

View File

@ -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;
}