Deleted Added
full compact
spx_usrreq.c (95759) spx_usrreq.c (96972)
1/*
2 * Copyright (c) 1995, Mike Mitchell
3 * Copyright (c) 1984, 1985, 1986, 1987, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 19 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)spx_usrreq.h
35 *
1/*
2 * Copyright (c) 1995, Mike Mitchell
3 * Copyright (c) 1984, 1985, 1986, 1987, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 19 unchanged lines hidden (view full) ---

28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)spx_usrreq.h
35 *
36 * $FreeBSD: head/sys/netipx/spx_usrreq.c 95759 2002-04-30 01:54:54Z tanimura $
36 * $FreeBSD: head/sys/netipx/spx_usrreq.c 96972 2002-05-20 05:41:09Z tanimura $
37 */
38
39#include <sys/param.h>
40#include <sys/lock.h>
41#include <sys/malloc.h>
42#include <sys/mbuf.h>
43#include <sys/mutex.h>
44#include <sys/proc.h>

--- 113 unchanged lines hidden (view full) ---

158 si = mtod(m, struct spx *);
159 }
160 si->si_seq = ntohs(si->si_seq);
161 si->si_ack = ntohs(si->si_ack);
162 si->si_alo = ntohs(si->si_alo);
163
164 so = ipxp->ipxp_socket;
165
37 */
38
39#include <sys/param.h>
40#include <sys/lock.h>
41#include <sys/malloc.h>
42#include <sys/mbuf.h>
43#include <sys/mutex.h>
44#include <sys/proc.h>

--- 113 unchanged lines hidden (view full) ---

158 si = mtod(m, struct spx *);
159 }
160 si->si_seq = ntohs(si->si_seq);
161 si->si_ack = ntohs(si->si_ack);
162 si->si_alo = ntohs(si->si_alo);
163
164 so = ipxp->ipxp_socket;
165
166 SOCK_LOCK(so);
166 if (so->so_options & SO_DEBUG || traceallspxs) {
167 ostate = cb->s_state;
168 spx_savesi = *si;
169 }
170 if (so->so_options & SO_ACCEPTCONN) {
171 struct spxpcb *ocb = cb;
172
167 if (so->so_options & SO_DEBUG || traceallspxs) {
168 ostate = cb->s_state;
169 spx_savesi = *si;
170 }
171 if (so->so_options & SO_ACCEPTCONN) {
172 struct spxpcb *ocb = cb;
173
174 SOCK_UNLOCK(so);
173 so = sonewconn(so, 0);
174 if (so == NULL) {
175 goto drop;
176 }
177 /*
178 * This is ugly, but ....
179 *
180 * Mark socket as temporary until we're

--- 7 unchanged lines hidden (view full) ---

188 dropsocket++;
189 ipxp = (struct ipxpcb *)so->so_pcb;
190 ipxp->ipxp_laddr = si->si_dna;
191 cb = ipxtospxpcb(ipxp);
192 cb->s_mtu = ocb->s_mtu; /* preserve sockopts */
193 cb->s_flags = ocb->s_flags; /* preserve sockopts */
194 cb->s_flags2 = ocb->s_flags2; /* preserve sockopts */
195 cb->s_state = TCPS_LISTEN;
175 so = sonewconn(so, 0);
176 if (so == NULL) {
177 goto drop;
178 }
179 /*
180 * This is ugly, but ....
181 *
182 * Mark socket as temporary until we're

--- 7 unchanged lines hidden (view full) ---

190 dropsocket++;
191 ipxp = (struct ipxpcb *)so->so_pcb;
192 ipxp->ipxp_laddr = si->si_dna;
193 cb = ipxtospxpcb(ipxp);
194 cb->s_mtu = ocb->s_mtu; /* preserve sockopts */
195 cb->s_flags = ocb->s_flags; /* preserve sockopts */
196 cb->s_flags2 = ocb->s_flags2; /* preserve sockopts */
197 cb->s_state = TCPS_LISTEN;
196 }
198 } else
199 SOCK_UNLOCK(so);
197
198 /*
199 * Packet received on connection.
200 * reset idle time and keep-alive timer;
201 */
202 cb->s_idle = 0;
203 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
204

--- 48 unchanged lines hidden (view full) ---

253 if (si->si_did != cb->s_sid) {
254 spx_istat.wrncon++;
255 goto drop;
256 }
257#endif
258 ipxp->ipxp_fport = si->si_sport;
259 cb->s_timer[SPXT_REXMT] = 0;
260 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
200
201 /*
202 * Packet received on connection.
203 * reset idle time and keep-alive timer;
204 */
205 cb->s_idle = 0;
206 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
207

--- 48 unchanged lines hidden (view full) ---

256 if (si->si_did != cb->s_sid) {
257 spx_istat.wrncon++;
258 goto drop;
259 }
260#endif
261 ipxp->ipxp_fport = si->si_sport;
262 cb->s_timer[SPXT_REXMT] = 0;
263 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
264 SOCK_LOCK(so);
261 soisconnected(so);
265 soisconnected(so);
266 SOCK_UNLOCK(so);
262 cb->s_state = TCPS_ESTABLISHED;
263 spxstat.spxs_accepts++;
264 }
265 break;
266
267 /*
268 * This state means that we have gotten a response
269 * to our attempt to establish a connection.

--- 10 unchanged lines hidden (view full) ---

280 }
281 spxstat.spxs_connects++;
282 cb->s_did = si->si_sid;
283 cb->s_rack = si->si_ack;
284 cb->s_ralo = si->si_alo;
285 cb->s_dport = ipxp->ipxp_fport = si->si_sport;
286 cb->s_timer[SPXT_REXMT] = 0;
287 cb->s_flags |= SF_ACKNOW;
267 cb->s_state = TCPS_ESTABLISHED;
268 spxstat.spxs_accepts++;
269 }
270 break;
271
272 /*
273 * This state means that we have gotten a response
274 * to our attempt to establish a connection.

--- 10 unchanged lines hidden (view full) ---

285 }
286 spxstat.spxs_connects++;
287 cb->s_did = si->si_sid;
288 cb->s_rack = si->si_ack;
289 cb->s_ralo = si->si_alo;
290 cb->s_dport = ipxp->ipxp_fport = si->si_sport;
291 cb->s_timer[SPXT_REXMT] = 0;
292 cb->s_flags |= SF_ACKNOW;
293 SOCK_LOCK(so);
288 soisconnected(so);
294 soisconnected(so);
295 SOCK_UNLOCK(so);
289 cb->s_state = TCPS_ESTABLISHED;
290 /* Use roundtrip time of connection request for initial rtt */
291 if (cb->s_rtt) {
292 cb->s_srtt = cb->s_rtt << 3;
293 cb->s_rttvar = cb->s_rtt << 1;
294 SPXT_RANGESET(cb->s_rxtcur,
295 ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1,
296 SPXTV_MIN, SPXTV_REXMTMAX);
297 cb->s_rtt = 0;
298 }
299 }
296 cb->s_state = TCPS_ESTABLISHED;
297 /* Use roundtrip time of connection request for initial rtt */
298 if (cb->s_rtt) {
299 cb->s_srtt = cb->s_rtt << 3;
300 cb->s_rttvar = cb->s_rtt << 1;
301 SPXT_RANGESET(cb->s_rxtcur,
302 ((cb->s_srtt >> 2) + cb->s_rttvar) >> 1,
303 SPXTV_MIN, SPXTV_REXMTMAX);
304 cb->s_rtt = 0;
305 }
306 }
300 if (so->so_options & SO_DEBUG || traceallspxs)
307 SOCK_LOCK(so);
308 if (so->so_options & SO_DEBUG || traceallspxs) {
309 SOCK_UNLOCK(so);
301 spx_trace(SA_INPUT, (u_char)ostate, cb, &spx_savesi, 0);
310 spx_trace(SA_INPUT, (u_char)ostate, cb, &spx_savesi, 0);
311 } else
312 SOCK_UNLOCK(so);
302
303 m->m_len -= sizeof(struct ipx);
304 m->m_pkthdr.len -= sizeof(struct ipx);
305 m->m_data += sizeof(struct ipx);
306
307 if (spx_reass(cb, si)) {
308 m_freem(m);
309 }

--- 4 unchanged lines hidden (view full) ---

314
315dropwithreset:
316 if (dropsocket)
317 soabort(so);
318 si->si_seq = ntohs(si->si_seq);
319 si->si_ack = ntohs(si->si_ack);
320 si->si_alo = ntohs(si->si_alo);
321 m_freem(dtom(si));
313
314 m->m_len -= sizeof(struct ipx);
315 m->m_pkthdr.len -= sizeof(struct ipx);
316 m->m_data += sizeof(struct ipx);
317
318 if (spx_reass(cb, si)) {
319 m_freem(m);
320 }

--- 4 unchanged lines hidden (view full) ---

325
326dropwithreset:
327 if (dropsocket)
328 soabort(so);
329 si->si_seq = ntohs(si->si_seq);
330 si->si_ack = ntohs(si->si_ack);
331 si->si_alo = ntohs(si->si_alo);
332 m_freem(dtom(si));
322 if (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || traceallspxs)
333 SOCK_LOCK(cb->s_ipxpcb->ipxp_socket);
334 if (cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG || traceallspxs) {
335 SOCK_UNLOCK(cb->s_ipxpcb->ipxp_socket);
323 spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0);
336 spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0);
337 } else
338 SOCK_UNLOCK(cb->s_ipxpcb->ipxp_socket);
324 return;
325
326drop:
327bad:
339 return;
340
341drop:
342bad:
343 SOCK_LOCK(cb->s_ipxpcb->ipxp_socket);
328 if (cb == 0 || cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG ||
344 if (cb == 0 || cb->s_ipxpcb->ipxp_socket->so_options & SO_DEBUG ||
329 traceallspxs)
345 traceallspxs) {
346 SOCK_UNLOCK(cb->s_ipxpcb->ipxp_socket);
330 spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0);
347 spx_trace(SA_DROP, (u_char)ostate, cb, &spx_savesi, 0);
348 } else
349 SOCK_UNLOCK(cb->s_ipxpcb->ipxp_socket);
331 m_freem(m);
332}
333
334static int spxrexmtthresh = 3;
335
336/*
337 * This is structurally similar to the tcp reassembly routine
338 * but its function is somewhat different: It merely queues

--- 118 unchanged lines hidden (view full) ---

457 * Trim Acked data from output queue.
458 */
459 while ((m = so->so_snd.sb_mb) != NULL) {
460 if (SSEQ_LT((mtod(m, struct spx *))->si_seq, si->si_ack))
461 sbdroprecord(&so->so_snd);
462 else
463 break;
464 }
350 m_freem(m);
351}
352
353static int spxrexmtthresh = 3;
354
355/*
356 * This is structurally similar to the tcp reassembly routine
357 * but its function is somewhat different: It merely queues

--- 118 unchanged lines hidden (view full) ---

476 * Trim Acked data from output queue.
477 */
478 while ((m = so->so_snd.sb_mb) != NULL) {
479 if (SSEQ_LT((mtod(m, struct spx *))->si_seq, si->si_ack))
480 sbdroprecord(&so->so_snd);
481 else
482 break;
483 }
484 SOCK_LOCK(so);
465 sowwakeup(so);
485 sowwakeup(so);
486 SOCK_UNLOCK(so);
466 cb->s_rack = si->si_ack;
467update_window:
468 if (SSEQ_LT(cb->s_snxt, cb->s_rack))
469 cb->s_snxt = cb->s_rack;
470 if (SSEQ_LT(cb->s_swl1, si->si_seq) || ((cb->s_swl1 == si->si_seq &&
471 (SSEQ_LT(cb->s_swl2, si->si_ack))) ||
472 (cb->s_swl2 == si->si_ack && SSEQ_LT(cb->s_ralo, si->si_alo)))) {
473 /* keep track of pure window updates */

--- 22 unchanged lines hidden (view full) ---

496 spxstat.spxs_rcvpackafterwin++;
497 if (si->si_cc & SPX_OB) {
498 if (SSEQ_GT(si->si_seq, cb->s_alo + 60)) {
499 m_freem(dtom(si));
500 return (0);
501 } /* else queue this packet; */
502 } else {
503 /*register struct socket *so = cb->s_ipxpcb->ipxp_socket;
487 cb->s_rack = si->si_ack;
488update_window:
489 if (SSEQ_LT(cb->s_snxt, cb->s_rack))
490 cb->s_snxt = cb->s_rack;
491 if (SSEQ_LT(cb->s_swl1, si->si_seq) || ((cb->s_swl1 == si->si_seq &&
492 (SSEQ_LT(cb->s_swl2, si->si_ack))) ||
493 (cb->s_swl2 == si->si_ack && SSEQ_LT(cb->s_ralo, si->si_alo)))) {
494 /* keep track of pure window updates */

--- 22 unchanged lines hidden (view full) ---

517 spxstat.spxs_rcvpackafterwin++;
518 if (si->si_cc & SPX_OB) {
519 if (SSEQ_GT(si->si_seq, cb->s_alo + 60)) {
520 m_freem(dtom(si));
521 return (0);
522 } /* else queue this packet; */
523 } else {
524 /*register struct socket *so = cb->s_ipxpcb->ipxp_socket;
525 SOCK_LOCK(so);
504 if (so->so_state && SS_NOFDREF) {
526 if (so->so_state && SS_NOFDREF) {
527 SOCK_UNLOCK(so);
505 spx_close(cb);
528 spx_close(cb);
506 } else
507 would crash system*/
529 } else {
530 SOCK_UNLOCK(so);
531 would crash system } */
508 spx_istat.notyet++;
509 m_freem(dtom(si));
510 return (0);
511 }
512 }
513 /*
514 * If this is a system packet, we don't need to
515 * queue it up, and won't update acknowledge #

--- 44 unchanged lines hidden (view full) ---

560 for (q = cb->s_q.si_next; q != &cb->s_q; q = q->si_next) {
561 if (SI(q)->si_seq == cb->s_ack) {
562 cb->s_ack++;
563 m = dtom(q);
564 if (SI(q)->si_cc & SPX_OB) {
565 cb->s_oobflags &= ~SF_IOOB;
566 if (so->so_rcv.sb_cc)
567 so->so_oobmark = so->so_rcv.sb_cc;
532 spx_istat.notyet++;
533 m_freem(dtom(si));
534 return (0);
535 }
536 }
537 /*
538 * If this is a system packet, we don't need to
539 * queue it up, and won't update acknowledge #

--- 44 unchanged lines hidden (view full) ---

584 for (q = cb->s_q.si_next; q != &cb->s_q; q = q->si_next) {
585 if (SI(q)->si_seq == cb->s_ack) {
586 cb->s_ack++;
587 m = dtom(q);
588 if (SI(q)->si_cc & SPX_OB) {
589 cb->s_oobflags &= ~SF_IOOB;
590 if (so->so_rcv.sb_cc)
591 so->so_oobmark = so->so_rcv.sb_cc;
568 else
592 else {
593 SOCK_LOCK(so);
569 so->so_state |= SS_RCVATMARK;
594 so->so_state |= SS_RCVATMARK;
595 SOCK_UNLOCK(so);
596 }
570 }
571 q = q->si_prev;
572 remque(q->si_next);
573 wakeup = 1;
574 spxstat.spxs_rcvpack++;
575#ifdef SF_NEWCALL
576 if (cb->s_flags2 & SF_NEWCALL) {
577 struct spxhdr *sp = mtod(m, struct spxhdr *);

--- 13 unchanged lines hidden (view full) ---

591 *(u_char *)(&s[2]) = dt;
592 sbappend(&so->so_rcv, mm);
593 }
594 }
595 if (sp->spx_cc & SPX_OB) {
596 MCHTYPE(m, MT_OOBDATA);
597 spx_newchecks[1]++;
598 so->so_oobmark = 0;
597 }
598 q = q->si_prev;
599 remque(q->si_next);
600 wakeup = 1;
601 spxstat.spxs_rcvpack++;
602#ifdef SF_NEWCALL
603 if (cb->s_flags2 & SF_NEWCALL) {
604 struct spxhdr *sp = mtod(m, struct spxhdr *);

--- 13 unchanged lines hidden (view full) ---

618 *(u_char *)(&s[2]) = dt;
619 sbappend(&so->so_rcv, mm);
620 }
621 }
622 if (sp->spx_cc & SPX_OB) {
623 MCHTYPE(m, MT_OOBDATA);
624 spx_newchecks[1]++;
625 so->so_oobmark = 0;
626 SOCK_LOCK(so);
599 so->so_state &= ~SS_RCVATMARK;
627 so->so_state &= ~SS_RCVATMARK;
628 SOCK_UNLOCK(so);
600 }
601 if (packetp == 0) {
602 m->m_data += SPINC;
603 m->m_len -= SPINC;
604 m->m_pkthdr.len -= SPINC;
605 }
606 if ((sp->spx_cc & SPX_EM) || packetp) {
607 sbappendrecord(&so->so_rcv, m);

--- 9 unchanged lines hidden (view full) ---

617 m->m_data += SPINC;
618 m->m_len -= SPINC;
619 m->m_pkthdr.len -= SPINC;
620 sbappend(&so->so_rcv, m);
621 }
622 } else
623 break;
624 }
629 }
630 if (packetp == 0) {
631 m->m_data += SPINC;
632 m->m_len -= SPINC;
633 m->m_pkthdr.len -= SPINC;
634 }
635 if ((sp->spx_cc & SPX_EM) || packetp) {
636 sbappendrecord(&so->so_rcv, m);

--- 9 unchanged lines hidden (view full) ---

646 m->m_data += SPINC;
647 m->m_len -= SPINC;
648 m->m_pkthdr.len -= SPINC;
649 sbappend(&so->so_rcv, m);
650 }
651 } else
652 break;
653 }
625 if (wakeup)
654 if (wakeup) {
655 SOCK_LOCK(so);
626 sorwakeup(so);
656 sorwakeup(so);
657 SOCK_UNLOCK(so);
658 }
627 return (0);
628}
629
630void
631spx_ctlinput(cmd, arg_as_sa, dummy)
632 int cmd;
633 struct sockaddr *arg_as_sa; /* XXX should be swapped with dummy */
634 void *dummy;

--- 387 unchanged lines hidden (view full) ---

1022 si = mtod(m, struct spx *);
1023 si->si_i = *cb->s_ipx;
1024 si->si_s = cb->s_shdr;
1025 si->si_seq = cb->s_smax + 1;
1026 si->si_len = htons(sizeof(*si));
1027 si->si_cc |= SPX_SP;
1028 } else {
1029 cb->s_outx = 3;
659 return (0);
660}
661
662void
663spx_ctlinput(cmd, arg_as_sa, dummy)
664 int cmd;
665 struct sockaddr *arg_as_sa; /* XXX should be swapped with dummy */
666 void *dummy;

--- 387 unchanged lines hidden (view full) ---

1054 si = mtod(m, struct spx *);
1055 si->si_i = *cb->s_ipx;
1056 si->si_s = cb->s_shdr;
1057 si->si_seq = cb->s_smax + 1;
1058 si->si_len = htons(sizeof(*si));
1059 si->si_cc |= SPX_SP;
1060 } else {
1061 cb->s_outx = 3;
1030 if (so->so_options & SO_DEBUG || traceallspxs)
1062 SOCK_LOCK(so);
1063 if (so->so_options & SO_DEBUG || traceallspxs) {
1064 SOCK_UNLOCK(so);
1031 spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
1065 spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
1066 } else
1067 SOCK_UNLOCK(so);
1032 return (0);
1033 }
1034 /*
1035 * Stuff checksum and output datagram.
1036 */
1037 if ((si->si_cc & SPX_SP) == 0) {
1038 if (cb->s_force != (1 + SPXT_PERSIST) ||
1039 cb->s_timer[SPXT_PERSIST] == 0) {

--- 45 unchanged lines hidden (view full) ---

1085 si->si_ack = htons(cb->s_ack);
1086
1087 if (ipxcksum) {
1088 si->si_sum = ipx_cksum(m, ntohs(si->si_len));
1089 } else
1090 si->si_sum = 0xffff;
1091
1092 cb->s_outx = 4;
1068 return (0);
1069 }
1070 /*
1071 * Stuff checksum and output datagram.
1072 */
1073 if ((si->si_cc & SPX_SP) == 0) {
1074 if (cb->s_force != (1 + SPXT_PERSIST) ||
1075 cb->s_timer[SPXT_PERSIST] == 0) {

--- 45 unchanged lines hidden (view full) ---

1121 si->si_ack = htons(cb->s_ack);
1122
1123 if (ipxcksum) {
1124 si->si_sum = ipx_cksum(m, ntohs(si->si_len));
1125 } else
1126 si->si_sum = 0xffff;
1127
1128 cb->s_outx = 4;
1093 if (so->so_options & SO_DEBUG || traceallspxs)
1129 SOCK_LOCK(so);
1130 if (so->so_options & SO_DEBUG || traceallspxs) {
1131 SOCK_UNLOCK(so);
1094 spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
1132 spx_trace(SA_OUTPUT, cb->s_state, cb, si, 0);
1133 SOCK_LOCK(so);
1134 }
1095
1135
1096 if (so->so_options & SO_DONTROUTE)
1136 if (so->so_options & SO_DONTROUTE) {
1137 SOCK_UNLOCK(so);
1097 error = ipx_outputfl(m, (struct route *)NULL, IPX_ROUTETOIF);
1138 error = ipx_outputfl(m, (struct route *)NULL, IPX_ROUTETOIF);
1098 else
1139 } else {
1140 SOCK_UNLOCK(so);
1099 error = ipx_outputfl(m, &cb->s_ipxpcb->ipxp_route, 0);
1141 error = ipx_outputfl(m, &cb->s_ipxpcb->ipxp_route, 0);
1142 }
1100 }
1101 if (error) {
1102 return (error);
1103 }
1104 spxstat.spxs_sndtotal++;
1105 /*
1106 * Data sent (as far as we can tell).
1107 * If this advertises a larger window than any other segment,

--- 300 unchanged lines hidden (view full) ---

1408 if (ipxp->ipxp_lport == 0) {
1409 error = ipx_pcbbind(ipxp, (struct sockaddr *)NULL, td);
1410 if (error)
1411 goto spx_connect_end;
1412 }
1413 error = ipx_pcbconnect(ipxp, nam, td);
1414 if (error)
1415 goto spx_connect_end;
1143 }
1144 if (error) {
1145 return (error);
1146 }
1147 spxstat.spxs_sndtotal++;
1148 /*
1149 * Data sent (as far as we can tell).
1150 * If this advertises a larger window than any other segment,

--- 300 unchanged lines hidden (view full) ---

1451 if (ipxp->ipxp_lport == 0) {
1452 error = ipx_pcbbind(ipxp, (struct sockaddr *)NULL, td);
1453 if (error)
1454 goto spx_connect_end;
1455 }
1456 error = ipx_pcbconnect(ipxp, nam, td);
1457 if (error)
1458 goto spx_connect_end;
1459 SOCK_LOCK(so);
1416 soisconnecting(so);
1460 soisconnecting(so);
1461 SOCK_UNLOCK(so);
1417 spxstat.spxs_connattempt++;
1418 cb->s_state = TCPS_SYN_SENT;
1419 cb->s_did = 0;
1420 spx_template(cb);
1421 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
1422 cb->s_force = 1 + SPXTV_KEEP;
1423 /*
1424 * Other party is required to respond to

--- 105 unchanged lines hidden (view full) ---

1530 int flags;
1531{
1532 struct ipxpcb *ipxp;
1533 struct spxpcb *cb;
1534
1535 ipxp = sotoipxpcb(so);
1536 cb = ipxtospxpcb(ipxp);
1537
1462 spxstat.spxs_connattempt++;
1463 cb->s_state = TCPS_SYN_SENT;
1464 cb->s_did = 0;
1465 spx_template(cb);
1466 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
1467 cb->s_force = 1 + SPXTV_KEEP;
1468 /*
1469 * Other party is required to respond to

--- 105 unchanged lines hidden (view full) ---

1575 int flags;
1576{
1577 struct ipxpcb *ipxp;
1578 struct spxpcb *cb;
1579
1580 ipxp = sotoipxpcb(so);
1581 cb = ipxtospxpcb(ipxp);
1582
1583 SOCK_LOCK(so);
1538 if ((cb->s_oobflags & SF_IOOB) || so->so_oobmark ||
1539 (so->so_state & SS_RCVATMARK)) {
1584 if ((cb->s_oobflags & SF_IOOB) || so->so_oobmark ||
1585 (so->so_state & SS_RCVATMARK)) {
1586 SOCK_UNLOCK(so);
1540 m->m_len = 1;
1541 *mtod(m, caddr_t) = cb->s_iobc;
1542 return (0);
1543 }
1587 m->m_len = 1;
1588 *mtod(m, caddr_t) = cb->s_iobc;
1589 return (0);
1590 }
1591 SOCK_UNLOCK(so);
1544 return (EINVAL);
1545}
1546
1547static int
1548spx_send(so, flags, m, addr, controlp, td)
1549 struct socket *so;
1550 int flags;
1551 struct mbuf *m;

--- 127 unchanged lines hidden (view full) ---

1679 s = s->si_next;
1680 m = dtom(s->si_prev);
1681 remque(s->si_prev);
1682 m_freem(m);
1683 }
1684 m_free(dtom(cb->s_ipx));
1685 FREE(cb, M_PCB);
1686 ipxp->ipxp_pcb = 0;
1592 return (EINVAL);
1593}
1594
1595static int
1596spx_send(so, flags, m, addr, controlp, td)
1597 struct socket *so;
1598 int flags;
1599 struct mbuf *m;

--- 127 unchanged lines hidden (view full) ---

1727 s = s->si_next;
1728 m = dtom(s->si_prev);
1729 remque(s->si_prev);
1730 m_freem(m);
1731 }
1732 m_free(dtom(cb->s_ipx));
1733 FREE(cb, M_PCB);
1734 ipxp->ipxp_pcb = 0;
1735 SOCK_LOCK(so);
1687 soisdisconnected(so);
1736 soisdisconnected(so);
1737 SOCK_UNLOCK(so);
1688 ipx_pcbdetach(ipxp);
1689 spxstat.spxs_closed++;
1690 return ((struct spxpcb *)NULL);
1691}
1692
1693/*
1694 * Someday we may do level 3 handshaking
1695 * to close a connection or send a xerox style error.

--- 186 unchanged lines hidden (view full) ---

1882 /*
1883 * Keep-alive timer went off; send something
1884 * or drop connection if idle for too long.
1885 */
1886 case SPXT_KEEP:
1887 spxstat.spxs_keeptimeo++;
1888 if (cb->s_state < TCPS_ESTABLISHED)
1889 goto dropit;
1738 ipx_pcbdetach(ipxp);
1739 spxstat.spxs_closed++;
1740 return ((struct spxpcb *)NULL);
1741}
1742
1743/*
1744 * Someday we may do level 3 handshaking
1745 * to close a connection or send a xerox style error.

--- 186 unchanged lines hidden (view full) ---

1932 /*
1933 * Keep-alive timer went off; send something
1934 * or drop connection if idle for too long.
1935 */
1936 case SPXT_KEEP:
1937 spxstat.spxs_keeptimeo++;
1938 if (cb->s_state < TCPS_ESTABLISHED)
1939 goto dropit;
1940 SOCK_LOCK(cb->s_ipxpcb->ipxp_socket);
1890 if (cb->s_ipxpcb->ipxp_socket->so_options & SO_KEEPALIVE) {
1941 if (cb->s_ipxpcb->ipxp_socket->so_options & SO_KEEPALIVE) {
1942 SOCK_UNLOCK(cb->s_ipxpcb->ipxp_socket);
1891 if (cb->s_idle >= SPXTV_MAXIDLE)
1892 goto dropit;
1893 spxstat.spxs_keepprobe++;
1894 spx_output(cb, (struct mbuf *)NULL);
1943 if (cb->s_idle >= SPXTV_MAXIDLE)
1944 goto dropit;
1945 spxstat.spxs_keepprobe++;
1946 spx_output(cb, (struct mbuf *)NULL);
1895 } else
1947 } else {
1948 SOCK_UNLOCK(cb->s_ipxpcb->ipxp_socket);
1896 cb->s_idle = 0;
1949 cb->s_idle = 0;
1950 }
1897 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
1898 break;
1899 dropit:
1900 spxstat.spxs_keepdrops++;
1901 cb = spx_drop(cb, ETIMEDOUT);
1902 break;
1903 }
1904 return (cb);
1905}
1951 cb->s_timer[SPXT_KEEP] = SPXTV_KEEP;
1952 break;
1953 dropit:
1954 spxstat.spxs_keepdrops++;
1955 cb = spx_drop(cb, ETIMEDOUT);
1956 break;
1957 }
1958 return (cb);
1959}