netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Andy Zhou <azhou@nicira.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Re: [net-next fragmentation icmp v3 1/4] ipv4: introduce frag_expire_skip_icmp()
Date: Fri, 08 May 2015 15:03:39 +0300	[thread overview]
Message-ID: <554CA61B.50501@cogentembedded.com> (raw)
In-Reply-To: <1431059199-7139-2-git-send-email-azhou@nicira.com>

Hello.

On 5/8/2015 7:26 AM, Andy Zhou wrote:

> Improve readability of skip ICMP for de-fragmentation expiration logic.
> This change will also make the logic easier to maintain when the
> following patches in this series are applied.

> Signed-off-by: Andy Zhou <azhou@nicira.com>
> ---
>   include/net/ip.h       | 10 ++++++++++
>   net/ipv4/ip_fragment.c | 13 +++++++++----
>   2 files changed, 19 insertions(+), 4 deletions(-)

> diff --git a/include/net/ip.h b/include/net/ip.h
> index d14af7e..f79193a 100644
> --- a/include/net/ip.h
> +++ b/include/net/ip.h
> @@ -478,6 +478,16 @@ enum ip_defrag_users {
>   	IP_DEFRAG_MACVLAN,
>   };
>
> +/* Return true if the value of 'user' is between 'lower_bond'
> + * and 'upper_bond' inclusively.
> + */
> +static inline bool ip_defrag_user_in_between(u32 user,
> +					     enum ip_defrag_users lower_bond,
> +					     enum ip_defrag_users upper_bond)
> +{
> +	return (user >= lower_bond && user <= upper_bond);

    Don't need parens around the *return* expression.

[...]
> diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
> index cc1da6d..429cefa 100644
> --- a/net/ipv4/ip_fragment.c
> +++ b/net/ipv4/ip_fragment.c
> @@ -173,6 +173,13 @@ static void ipq_kill(struct ipq *ipq)
>   	inet_frag_kill(&ipq->q, &ip4_frags);
>   }
>
> +static bool frag_expire_skip_icmp(u32 user)
> +{
> +	return (user == IP_DEFRAG_AF_PACKET ||
> +		ip_defrag_user_in_between(user, IP_DEFRAG_CONNTRACK_IN,
> +					  __IP_DEFRAG_CONNTRACK_IN_END));

    Likewise.

[...]

WBR, Sergei

  reply	other threads:[~2015-05-08 12:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  4:26 [net-next fragmentation icmp v3 0/4] fragmentation ICMP Andy Zhou
2015-05-08  4:26 ` [net-next fragmentation icmp v3 1/4] ipv4: introduce frag_expire_skip_icmp() Andy Zhou
2015-05-08 12:03   ` Sergei Shtylyov [this message]
2015-05-12 15:13     ` Andy Zhou
2015-05-08  4:26 ` [net-next fragmentation icmp v3 2/4] IPv4: skip ICMP for bridge contrack users when defrag expires Andy Zhou
2015-05-08  4:26 ` [net-next fragmentation icmp v3 3/4] bridge_netfilter: No ICMP packet on IPv4 defragmentation timeout Andy Zhou
2015-05-08  4:26 ` [net-next fragmentation icmp v3 4/4] bridge_netfilter: No ICMP packet on IPv4 fragmentation error Andy Zhou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=554CA61B.50501@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=azhou@nicira.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).