From: Robert Olsson <Robert.Olsson@data.slu.se>
To: hadi@cyberus.ca
Cc: Robert Olsson <Robert.Olsson@data.slu.se>,
David Miller <davem@davemloft.net>,
Herbert Xu <herbert@gondor.apana.org.au>,
netdev@vger.kernel.org, James Morris <jmorris@namei.org>
Subject: [PATCH] pktgen IPSEC 3/4: Introduce xfrm SAD only lookup
Date: Tue, 12 Jun 2007 15:30:15 +0200 [thread overview]
Message-ID: <18030.40935.850541.752953@robur.slu.se> (raw)
In-Reply-To: <1181649791.4060.59.camel@localhost>
jamal writes:
> 3 of 4 ..
> [XFRM] Introduce standalone SAD lookup
> This allows other in-kernel functions to do SAD lookups.
> The only known user at the moment is pktgen.
>
> Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
xfrm is not my area.....
Acked-by: Robert Olsson <robert.olsson@its.uu.se>
Cheers
--ro
>
> diff --git a/include/net/xfrm.h b/include/net/xfrm.h
> index 311f25a..79d2c37 100644
> --- a/include/net/xfrm.h
> +++ b/include/net/xfrm.h
> @@ -920,6 +920,10 @@ extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t
> struct flowi *fl, struct xfrm_tmpl *tmpl,
> struct xfrm_policy *pol, int *err,
> unsigned short family);
> +extern struct xfrm_state * xfrm_stateonly_find(xfrm_address_t *daddr,
> + xfrm_address_t *saddr,
> + unsigned short family,
> + u8 mode, u8 proto, u32 reqid);
> extern int xfrm_state_check_expire(struct xfrm_state *x);
> extern void xfrm_state_insert(struct xfrm_state *x);
> extern int xfrm_state_add(struct xfrm_state *x);
> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
> index 85f3f43..b8562e4 100644
> --- a/net/xfrm/xfrm_state.c
> +++ b/net/xfrm/xfrm_state.c
> @@ -686,6 +686,41 @@ out:
> return x;
> }
>
> +struct xfrm_state *
> +xfrm_stateonly_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
> + unsigned short family, u8 mode, u8 proto, u32 reqid)
> +{
> + unsigned int h = xfrm_dst_hash(daddr, saddr, reqid, family);
> + struct xfrm_state *rx = NULL, *x = NULL;
> + struct hlist_node *entry;
> +
> + spin_lock(&xfrm_state_lock);
> + hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) {
> + if (x->props.family == family &&
> + x->props.reqid == reqid &&
> + !(x->props.flags & XFRM_STATE_WILDRECV) &&
> + xfrm_state_addr_check(x, daddr, saddr, family) &&
> + mode == x->props.mode &&
> + proto == x->id.proto) {
> +
> + if (x->km.state != XFRM_STATE_VALID)
> + continue;
> + else {
> + rx = x;
> + break;
> + }
> + }
> + }
> +
> + if (rx)
> + xfrm_state_hold(rx);
> + spin_unlock(&xfrm_state_lock);
> +
> +
> + return rx;
> +}
> +EXPORT_SYMBOL(xfrm_stateonly_find);
> +
> static void __xfrm_state_insert(struct xfrm_state *x)
> {
> unsigned int h;
next prev parent reply other threads:[~2007-06-12 13:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-12 11:56 [PATCH SET] pktgen IPSEC 0/4 jamal
2007-06-12 12:00 ` [PATCH] pktgen IPSEC 1/4: Centralize pktgen packet overhead management jamal
2007-06-12 12:01 ` [PATCH] pktgen IPSEC 2/4: Introduce pktgen sequential flows jamal
2007-06-12 12:03 ` [PATCH] pktgen IPSEC 3/4: Introduce xfrm SAD only lookup jamal
2007-06-12 12:04 ` [PATCH] pktgen IPSEC 4/4: Add IPSEC support to pktgen jamal
2007-06-12 13:31 ` Robert Olsson
2007-06-12 23:08 ` Resend: " jamal
2007-07-03 5:42 ` David Miller
2007-06-12 13:30 ` Robert Olsson [this message]
2007-06-12 13:45 ` [PATCH] pktgen IPSEC 3/4: Introduce xfrm SAD only lookup Patrick McHardy
2007-06-12 15:19 ` jamal
2007-06-12 23:06 ` Resend: " jamal
2007-07-03 5:41 ` David Miller
2007-06-12 13:23 ` [PATCH] pktgen IPSEC 2/4: Introduce pktgen sequential flows Robert Olsson
2007-07-03 5:40 ` David Miller
2007-06-12 13:21 ` [PATCH] pktgen IPSEC 1/4: Centralize pktgen packet overhead management Robert Olsson
2007-06-12 15:13 ` jamal
2007-07-03 5:40 ` David Miller
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=18030.40935.850541.752953@robur.slu.se \
--to=robert.olsson@data.slu.se \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=herbert@gondor.apana.org.au \
--cc=jmorris@namei.org \
--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).