*** ip.c Mon May 23 01:17:48 1994 --- /usr/src/linux/net/inet/ip.c Wed May 25 21:19:46 1994 *************** *** 177,182 **** --- 177,183 ---- return mac; } + int ip_id_count = 0; /* * This routine builds the appropriate hardware/IP headers for *************** *** 192,198 **** struct rtable *rt; unsigned char *buff; unsigned long raddr; - static int count = 0; int tmp; unsigned long src; --- 193,198 ---- *************** *** 295,302 **** iph->saddr = saddr; iph->protocol = type; iph->ihl = 5; ! iph->id = htons(count++); ! /* Setup the IP options. */ #ifdef Not_Yet_Avail build_options(iph, opt); --- 295,301 ---- iph->saddr = saddr; iph->protocol = type; iph->ihl = 5; ! /* Setup the IP options. */ #ifdef Not_Yet_Avail build_options(iph, opt); *************** *** 1683,1688 **** --- 1682,1688 ---- iph = (struct iphdr *)ptr; skb->ip_hdr = iph; iph->tot_len = ntohs(skb->len-dev->hard_header_len); + iph->id = htons(ip_id_count++); /* * Do we need to fragment. Again this is inefficient. *************** *** 1834,1839 **** --- 1834,1866 ---- } #endif skb->when = jiffies; + + /* + * In general it's OK just to use the old packet. However we + * need to use the current ack and window fields. Urg and + * urg_ptr could possibly stand to be updated as well, but we + * don't keep the necessary data. That shouldn't be a problem, + * if the other end is doing the right thing. Since we're + * changing the packet, we have to issue a new IP identifier. + */ + + /* this check may be unnecessary - retransmit only for TCP */ + if (sk->protocol == IPPROTO_TCP) { + struct tcphdr *th; + struct iphdr *iph; + int size; + + iph = (struct iphdr *)(skb->data + dev->hard_header_len); + th = (struct tcphdr *)(((char *)iph) + (iph->ihl << 2)); + size = skb->len - (((unsigned char *) th) - skb->data); + + iph->id = htons(ip_id_count++); + ip_send_check(iph); + + th->ack_seq = ntohl(sk->acked_seq); + th->window = ntohs(tcp_select_window(sk)); + tcp_send_check(th, sk->saddr, sk->daddr, size, sk); + } /* * If the interface is (still) up and running, kick it.