Subject: Re: [net-next fragmenation icmp v2 1/2] bridge_netfilter: No ICMP packet on IPv4 defragmentation timeout

From: Florian Westphal <[email-masked]>
Date: Thu, 7 May 2015 04:07:19 +0200

Andy Zhou <[email-masked]> wrote:
> Currently, on defragmentation timeout error, ICMP error message
> will be generated. This is fine when they are used in a routing context,
> but does not make sense in the context of bridging netfilter.
> 
> This patch adds a bit (IPSKB_NO_FRAG_ICMP) in IPCB to control
> whether ICMP error message should be generated. br_netfiler sets
> this bit.

Why not use qp->user to make this decision for bridge too?

> diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
> index cc1da6d..447d9ec 100644
> --- a/net/ipv4/ip_fragment.c
> +++ b/net/ipv4/ip_fragment.c
> @@ -217,7 +217,8 @@ static void ip_expire(unsigned long arg)
>  		/* Only an end host needs to send an ICMP
>  		 * "Fragment Reassembly Timeout" message, per RFC792.
>  		 */
> -		if (qp->user == IP_DEFRAG_AF_PACKET ||
>  		    ((qp->user >= IP_DEFRAG_CONNTRACK_IN) &&
>  		     (qp->user <= __IP_DEFRAG_CONNTRACK_IN_END) ||

  		    ((qp->user >= IP_DEFRAG_CONNTRACK_BRIDGE_IN) &&
  		     (qp->user <= __IP_DEFRAG_CONNTRACK_BRIDGE_IN) &&

[ This if cascade is getting silly, might make sense to add
 'static bool should_send_icmp(enum ip_defrag_users users)', move if
 tests there and then just

if (should_send_icmp(qp->user) && skb_rtable( ...)