* how ip header added in ip_bulid_xmit function?
@ 2004-05-18 6:31 linux lover
2004-05-18 14:23 ` Manu Garg
0 siblings, 1 reply; 5+ messages in thread
From: linux lover @ 2004-05-18 6:31 UTC (permalink / raw)
To: linuxnet; +Cc: netdev, netfilter
hello ,
In ip_output.c file there is ip_build_xmit function
call. when packet comes from tcp layer to IP layer
this function is called. In that i found that
skb = sock_alloc_send_skb(sk, length+hh_len+15
,flags&MSG_DONTWAIT, &err);
staement allocates skb for packet. after that i found
that no iphdr adding statement in ip_build_xmit. i
want to know where is iphdr push to skb? cause skb
works using first alloc_skb to allocate memory then
skb_reserve to reserve headroom then put data in skb
by skb_put or skb_push for pushing headers in skb. so
there i found
skb->nh.iph = iph = (struct iphdr *)skb_put(skb,
length);
statement is this does that iphdr adding?
regards,
linuxlover
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: how ip header added in ip_bulid_xmit function?
2004-05-18 6:31 how ip header added in ip_bulid_xmit function? linux lover
@ 2004-05-18 14:23 ` Manu Garg
2004-05-19 6:20 ` linux lover
0 siblings, 1 reply; 5+ messages in thread
From: Manu Garg @ 2004-05-18 14:23 UTC (permalink / raw)
To: linux lover; +Cc: linuxnet, netdev, netfilter
linux lover wrote:
>hello ,
> In ip_output.c file there is ip_build_xmit function
>call. when packet comes from tcp layer to IP layer
>this function is called. In that i found that
> skb = sock_alloc_send_skb(sk, length+hh_len+15
>,flags&MSG_DONTWAIT, &err);
>staement allocates skb for packet. after that i found
>that no iphdr adding statement in ip_build_xmit. i
>want to know where is iphdr push to skb? cause skb
>works using first alloc_skb to allocate memory then
>skb_reserve to reserve headroom then put data in skb
>by skb_put or skb_push for pushing headers in skb. so
>there i found
> skb->nh.iph = iph = (struct iphdr *)skb_put(skb,
>length);
>statement is this does that iphdr adding?
>
>regards,
>linuxlover
>
>
>
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! - Internet access at a great low price.
>http://promo.yahoo.com/sbc/
>-
>To unsubscribe from this list: send the line "unsubscribe linux-net" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
A packet comes from TCP layer to IP layer through function call
tp->af_specific->queue_xmit() (in tcp_output.c:tcp_transmit_skb() ). For
IP this function is nothing but ip_queue_xmit() defined in
ip_output.c.
If you'll check this function, it clearly allocates ip header and put
information in it.
----------------------------------------------------
iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ?
opt->optlen : 0));
*((__u16 *)iph) = htons((4 << 12) | (5 << 8) |
(sk->protinfo.af_inet.tos & 0xff));
iph->tot_len = htons(skb->len);
if (ip_dont_fragment(sk, &rt->u.dst))
iph->frag_off = htons(IP_DF);
else
iph->frag_off = 0;
iph->ttl = sk->protinfo.af_inet.ttl;
iph->protocol = sk->protocol;
iph->saddr = rt->rt_src;
iph->daddr = rt->rt_dst;
skb->nh.iph = iph;
---------------------------------------------------
I hope this answers your question.
regards,
Manu Garg
http://manugarg.freezope.org/notes
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: how ip header added in ip_bulid_xmit function?
2004-05-18 14:23 ` Manu Garg
@ 2004-05-19 6:20 ` linux lover
0 siblings, 0 replies; 5+ messages in thread
From: linux lover @ 2004-05-19 6:20 UTC (permalink / raw)
To: Manu Garg; +Cc: linuxnet, netdev, netfilter
hello,
> A packet comes from TCP layer to IP layer through
> function call
> tp->af_specific->queue_xmit() (in
> tcp_output.c:tcp_transmit_skb() ). For
> IP this function is nothing but ip_queue_xmit()
> defined in ip_output.c.
>
then why ip_build_xmit and ip_build_xmit_slow used?
i think in case of ICMP packet control in icmp.c
alwayes goes to ip_build_xmit?
regards,
linux_lover
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: how ip header added in ip_bulid_xmit function?
@ 2004-05-19 6:27 Galy Lee
2004-05-19 10:36 ` linux lover
0 siblings, 1 reply; 5+ messages in thread
From: Galy Lee @ 2004-05-19 6:27 UTC (permalink / raw)
To: linux lover; +Cc: linuxnet, netdev, netfilter
[-- Attachment #1: Type: text/plain, Size: 918 bytes --]
It seems that ip_build_xmit_slow is used to send to bulk data, but the
ip_build_xmit is used to send single data packet.
-----Original Message-----
From: netdev-bounce@oss.sgi.com [mailto:netdev-bounce@oss.sgi.com]On
Behalf Of linux lover
Sent: Wednesday, May 19, 2004 2:21 PM
To: Manu Garg
Cc: linuxnet; netdev; netfilter
Subject: Re: how ip header added in ip_bulid_xmit function?
hello,
> A packet comes from TCP layer to IP layer through
> function call
> tp->af_specific->queue_xmit() (in
> tcp_output.c:tcp_transmit_skb() ). For
> IP this function is nothing but ip_queue_xmit()
> defined in ip_output.c.
>
then why ip_build_xmit and ip_build_xmit_slow used?
i think in case of ICMP packet control in icmp.c
alwayes goes to ip_build_xmit?
regards,
linux_lover
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/
[-- Attachment #2: Type: text/html, Size: 2210 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: how ip header added in ip_bulid_xmit function?
2004-05-19 6:27 Galy Lee
@ 2004-05-19 10:36 ` linux lover
0 siblings, 0 replies; 5+ messages in thread
From: linux lover @ 2004-05-19 10:36 UTC (permalink / raw)
To: Galy Lee; +Cc: linuxnet, netdev, netfilter
--- Galy Lee <galylee@gdnt.com.cn> wrote:
>
> It seems that ip_build_xmit_slow is used to send to
> bulk data, but the
> ip_build_xmit is used to send single data packet.
>
that mean ip_queue_xmit as well as ip_build_xmit and
ip_build_xmit_slow are all used for sending packet.
but whats difference then between all three functions?
> regards,
> linux_lover
>
>
>
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-05-19 10:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-18 6:31 how ip header added in ip_bulid_xmit function? linux lover
2004-05-18 14:23 ` Manu Garg
2004-05-19 6:20 ` linux lover
-- strict thread matches above, loose matches on Subject: below --
2004-05-19 6:27 Galy Lee
2004-05-19 10:36 ` linux lover
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).