projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix per Jeffrey Jongeward
[unix-history]
/
usr
/
src
/
sys
/
netinet
/
tcp_usrreq.c
diff --git
a/usr/src/sys/netinet/tcp_usrreq.c
b/usr/src/sys/netinet/tcp_usrreq.c
index
7983ae0
..
b0ab7ea
100644
(file)
--- a/
usr/src/sys/netinet/tcp_usrreq.c
+++ b/
usr/src/sys/netinet/tcp_usrreq.c
@@
-1,4
+1,4
@@
-/*
tcp_usrreq.c 1.49 82/01/18
*/
+/*
tcp_usrreq.c 1.57 82/04/30
*/
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
@@
-7,6
+7,7
@@
#include "../h/socketvar.h"
#include "../h/protosw.h"
#include "../net/in.h"
#include "../h/socketvar.h"
#include "../h/protosw.h"
#include "../net/in.h"
+#include "../net/route.h"
#include "../net/in_pcb.h"
#include "../net/in_systm.h"
#include "../net/if.h"
#include "../net/in_pcb.h"
#include "../net/in_systm.h"
#include "../net/if.h"
@@
-19,7
+20,7
@@
#include "../net/tcp_var.h"
#include "../net/tcpip.h"
#include "../net/tcp_debug.h"
#include "../net/tcp_var.h"
#include "../net/tcpip.h"
#include "../net/tcp_debug.h"
-#include
"../errno.h"
+#include
<errno.h>
/*
* TCP protocol interface to socket abstraction.
/*
* TCP protocol interface to socket abstraction.
@@
-130,7
+131,7
@@
COUNT(TCP_USRREQ);
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2;
tcp_sendseqinit(tp);
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2;
tcp_sendseqinit(tp);
-
(void)
tcp_output(tp);
+
error =
tcp_output(tp);
break;
/*
break;
/*
@@
-153,8
+154,16
@@
COUNT(TCP_USRREQ);
* done at higher levels; just return the address
* of the peer, storing through addr.
*/
* done at higher levels; just return the address
* of the peer, storing through addr.
*/
- case PRU_ACCEPT:
- in_pcbconnaddr(inp, (struct sockaddr *)addr);
+ case PRU_ACCEPT: {
+ struct sockaddr_in *sin = (struct sockaddr_in *)addr;
+
+ if (sin) {
+ bzero((caddr_t)sin, sizeof (*sin));
+ sin->sin_family = AF_INET;
+ sin->sin_port = inp->inp_fport;
+ sin->sin_addr = inp->inp_faddr;
+ }
+ }
break;
/*
break;
/*
@@
-163,7
+172,7
@@
COUNT(TCP_USRREQ);
case PRU_SHUTDOWN:
socantsendmore(so);
tcp_usrclosed(tp);
case PRU_SHUTDOWN:
socantsendmore(so);
tcp_usrclosed(tp);
-
(void)
tcp_output(tp);
+
error =
tcp_output(tp);
break;
/*
break;
/*
@@
-179,11
+188,11
@@
COUNT(TCP_USRREQ);
*/
case PRU_SEND:
sbappend(&so->so_snd, m);
*/
case PRU_SEND:
sbappend(&so->so_snd, m);
-/*
+#ifdef notdef
if (tp->t_flags & TF_PUSH)
tp->snd_end = tp->snd_una + so->so_snd.sb_cc;
if (tp->t_flags & TF_PUSH)
tp->snd_end = tp->snd_una + so->so_snd.sb_cc;
- */
-
(void)
tcp_output(tp);
+#endif
+
error =
tcp_output(tp);
break;
/*
break;
/*
@@
-224,7
+233,9
@@
COUNT(TCP_USRREQ);
tp->t_oobmark = tp->snd_una + so->so_snd.sb_cc;
printf("sendoob seq now %x oobc %x\n", tp->t_oobseq, tp->t_oobc);
tp->t_oobflags |= TCPOOB_NEEDACK;
tp->t_oobmark = tp->snd_una + so->so_snd.sb_cc;
printf("sendoob seq now %x oobc %x\n", tp->t_oobseq, tp->t_oobc);
tp->t_oobflags |= TCPOOB_NEEDACK;
- (void) tcp_output(tp);
+ /* what to do ...? */
+ if (error = tcp_output(tp))
+ break;
}
#endif
if (sbspace(&so->so_snd) < -512) {
}
#endif
if (sbspace(&so->so_snd) < -512) {
@@
-233,15
+244,19
@@
printf("sendoob seq now %x oobc %x\n", tp->t_oobseq, tp->t_oobc);
}
tp->snd_up = tp->snd_una + so->so_snd.sb_cc + 1;
sbappend(&so->so_snd, m);
}
tp->snd_up = tp->snd_una + so->so_snd.sb_cc + 1;
sbappend(&so->so_snd, m);
-/*
+#ifdef notdef
if (tp->t_flags & TF_PUSH)
tp->snd_end = tp->snd_una + so->so_snd.sb_cc;
if (tp->t_flags & TF_PUSH)
tp->snd_end = tp->snd_una + so->so_snd.sb_cc;
- */
+#endif
tp->t_force = 1;
tp->t_force = 1;
-
(void)
tcp_output(tp);
+
error =
tcp_output(tp);
tp->t_force = 0;
break;
tp->t_force = 0;
break;
+ case PRU_SOCKADDR:
+ in_setsockaddr((struct sockaddr_in *)addr, inp);
+ break;
+
/*
* TCP slow timer went off; going through this
* routine for tracing's sake.
/*
* TCP slow timer went off; going through this
* routine for tracing's sake.
@@
-260,6
+275,8
@@
printf("sendoob seq now %x oobc %x\n", tp->t_oobseq, tp->t_oobc);
return (error);
}
return (error);
}
+int tcp_sendspace = 1024*2;
+int tcp_recvspace = 1024*2;
/*
* Attach TCP protocol to socket, allocating
* internet protocol control block, tcp control block,
/*
* Attach TCP protocol to socket, allocating
* internet protocol control block, tcp control block,
@@
-273,7
+290,8
@@
tcp_attach(so, sa)
struct inpcb *inp;
int error;
struct inpcb *inp;
int error;
- error = in_pcbattach(so, &tcb, 2048, 2048, (struct sockaddr_in *)sa);
+ error = in_pcbattach(so, &tcb,
+ tcp_sendspace, tcp_recvspace, (struct sockaddr_in *)sa);
if (error)
return (error);
inp = (struct inpcb *)so->so_pcb;
if (error)
return (error);
inp = (struct inpcb *)so->so_pcb;
@@
-322,6
+340,7
@@
tcp_disconnect(tp)
* state. In all other cases, have already sent FIN to peer (e.g.
* after PRU_SHUTDOWN), and just have to play tedious game waiting
* for peer to send FIN or not respond to keep-alives, etc.
* state. In all other cases, have already sent FIN to peer (e.g.
* after PRU_SHUTDOWN), and just have to play tedious game waiting
* for peer to send FIN or not respond to keep-alives, etc.
+ * We can let the user exit from the close as soon as the FIN is acked.
*/
tcp_usrclosed(tp)
struct tcpcb *tp;
*/
tcp_usrclosed(tp)
struct tcpcb *tp;
@@
-344,4
+363,6
@@
tcp_usrclosed(tp)
tp->t_state = TCPS_LAST_ACK;
break;
}
tp->t_state = TCPS_LAST_ACK;
break;
}
+ if (tp->t_state >= TCPS_FIN_WAIT_2)
+ soisdisconnected(tp->t_inpcb->inp_socket);
}
}