init m_pkthdr in tcp_respond (esp when prev. len was larger)
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Thu, 26 Jul 1990 06:15:26 +0000 (22:15 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Thu, 26 Jul 1990 06:15:26 +0000 (22:15 -0800)
SCCS-vsn: sys/netinet/tcp_subr.c 7.19

usr/src/sys/netinet/tcp_subr.c

index 1545ce7..fce9d99 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tcp_subr.c  7.18 (Berkeley) %G%
+ *     @(#)tcp_subr.c  7.19 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -113,7 +113,8 @@ tcp_respond(tp, ti, m, ack, seq, flags)
        tcp_seq ack, seq;
        int flags;
 {
        tcp_seq ack, seq;
        int flags;
 {
-       int win = 0, tlen;
+       register int tlen;
+       int win = 0;
        struct route *ro = 0;
 
        if (tp) {
        struct route *ro = 0;
 
        if (tp) {
@@ -144,10 +145,13 @@ tcp_respond(tp, ti, m, ack, seq, flags)
                xchg(ti->ti_dport, ti->ti_sport, u_short);
 #undef xchg
        }
                xchg(ti->ti_dport, ti->ti_sport, u_short);
 #undef xchg
        }
-       m->m_len = sizeof (struct tcpiphdr) + tlen;
+       ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + tlen));
+       tlen += sizeof (struct tcpiphdr);
+       m->m_len = tlen;
+       m->m_pkthdr.len = tlen;
+       m->m_pkthdr.rcvif = (struct ifnet *) 0;
        ti->ti_next = ti->ti_prev = 0;
        ti->ti_x1 = 0;
        ti->ti_next = ti->ti_prev = 0;
        ti->ti_x1 = 0;
-       ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + tlen));
        ti->ti_seq = htonl(seq);
        ti->ti_ack = htonl(ack);
        ti->ti_x2 = 0;
        ti->ti_seq = htonl(seq);
        ti->ti_ack = htonl(ack);
        ti->ti_x2 = 0;
@@ -155,8 +159,8 @@ tcp_respond(tp, ti, m, ack, seq, flags)
        ti->ti_flags = flags;
        ti->ti_win = htons((u_short)win);
        ti->ti_urp = 0;
        ti->ti_flags = flags;
        ti->ti_win = htons((u_short)win);
        ti->ti_urp = 0;
-       ti->ti_sum = in_cksum(m, sizeof (struct tcpiphdr) + tlen);
-       ((struct ip *)ti)->ip_len = sizeof (struct tcpiphdr) + tlen;
+       ti->ti_sum = in_cksum(m, tlen);
+       ((struct ip *)ti)->ip_len = tlen;
        ((struct ip *)ti)->ip_ttl = tcp_ttl;
        (void) ip_output(m, (struct mbuf *)0, ro, 0);
 }
        ((struct ip *)ti)->ip_ttl = tcp_ttl;
        (void) ip_output(m, (struct mbuf *)0, ro, 0);
 }