All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Fan Du <fan.du@windriver.com>
Cc: steffen.klassert@secunet.com, davem@davemloft.net,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next] xfrm: Simplify SA looking up when using wildcard source address
Date: Mon, 23 Sep 2013 23:46:28 +0400	[thread overview]
Message-ID: <52409A94.7090308@cogentembedded.com> (raw)
In-Reply-To: <1379927917-17365-1-git-send-email-fan.du@windriver.com>

Hello.

On 09/23/2013 01:18 PM, Fan Du wrote:

> I'm not quite sure I get this "wildcard source address" right,
> IMHO if a host needs to protect every traffic for a given remote host,
> then the source address is wildcard address, i.e. all ZEROs.
> (Please correct me if I'm bloodly wrong。。。)

> Here is the argument if above statement stands true:
> __xfrm4/6_state_addr_check is a four steps check, all we need to do
> is checking whether the destination address match. Passing saddr from
> flow is worst option, as the checking needs to reach the fourth step.

> So, simply this process by only checking destination address only when
> using wildcard source address for looking up SAs.

> Signed-off-by: Fan Du <fan.du@windriver.com>
> ---
>   include/net/xfrm.h    |   31 +++++++++++++++++++++++++++++++
>   net/xfrm/xfrm_state.c |    2 +-
>   2 files changed, 32 insertions(+), 1 deletion(-)

> diff --git a/include/net/xfrm.h b/include/net/xfrm.h
> index e253bf0..fdb9343 100644
> --- a/include/net/xfrm.h
> +++ b/include/net/xfrm.h
> @@ -1282,6 +1282,37 @@ xfrm_state_addr_check(const struct xfrm_state *x,
>   }
>
>   static __inline__ int
> +__xfrm4_state_daddr_check(const struct xfrm_state *x,
> +                                const xfrm_address_t *daddr)
> +{
> +        return ((daddr->a4 == x->id.daddr.a4) ? 1 : 0);

    () not needed around the *return* expression, and ?: not needed too.

WBR, Sergei

  reply	other threads:[~2013-09-23 19:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  9:18 [PATCH net-next] xfrm: Simplify SA looking up when using wildcard source address Fan Du
2013-09-23 19:46 ` Sergei Shtylyov [this message]
2013-09-24 11:45 ` Steffen Klassert
2013-09-27  8:35   ` Fan Du

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=52409A94.7090308@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=fan.du@windriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.