move mtpr.h to vax directory
[unix-history] / usr / src / sys / netinet / tcp_subr.c
index fa50e84..766a596 100644 (file)
@@ -1,4 +1,4 @@
-/*     tcp_subr.c      4.24    82/04/24        */
+/*     tcp_subr.c      4.30    82/10/09        */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -6,20 +6,21 @@
 #include "../h/socket.h"
 #include "../h/socketvar.h"
 #include "../h/protosw.h"
 #include "../h/socket.h"
 #include "../h/socketvar.h"
 #include "../h/protosw.h"
-#include "../net/in.h"
+#include "../netinet/in.h"
 #include "../net/route.h"
 #include "../net/route.h"
-#include "../net/in_pcb.h"
-#include "../net/in_systm.h"
+#include "../netinet/in_pcb.h"
+#include "../netinet/in_systm.h"
 #include "../net/if.h"
 #include "../net/if.h"
-#include "../net/ip.h"
-#include "../net/ip_var.h"
-#include "../net/tcp.h"
-#include "../net/tcp_fsm.h"
-#include "../net/tcp_seq.h"
-#include "../net/tcp_timer.h"
-#include "../net/tcp_var.h"
-#include "../net/tcpip.h"
-#include "../errno.h"
+#include "../netinet/ip.h"
+#include "../netinet/ip_var.h"
+#include "../netinet/ip_icmp.h"
+#include "../netinet/tcp.h"
+#include "../netinet/tcp_fsm.h"
+#include "../netinet/tcp_seq.h"
+#include "../netinet/tcp_timer.h"
+#include "../netinet/tcp_var.h"
+#include "../netinet/tcpip.h"
+#include <errno.h>
 
 /*
  * Tcp initialization
 
 /*
  * Tcp initialization
@@ -27,7 +28,6 @@
 tcp_init()
 {
 
 tcp_init()
 {
 
-COUNT(TCP_INIT);
        tcp_iss = 1;            /* wrong */
        tcb.inp_next = tcb.inp_prev = &tcb;
        tcp_alpha = TCP_ALPHA;
        tcp_iss = 1;            /* wrong */
        tcb.inp_next = tcb.inp_prev = &tcb;
        tcp_alpha = TCP_ALPHA;
@@ -48,7 +48,6 @@ tcp_template(tp)
        register struct mbuf *m;
        register struct tcpiphdr *n;
 
        register struct mbuf *m;
        register struct tcpiphdr *n;
 
-COUNT(TCP_TEMPLATE);
        m = m_get(M_WAIT);
        if (m == 0)
                return (0);
        m = m_get(M_WAIT);
        if (m == 0)
                return (0);
@@ -97,7 +96,6 @@ tcp_respond(tp, ti, ack, seq, flags)
        int win = 0, tlen;
        struct route *ro = 0;
 
        int win = 0, tlen;
        struct route *ro = 0;
 
-COUNT(TCP_RESPOND);
        if (tp) {
                win = sbspace(&tp->t_inpcb->inp_socket->so_rcv);
                ro = &tp->t_inpcb->inp_route;
        if (tp) {
                win = sbspace(&tp->t_inpcb->inp_socket->so_rcv);
                ro = &tp->t_inpcb->inp_route;
@@ -106,7 +104,6 @@ COUNT(TCP_RESPOND);
                m = m_get(M_DONTWAIT);
                if (m == 0)
                        return;
                m = m_get(M_DONTWAIT);
                if (m == 0)
                        return;
-               m->m_off = MMINOFF;
                m->m_len = sizeof (struct tcpiphdr) + 1;
                *mtod(m, struct tcpiphdr *) = *ti;
                ti = mtod(m, struct tcpiphdr *);
                m->m_len = sizeof (struct tcpiphdr) + 1;
                *mtod(m, struct tcpiphdr *) = *ti;
                ti = mtod(m, struct tcpiphdr *);
@@ -159,13 +156,12 @@ tcp_newtcpcb(inp)
 {
        struct mbuf *m = m_getclr(M_DONTWAIT);
        register struct tcpcb *tp;
 {
        struct mbuf *m = m_getclr(M_DONTWAIT);
        register struct tcpcb *tp;
-COUNT(TCP_NEWTCPCB);
 
        if (m == 0)
                return (0);
        tp = mtod(m, struct tcpcb *);
        tp->seg_next = tp->seg_prev = (struct tcpiphdr *)tp;
 
        if (m == 0)
                return (0);
        tp = mtod(m, struct tcpcb *);
        tp->seg_next = tp->seg_prev = (struct tcpiphdr *)tp;
-       tp->t_maxseg = 1024;
+       tp->t_maxseg = 576;             /* satisfy the rest of the world */
        tp->t_flags = 0;                /* sends options! */
        tp->t_inpcb = inp;
        inp->inp_ppcb = (caddr_t)tp;
        tp->t_flags = 0;                /* sends options! */
        tp->t_inpcb = inp;
        inp->inp_ppcb = (caddr_t)tp;
@@ -183,7 +179,6 @@ tcp_drop(tp, errno)
 {
        struct socket *so = tp->t_inpcb->inp_socket;
 
 {
        struct socket *so = tp->t_inpcb->inp_socket;
 
-COUNT(TCP_DROP);
        if (TCPS_HAVERCVDSYN(tp->t_state)) {
                tp->t_state = TCPS_CLOSED;
                tcp_output(tp);
        if (TCPS_HAVERCVDSYN(tp->t_state)) {
                tp->t_state = TCPS_CLOSED;
                tcp_output(tp);
@@ -211,7 +206,6 @@ tcp_close(tp)
        struct inpcb *inp = tp->t_inpcb;
        struct socket *so = inp->inp_socket;
 
        struct inpcb *inp = tp->t_inpcb;
        struct socket *so = inp->inp_socket;
 
-COUNT(TCP_CLOSE);
        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));
@@ -230,12 +224,33 @@ COUNT(TCP_CLOSE);
 tcp_drain()
 {
 
 tcp_drain()
 {
 
-COUNT(TCP_DRAIN);
 }
 
 tcp_ctlinput(cmd, arg)
        int cmd;
        caddr_t arg;
 {
 }
 
 tcp_ctlinput(cmd, arg)
        int cmd;
        caddr_t arg;
 {
-COUNT(TCP_CTLINPUT);
+       struct in_addr *sin;
+       extern u_char inetctlerrmap[];
+
+       if (cmd < 0 || cmd > PRC_NCMDS)
+               return;
+       switch (cmd) {
+
+       case PRC_ROUTEDEAD:
+               break;
+
+       case PRC_QUENCH:
+               break;
+
+       /* these are handled by ip */
+       case PRC_IFDOWN:
+       case PRC_HOSTDEAD:
+       case PRC_HOSTUNREACH:
+               break;
+
+       default:
+               sin = &((struct icmp *)arg)->icmp_ip.ip_dst;
+               in_pcbnotify(&tcb, sin, inetctlerrmap[cmd], tcp_abort);
+       }
 }
 }