Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Oct 1996 00:03:16 +0700
From:      Eka Kelana <eka@werty.wasantara.net.id>
To:        freebsd-hackers@FreeBSD.org
Cc:        freebsd-questions@FreeBSD.org
Subject:   tcp_output.c 
Message-ID:  <199610281703.AAA02710@werty.wasantara.net.id>

next in thread | raw e-mail | index | archive | help
Hi...

   I want to know what these lines (with "???" mark) do in tcp output
(tcp_output.c) routine:




	/*
	 * Fill in IP length and desired time to live and
	 * send to IP level.  There should be a better way
	 * to handle ttl and tos; we could keep them in
	 * the template, but need a way to checksum without them.
	 */
	m->m_pkthdr.len = hdrlen + len;
#ifdef TUBA
	if (tp->t_tuba_pcb)
		error = tuba_output(m, tp);
	else
#endif
    {
    
???	((struct ip *)ti)->ip_len = m->m_pkthdr.len;
???	((struct ip *)ti)->ip_ttl = tp->t_inpcb->inp_ip.ip_ttl;	/* XXX */
???	((struct ip *)ti)->ip_tos = tp->t_inpcb->inp_ip.ip_tos;	/* XXX */

#if BSD >= 43
	error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
	    so->so_options & SO_DONTROUTE, 0);
#else
	error = ip_output(m, (struct mbuf *)0, &tp->t_inpcb->inp_route,
	    so->so_options & SO_DONTROUTE);
#endif
    }




Why should ti (tcpiphdr structure) be casted to ip header structure and
being filled in this tcp routine? 
Why don't we just fill the ip header in ip routine?
What is it intended for?

-Eka Kelana-




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610281703.AAA02710>