From: Steffen Klassert <steffen.klassert@secunet.com>
To: <netdev@vger.kernel.org>
Cc: Steffen Klassert <steffen.klassert@secunet.com>,
Christophe Gouault <christophe.gouault@6wind.com>
Subject: [PATCH RFC v2 03/12] esp6: Use the IPsec protocol multiplexer API
Date: Wed, 5 Mar 2014 13:41:07 +0100 [thread overview]
Message-ID: <1394023276-2591-4-git-send-email-steffen.klassert@secunet.com> (raw)
In-Reply-To: <1394023276-2591-1-git-send-email-steffen.klassert@secunet.com>
Switch esp6 to use the new IPsec protocol multiplexer.
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv6/esp6.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 6eef8a7..ec6971f 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -421,7 +421,7 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu)
net_adj) & ~(blksize - 1)) + net_adj - 2;
}
-static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
+static int esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, __be32 info)
{
struct net *net = dev_net(skb->dev);
@@ -431,18 +431,20 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if (type != ICMPV6_PKT_TOOBIG &&
type != NDISC_REDIRECT)
- return;
+ return 0;
x = xfrm_state_lookup(net, skb->mark, (const xfrm_address_t *)&iph->daddr,
esph->spi, IPPROTO_ESP, AF_INET6);
if (!x)
- return;
+ return 0;
if (type == NDISC_REDIRECT)
ip6_redirect(skb, net, skb->dev->ifindex, 0);
else
ip6_update_pmtu(skb, net, info, 0, 0);
xfrm_state_put(x);
+
+ return 0;
}
static void esp6_destroy(struct xfrm_state *x)
@@ -614,6 +616,11 @@ error:
return err;
}
+static int esp6_rcv_cb(struct sk_buff *skb, int err)
+{
+ return 0;
+}
+
static const struct xfrm_type esp6_type =
{
.description = "ESP6",
@@ -628,10 +635,11 @@ static const struct xfrm_type esp6_type =
.hdr_offset = xfrm6_find_1stfragopt,
};
-static const struct inet6_protocol esp6_protocol = {
- .handler = xfrm6_rcv,
+static struct xfrm6_protocol esp6_protocol = {
+ .handler = xfrm6_rcv,
+ .cb_handler = esp6_rcv_cb,
.err_handler = esp6_err,
- .flags = INET6_PROTO_NOPOLICY,
+ .priority = 0,
};
static int __init esp6_init(void)
@@ -640,7 +648,7 @@ static int __init esp6_init(void)
pr_info("%s: can't add xfrm type\n", __func__);
return -EAGAIN;
}
- if (inet6_add_protocol(&esp6_protocol, IPPROTO_ESP) < 0) {
+ if (xfrm6_protocol_register(&esp6_protocol, IPPROTO_ESP) < 0) {
pr_info("%s: can't add protocol\n", __func__);
xfrm_unregister_type(&esp6_type, AF_INET6);
return -EAGAIN;
@@ -651,7 +659,7 @@ static int __init esp6_init(void)
static void __exit esp6_fini(void)
{
- if (inet6_del_protocol(&esp6_protocol, IPPROTO_ESP) < 0)
+ if (xfrm6_protocol_deregister(&esp6_protocol, IPPROTO_ESP) < 0)
pr_info("%s: can't remove protocol\n", __func__);
if (xfrm_unregister_type(&esp6_type, AF_INET6) < 0)
pr_info("%s: can't remove xfrm type\n", __func__);
--
1.7.9.5
next prev parent reply other threads:[~2014-03-05 12:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 12:41 [PATCH RFC v2 0/12] vti6: prepare namespace and interfamily support Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 01/12] xfrm: Introduce xfrm_input_afinfo to access the the callbacks properly Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 02/12] xfrm6: Add IPsec protocol multiplexer Steffen Klassert
2014-03-05 12:41 ` Steffen Klassert [this message]
2014-03-05 14:52 ` [PATCH RFC v2 03/12] esp6: Use the IPsec protocol multiplexer API Sergei Shtylyov
2014-03-05 12:41 ` [PATCH RFC v2 04/12] ah6: " Steffen Klassert
2014-03-05 14:54 ` Sergei Shtylyov
2014-03-05 12:41 ` [PATCH RFC v2 05/12] ipcomp6: " Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 06/12] vti6: Remove dst_entry caching Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 07/12] vti6: Remove caching of flow informations Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 08/12] vti6: Update the ipv6 side to use its own receive hook Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 09/12] xfrm6: Remove xfrm_tunnel_notifier Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 10/12] vti6: Support inter address family tunneling Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 11/12] vti6: Check the tunnel endpoints of the xfrm state and the vti interface Steffen Klassert
2014-03-05 12:41 ` [PATCH RFC v2 12/12] vti6: Enable namespace changing Steffen Klassert
2014-03-14 9:54 ` [PATCH RFC v2 0/12] vti6: prepare namespace and interfamily support Steffen Klassert
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=1394023276-2591-4-git-send-email-steffen.klassert@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=christophe.gouault@6wind.com \
--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).