question: frag_max_size not checked in ip_finish_output

Wenxin Wang wenxin.wang94 at gmail.com
Tue Nov 20 12:02:29 EST 2018


Dear developers,
I'm trying to understand the different behavior between `ip_finish_output` and
`ip6_finish_output`, when deciding whether to do fragmentation or not.

`ip_finish_output` calls `ip_fragment` when `skb->len` exceeds the
destination mtu;
In addition to this mtu check, `ip6_finish_output` also checks if
`skb->len > IP6CB(skb)->frag_max_size`.

The relevant code is here
https://elixir.bootlin.com/linux/latest/source/net/ipv4/ip_output.c#L310
https://elixir.bootlin.com/linux/latest/source/net/ipv6/ip6_output.c#L151

As far as I know, `frag_max_size` prevents the forwarding routine from sending
packets longer than the maximum fragment received after defragmentation.
I'm wondering why `ip_finish_output` doesn't check similarily for
`IPCB(skb)->frag_max_size`,
especially when `ip_fragment` and `ip_do_fragment`, called
(indirectly) by `ip_finish_output`,
both cap the output mtu by this frag_max_size.

Many thanks in advance!
If I'm sending to the wrong person, or wrong mailing list, please let
me know. It's my first
time trying to ask questions to Linux developers, and sorry for the
disturbance. Currently I'm
not subscribed to any mailing list, but I will if necessary.

Thank you for making Linux great ;)
Sincerely,
Wenxin Wang



More information about the Kernelnewbies mailing list