(E-Mail Removed) <(E-Mail Removed)> wrote:
> Horst Knobloch wrote:
>> (E-Mail Removed) <(E-Mail Removed)> wrote:
>>
[Where is fragmentation done?]
>> The call chain is
>>
>> ip_forward() -> ip_forward_finish() -> ip_send() ->
>> ip_fragmentation() -> ip_finish_output()
>>
....
> Can you please check ip_forward.c and there ip_forward() function
> where condition is written as
>
> if (skb->len > mtu && (ntohs(iph->frag_off) & IP_DF))
> goto frag_needed;
>
> What this indicates? Doesn't it throw away packet before it go to
> ip_fragmentation?
Yes, but only the packets which are not allowed to be
fragmented (DF flag set). The IP packets which have the
DF flag *not* set are allowed to be fragmented and for
those packets the condition holds not true. Thus the
packet is fragmented later if it is bigger than the MTU
of the outgoing interface.
For packets with the DF flag set, the IP stack is not
allowed to fragment and therefore it sends back the ICMP
error indicating that the packet couldn't be delivered
because it was bigger than the MTU. To support the PMTUD
done by the end hosts it returns the allowed MTU in the
ICMP error. So the end host can send smaller packets at
the next try.
> I agree that linux kernel packet forwarding code on
> linux router does fragmentation by calling ip_fragment not in
> ip_forward() but in ip_send().
Ah, at least. ;-)
> Also in following function skb->dst->pmtu is pmtu of next hop in packet
> forwarding PATH right?
Yes. However even if the variable is named pmtu, what
implies path mtu, it contains the mtu of the outgoing
interface in *this* circumstance.
> static inline int ip_send(struct sk_buff *skb)
> {
> if (skb->len > skb->dst->pmtu)
> return ip_fragment(skb, ip_finish_output);
> else
> return ip_finish_output(skb);
> }
....
> So that mean If suppose PMTU is implemented with ICMP enable then is
> there still any possibility of packet fragmenta
> tion?(Just a thought)
If PMTUD is performed by the end host, it sets the DF flag
on the packets it sends and it is not allowed to fragment
those packets along the path. This means whether packets
can be fragmented or not is controlled by the hosts and
not by intermediate routers.
> So at any Router in a internet packet path if PMTU not used
> then router code always have pmtu values of next hop touter. Is that
> correct?
Hm, I'm not sure whether I understand your question.
PMTUD is done by the end hosts not the routers[1]. The
routers along the path must just send back ICMP errors
with the next hop's MTU value to support PMTUD.
The next hop's MTU is known by the router because it
is the configured MTU size of the interface to which the
next hop router is connected to.
HTH
Ciao, Horst
1) Of course a router can also be a host in certain cases,
e.g. if you telnet to it.
--
»When pings go wrong (It hurts me too)« E.Clapton/E.James/P.Tscharn