PERFORCE change 157796 for review

Andre Oppermann andre at FreeBSD.org
Mon Feb 16 08:11:00 PST 2009


http://perforce.freebsd.org/chv.cgi?CH=157796

Change 157796 by andre at andre_flirtbox on 2009/02/16 16:10:48

	Better ttl and hlim initialization in tcpip_fillheaders.

Affected files ...

.. //depot/projects/tcp_new/netinet/tcp_subr.c#4 edit

Differences ...

==== //depot/projects/tcp_new/netinet/tcp_subr.c#4 (text+ko) ====

@@ -294,9 +294,8 @@
  * of the tcpcb each time to conserve mbufs.
  */
 void
-tcpip_fillheaders(struct inpcb *inp, void *ip_ptr, void *tcp_ptr)
+tcpip_fillheaders(struct inpcb *inp, void *ip_ptr, struct tcphdr *th)
 {
-	struct tcphdr *th = (struct tcphdr *)tcp_ptr;
 
 	INP_LOCK_ASSERT(inp);
 
@@ -311,6 +310,7 @@
 			(IPV6_VERSION & IPV6_VERSION_MASK);
 		ip6->ip6_nxt = IPPROTO_TCP;
 		ip6->ip6_plen = sizeof(struct tcphdr);
+		ip6->ip6_hlim = in6_selecthlim(inp, NULL);
 		ip6->ip6_src = inp->in6p_laddr;
 		ip6->ip6_dst = inp->in6p_faddr;
 	} else
@@ -325,7 +325,12 @@
 		ip->ip_len = 0;
 		ip->ip_id = 0;
 		ip->ip_off = 0;
-		ip->ip_ttl = inp->inp_ip_ttl;
+#ifdef INET6
+		if (INP_CHECK_SOCKAF(inp->inp_socket, AF_INET6))
+			ip->ip_ttl = in6_selecthlim(inp, NULL);
+		else
+#endif
+			ip->ip_ttl = inp->inp_ip_ttl;
 		ip->ip_sum = 0;
 		ip->ip_p = IPPROTO_TCP;
 		ip->ip_src = inp->inp_laddr;


More information about the p4-projects mailing list