From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gP9RB-0003Hb-9s for kernelnewbies@kernelnewbies.org; Tue, 20 Nov 2018 12:03:45 -0500 Received: by mail-lf1-x134.google.com with SMTP id l10so1851203lfh.9 for ; Tue, 20 Nov 2018 09:03:44 -0800 (PST) MIME-Version: 1.0 From: Wenxin Wang Date: Wed, 21 Nov 2018 01:02:29 +0800 Message-ID: Subject: question: frag_max_size not checked in ip_finish_output To: kernelnewbies@kernelnewbies.org Cc: Hideaki YOSHIFUJI , Alexey Kuznetsov , "David S. Miller" List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Message-ID: <20181120170229.OH_SPWmzHO2BHiYjGMBAV_EmImYKGuWSf_G1lRNlJGw@z> 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 _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies