SCCS-vsn: sys/vax/if/if_en.c 4.22
SCCS-vsn: sys/netinet/ip_input.c 1.27
SCCS-vsn: sys/netinet/tcp_input.c 1.40
SCCS-vsn: sys/netinet/tcp_output.c 4.23
SCCS-vsn: sys/netinet/tcp_subr.c 4.8
SCCS-vsn: sys/netinet/tcp_timer.c 4.7
SCCS-vsn: sys/netinet/tcp_usrreq.c 1.41
-/* ip_input.c 1.26 81/12/12 */
+/* ip_input.c 1.27 81/12/12 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
(*protosw[ip_protox[ip->ip_p]].pr_input)(m);
goto next;
bad:
(*protosw[ip_protox[ip->ip_p]].pr_input)(m);
goto next;
bad:
-printf("ip_input bad!\n");
-/* tcp_input.c 1.39 81/12/12 */
+/* tcp_input.c 1.40 81/12/12 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
if (((struct ip *)ti)->ip_hl > (sizeof (struct ip) >> 2))
ip_stripoptions((struct ip *)ti, (struct mbuf *)0);
if (m->m_len < sizeof (struct tcpiphdr)) {
if (((struct ip *)ti)->ip_hl > (sizeof (struct ip) >> 2))
ip_stripoptions((struct ip *)ti, (struct mbuf *)0);
if (m->m_len < sizeof (struct tcpiphdr)) {
-printf("m->m_len %d\n", m->m_len);
if (m_pullup(m, sizeof (struct tcpiphdr)) == 0) {
if (m_pullup(m, sizeof (struct tcpiphdr)) == 0) {
-printf("tcp_input: header drop\n");
tcpstat.tcps_hdrops++;
goto drop;
}
tcpstat.tcps_hdrops++;
goto drop;
}
*/
off = ti->ti_off << 2;
if (off < sizeof (struct tcphdr) || off > tlen) {
*/
off = ti->ti_off << 2;
if (off < sizeof (struct tcphdr) || off > tlen) {
-printf("tcp_input: bad offset\n");
tcpstat.tcps_badoff++;
goto drop;
}
tcpstat.tcps_badoff++;
goto drop;
}
tp = intotcpcb(inp);
if (tp == 0)
goto dropwithreset;
tp = intotcpcb(inp);
if (tp == 0)
goto dropwithreset;
-printf("tcp_input: segment seq %x ack %x win %x inp %x flags",
-ti->ti_seq, ti->ti_ack, ti->ti_win, inp);
-if (ti->ti_flags & TH_FIN) printf(" FIN");
-if (ti->ti_flags & TH_SYN) printf(" SYN");
-if (ti->ti_flags & TH_RST) printf(" RST");
-if (ti->ti_flags & TH_PUSH) printf(" PUSH");
-if (ti->ti_flags & TH_ACK) printf(" ACK");
-if (ti->ti_flags & TH_URG) printf(" URG");
-printf("\n");
-printf("tcp_input: "); pseqno(tp);
tcp_rcvseqinit(tp);
tp->t_state = TCPS_SYN_RECEIVED;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
tcp_rcvseqinit(tp);
tp->t_state = TCPS_SYN_RECEIVED;
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
-printf("tcp_input: out of LISTEN: ");
tp->snd_wl1 = ti->ti_seq;
} else
tp->t_state = TCPS_SYN_RECEIVED;
tp->snd_wl1 = ti->ti_seq;
} else
tp->t_state = TCPS_SYN_RECEIVED;
-printf("tcp_input: out of SYN_SENT: ");
goto trimthenstep6;
trimthenstep6:
goto trimthenstep6;
trimthenstep6:
ti->ti_len = tp->rcv_wnd;
ti->ti_flags &= ~TH_FIN;
}
ti->ti_len = tp->rcv_wnd;
ti->ti_flags &= ~TH_FIN;
}
-printf("ti->ti_len %d\n", ti->ti_len);
-pseqno(tp);
ti->ti_len = 0;
ti->ti_flags &= ~(TH_PUSH|TH_FIN);
}
ti->ti_len = 0;
ti->ti_flags &= ~(TH_PUSH|TH_FIN);
}
-printf("tcp_input %x: window 0, drop text and FIN\n", tp);
} else {
/*
* If segment begins before rcv_nxt, drop leading
} else {
/*
* If segment begins before rcv_nxt, drop leading
*/
if (SEQ_GT(tp->rcv_nxt, ti->ti_seq)) {
todrop = tp->rcv_nxt - ti->ti_seq;
*/
if (SEQ_GT(tp->rcv_nxt, ti->ti_seq)) {
todrop = tp->rcv_nxt - ti->ti_seq;
-printf("tcp_input %x: drop %d dup bytes\n", tp, todrop);
if (tiflags & TH_SYN) {
ti->ti_seq++;
if (ti->ti_urp > 1)
if (tiflags & TH_SYN) {
ti->ti_seq++;
if (ti->ti_urp > 1)
tp->t_state = TCPS_ESTABLISHED;
(void) tcp_reass(tp, (struct tcpiphdr *)0);
tp->snd_wl1 = ti->ti_seq - 1;
tp->t_state = TCPS_ESTABLISHED;
(void) tcp_reass(tp, (struct tcpiphdr *)0);
tp->snd_wl1 = ti->ti_seq - 1;
-printf("tcp_input: to ESTAB:\n"); pseqno(tp);
if (SEQ_GT(ti->ti_ack, tp->snd_max))
goto dropafterack;
acked = ti->ti_ack - tp->snd_una;
if (SEQ_GT(ti->ti_ack, tp->snd_max))
goto dropafterack;
acked = ti->ti_ack - tp->snd_una;
-printf("tcp_input: got ack of %d bytes\n", acked);
if (acked >= so->so_snd.sb_cc) {
acked -= so->so_snd.sb_cc;
/* if acked > 0 our FIN is acked */
if (acked >= so->so_snd.sb_cc) {
acked -= so->so_snd.sb_cc;
/* if acked > 0 our FIN is acked */
tp->t_srtt =
tcp_alpha * tp->t_srtt +
(1 - tcp_alpha) * tp->t_rtt;
tp->t_srtt =
tcp_alpha * tp->t_srtt +
(1 - tcp_alpha) * tp->t_rtt;
-printf("tcp_input: rtt sampled %d, srtt now %d\n", tp->t_rtt, (int)(100* tp->t_srtt));
* and return.
*/
case TCPS_LAST_ACK:
* and return.
*/
case TCPS_LAST_ACK:
- if (ourfinisacked) {
-printf("tcp_input: LAST ACK close\n");
* it and restart the finack timer.
*/
case TCPS_TIME_WAIT:
* it and restart the finack timer.
*/
case TCPS_TIME_WAIT:
-printf("tcp_input: TIME_WAIT restart timer\n");
tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL;
goto dropafterack;
}
tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL;
goto dropafterack;
}
/*
* Update window information.
*/
/*
* Update window information.
*/
-printf("update win wl1 %x ti->ti_seq %x wl2 %x?", tp->snd_wl1, ti->ti_seq, tp->snd_wl2);
if (SEQ_LT(tp->snd_wl1, ti->ti_seq) ||
tp->snd_wl1==ti->ti_seq && SEQ_LEQ(tp->snd_wl2,ti->ti_seq)) {
if (SEQ_LT(tp->snd_wl1, ti->ti_seq) ||
tp->snd_wl1==ti->ti_seq && SEQ_LEQ(tp->snd_wl2,ti->ti_seq)) {
tp->snd_wnd = ti->ti_win;
tp->snd_wl1 = ti->ti_seq;
tp->snd_wl2 = ti->ti_ack;
if (tp->snd_wnd > 0)
tp->t_timer[TCPT_PERSIST] = 0;
}
tp->snd_wnd = ti->ti_win;
tp->snd_wl1 = ti->ti_seq;
tp->snd_wl2 = ti->ti_ack;
if (tp->snd_wnd > 0)
tp->t_timer[TCPT_PERSIST] = 0;
}
/*
* If an URG bit is set in the segment and is greater than the
/*
* If an URG bit is set in the segment and is greater than the
tp->t_flags |= TF_ACKNOW;
tp->rcv_nxt++;
}
tp->t_flags |= TF_ACKNOW;
tp->rcv_nxt++;
}
-printf("tcp_input: %x got FIN\n", tp);
switch (tp->t_state) {
/*
switch (tp->t_state) {
/*
* Generate an ACK dropping incoming segment.
* Make ACK reflect our state.
*/
* Generate an ACK dropping incoming segment.
* Make ACK reflect our state.
*/
-printf("tcp_input: dropafterack\n");
if (tiflags & TH_RST)
goto drop;
tcp_respond(ti, tp->rcv_nxt, tp->snd_nxt, TH_ACK);
return;
dropwithreset:
if (tiflags & TH_RST)
goto drop;
tcp_respond(ti, tp->rcv_nxt, tp->snd_nxt, TH_ACK);
return;
dropwithreset:
-printf("tcp_input: dropwithreset\n");
/*
* Generate a RST, dropping incoming segment.
* Make ACK acceptable to originator of segment.
/*
* Generate a RST, dropping incoming segment.
* Make ACK acceptable to originator of segment.
-printf("tcp_input: drop\n");
/*
* Drop space held by incoming segment and return.
*/
/*
* Drop space held by incoming segment and return.
*/
while (ti != (struct tcpiphdr *)tp && ti->ti_seq == tp->rcv_nxt) {
tp->rcv_nxt += ti->ti_len;
flags = ti->ti_flags & TH_FIN;
while (ti != (struct tcpiphdr *)tp && ti->ti_seq == tp->rcv_nxt) {
tp->rcv_nxt += ti->ti_len;
flags = ti->ti_flags & TH_FIN;
-printf("move %d bytes to user; rcv_nxt now %x\n", ti->ti_len, tp->rcv_nxt);
remque(ti);
sbappend(&so->so_rcv, dtom(ti));
ti = (struct tcpiphdr *)ti->ti_next;
remque(ti);
sbappend(&so->so_rcv, dtom(ti));
ti = (struct tcpiphdr *)ti->ti_next;
sorwakeup(so);
return (flags);
drop:
sorwakeup(so);
return (flags);
drop:
-printf("tcp_reass drop\n");
m_freem(dtom(ti));
return (flags);
}
m_freem(dtom(ti));
return (flags);
}
-/* tcp_output.c 4.22 81/12/12 */
+/* tcp_output.c 4.23 81/12/12 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
/*
* No reason to send a segment, just return.
*/
/*
* No reason to send a segment, just return.
*/
-printf("tcp_output: nothing to send\n");
m->m_next = m_copy(so->so_snd.sb_mb, off, len);
if (m->m_next == 0)
len = 0;
m->m_next = m_copy(so->so_snd.sb_mb, off, len);
if (m->m_next == 0)
len = 0;
-if (m->m_next) printf("copy *mtod()=%x\n", *mtod(m->m_next, char *));
}
ti = mtod(m, struct tcpiphdr *);
if (tp->t_template == 0)
}
ti = mtod(m, struct tcpiphdr *);
if (tp->t_template == 0)
ti->ti_len = htons((u_short)(len + sizeof (struct tcphdr)));
ti->ti_sum = in_cksum(m, sizeof (struct tcpiphdr) + len);
ti->ti_len = htons((u_short)(len + sizeof (struct tcphdr)));
ti->ti_sum = in_cksum(m, sizeof (struct tcpiphdr) + len);
-printf("tcp_output: ti %x flags %x seq %x ack %x win %d len %d sum %x\n",
-ti, ti->ti_flags, htonl(ti->ti_seq), htonl(ti->ti_ack), htons(ti->ti_win), ti->ti_len, ti->ti_sum);
-
/*
* Advance snd_nxt over sequence space of this segment
*/
/*
* Advance snd_nxt over sequence space of this segment
*/
if (tp->t_timer[TCPT_REXMT] == 0 && tp->snd_nxt != tp->snd_una) {
TCPT_RANGESET(tp->t_timer[TCPT_REXMT],
tcp_beta * tp->t_srtt, TCPTV_MIN, TCPTV_MAX);
if (tp->t_timer[TCPT_REXMT] == 0 && tp->snd_nxt != tp->snd_una) {
TCPT_RANGESET(tp->t_timer[TCPT_REXMT],
tcp_beta * tp->t_srtt, TCPTV_MIN, TCPTV_MAX);
-printf("rexmt timer set to %d\n", tp->t_timer[TCPT_REXMT]);
-else printf("REXMT timer is already %d, snd_nxt %x snd_una %x\n", tp->t_timer[TCPT_REXMT], tp->snd_nxt, tp->snd_una);
/*
* Fill in IP length and desired time to live and
/*
* Fill in IP length and desired time to live and
*/
((struct ip *)ti)->ip_len = len + sizeof (struct tcpiphdr);
((struct ip *)ti)->ip_ttl = TCP_TTL;
*/
((struct ip *)ti)->ip_len = len + sizeof (struct tcpiphdr);
((struct ip *)ti)->ip_ttl = TCP_TTL;
- if (ip_output(m, tp->t_ipopt) == 0) {
-printf("ip_output failed\n");
+ if (ip_output(m, tp->t_ipopt) == 0)
/*
* Data sent (as far as we can tell).
/*
* Data sent (as far as we can tell).
* then remember the size of the advertised window.
* Drop send for purpose of ACK requirements.
*/
* then remember the size of the advertised window.
* Drop send for purpose of ACK requirements.
*/
- if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv)) {
+ if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv))
tp->rcv_adv = tp->rcv_nxt + win;
tp->rcv_adv = tp->rcv_nxt + win;
tp->t_flags &= ~(TF_ACKNOW|TF_DELACK);
if (SEQ_GT(tp->snd_nxt, tp->snd_max))
tp->snd_max = tp->snd_nxt;
tp->t_flags &= ~(TF_ACKNOW|TF_DELACK);
if (SEQ_GT(tp->snd_nxt, tp->snd_max))
tp->snd_max = tp->snd_nxt;
-/* tcp_subr.c 4.7 81/12/12 */
+/* tcp_subr.c 4.8 81/12/12 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
register struct tcpiphdr *n;
COUNT(TCP_TEMPLATE);
register struct tcpiphdr *n;
COUNT(TCP_TEMPLATE);
-printf("tcp_template %x\n", tp);
m = m_get(1);
if (m == 0)
return (0);
m = m_get(1);
if (m == 0)
return (0);
struct mbuf *m;
COUNT(TCP_RESPOND);
struct mbuf *m;
COUNT(TCP_RESPOND);
-printf("tcp_respond ack %x seq %x flags %x\n", ack, seq, flags);
if (flags == 0) {
m = m_get(0);
if (m == 0)
if (flags == 0) {
m = m_get(0);
if (m == 0)
ti->ti_off = sizeof (struct tcphdr) >> 2;
ti->ti_flags = flags;
ti->ti_win = ti->ti_urp = 0;
ti->ti_off = sizeof (struct tcphdr) >> 2;
ti->ti_flags = flags;
ti->ti_win = ti->ti_urp = 0;
-printf("before cksum m->m_len %d\n", m->m_len);
ti->ti_sum = in_cksum(m, sizeof(struct tcpiphdr));
((struct ip *)ti)->ip_len = sizeof(struct tcpiphdr);
((struct ip *)ti)->ip_ttl = TCP_TTL;
ti->ti_sum = in_cksum(m, sizeof(struct tcpiphdr));
((struct ip *)ti)->ip_len = sizeof(struct tcpiphdr);
((struct ip *)ti)->ip_ttl = TCP_TTL;
-printf("to ip_output ip_len %d, m %x\n", ((struct ip *)ti)->ip_len, m);
(void) ip_output(m, (struct mbuf *)0);
}
(void) ip_output(m, (struct mbuf *)0);
}
register struct tcpcb *tp;
COUNT(TCP_NEWTCPCB);
register struct tcpcb *tp;
COUNT(TCP_NEWTCPCB);
-printf("tcp_newtcpcb %x\n", inp);
if (m == 0)
return (0);
tp = mtod(m, struct tcpcb *);
if (m == 0)
return (0);
tp = mtod(m, struct tcpcb *);
struct socket *so = tp->t_inpcb->inp_socket;
COUNT(TCP_DROP);
struct socket *so = tp->t_inpcb->inp_socket;
COUNT(TCP_DROP);
-printf("tcp_drop %x %d\n", tp, errno);
if (TCPS_HAVERCVDSYN(tp->t_state) &&
TCPS_OURFINNOTACKED(tp->t_state)) {
tp->t_state = TCPS_CLOSED;
if (TCPS_HAVERCVDSYN(tp->t_state) &&
TCPS_OURFINNOTACKED(tp->t_state)) {
tp->t_state = TCPS_CLOSED;
struct socket *so = tp->t_inpcb->inp_socket;
COUNT(TCP_CLOSE);
struct socket *so = tp->t_inpcb->inp_socket;
COUNT(TCP_CLOSE);
-printf("tcp_close %x\n", tp);
t = tp->seg_next;
for (; t != (struct tcpiphdr *)tp; t = (struct tcpiphdr *)t->ti_next)
m_freem(dtom(t));
t = tp->seg_next;
for (; t != (struct tcpiphdr *)tp; t = (struct tcpiphdr *)t->ti_next)
m_freem(dtom(t));
-/* tcp_timer.c 4.6 81/12/12 */
+/* tcp_timer.c 4.7 81/12/12 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
register int i;
COUNT(TCP_CANCELTIMERS);
register int i;
COUNT(TCP_CANCELTIMERS);
-printf("tcp_canceltimers %x\n", tp);
for (i = 0; i < TCPT_NTIMERS; i++)
tp->t_timer[i] = 0;
}
for (i = 0; i < TCPT_NTIMERS; i++)
tp->t_timer[i] = 0;
}
-printf("tcp_timers %x %d\n", tp, timer);
TCPT_RANGESET(tp->t_timer[TCPT_REXMT],
((int)(2 * tp->t_srtt)) << tp->t_rxtshift,
TCPTV_MIN, TCPTV_MAX);
TCPT_RANGESET(tp->t_timer[TCPT_REXMT],
((int)(2 * tp->t_srtt)) << tp->t_rxtshift,
TCPTV_MIN, TCPTV_MAX);
-printf("rexmt timer now %d\n", tp->t_timer[TCPT_REXMT]);
tp->snd_nxt = tp->snd_una;
/* this only transmits one segment! */
(void) tcp_output(tp);
tp->snd_nxt = tp->snd_una;
/* this only transmits one segment! */
(void) tcp_output(tp);
tp->t_force = 0;
TCPT_RANGESET(tp->t_timer[TCPT_PERSIST],
2 * tp->t_srtt, TCPTV_PERSMIN, TCPTV_MAX);
tp->t_force = 0;
TCPT_RANGESET(tp->t_timer[TCPT_PERSIST],
2 * tp->t_srtt, TCPTV_PERSMIN, TCPTV_MAX);
-printf("persist timer now %d\n", tp->t_timer[TCPT_PERSIST]);
case TCPT_KEEP:
if (tp->t_state < TCPS_ESTABLISHED ||
tp->t_idle >= TCPTV_MAXIDLE) {
case TCPT_KEEP:
if (tp->t_state < TCPS_ESTABLISHED ||
tp->t_idle >= TCPTV_MAXIDLE) {
-printf("drop because of keep alive\n");
tcp_drop(tp, ETIMEDOUT);
return;
}
tcp_drop(tp, ETIMEDOUT);
return;
}
-printf("send keep alive\n");
tcp_respond(tp->t_template, tp->rcv_nxt, tp->snd_una-1, 0);
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
return;
tcp_respond(tp->t_template, tp->rcv_nxt, tp->snd_una-1, 0);
tp->t_timer[TCPT_KEEP] = TCPTV_KEEP;
return;
-/* tcp_usrreq.c 1.40 81/12/12 */
+/* tcp_usrreq.c 1.41 81/12/12 */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
* Make sure attached. If not,
* only PRU_ATTACH is valid.
*/
* Make sure attached. If not,
* only PRU_ATTACH is valid.
*/
-printf("tcp_usrreq %d so %x inp %x\n", req, so, inp);
if (inp == 0 && req != PRU_ATTACH) {
splx(s);
return (EINVAL);
if (inp == 0 && req != PRU_ATTACH) {
splx(s);
return (EINVAL);
-pseqno(tp)
-struct tcpcb *tp;
-{
-printf("tp %x state %s rcv_nxt %x rcv_wnd %d irs %x\n", tp, tcpstates[tp->t_state],tp->rcv_nxt, tp->rcv_wnd, tp->irs);
-printf("snd_una %x snd_nxt %x snd_wnd %d snd_wl1 %x snd_wl2 %x iss %x\n",
-tp->snd_una, tp->snd_nxt, tp->snd_wnd, tp->snd_wl1, tp->snd_wl2, tp->iss);
-}
-
tcp_usrclosed(tp)
struct tcpcb *tp;
{
tcp_usrclosed(tp)
struct tcpcb *tp;
{
-printf("usrclosed in %s\n", tcpstates[tp->t_state]);
switch (tp->t_state) {
case TCPS_LISTEN:
switch (tp->t_state) {
case TCPS_LISTEN:
tp->t_state = TCPS_LAST_ACK;
break;
}
tp->t_state = TCPS_LAST_ACK;
break;
}
-printf("after usrclosed state %s\n", tcpstates[tp->t_state]);
-/* if_en.c 4.21 81/12/12 */
+/* if_en.c 4.22 81/12/12 */
len = htons((u_short)endataaddr(en, off ? off+2 : 0, struct ip *)->ip_len);
if (off)
len += 2;
len = htons((u_short)endataaddr(en, off ? off+2 : 0, struct ip *)->ip_len);
if (off)
len += 2;
-printf("enet rcvd len %d\n", len);
setipintr();
inq = &ipintrq;
break;
setipintr();
inq = &ipintrq;
break;