Refresh xfrm ABI kluge to work the way it claims to

svn path=/dists/sid/linux/; revision=19446
This commit is contained in:
Ben Hutchings 2012-10-22 04:04:51 +00:00
parent 93fccf5956
commit 89d9dda7d8
1 changed files with 72 additions and 11 deletions

View File

@ -10,19 +10,80 @@ recheck implementation directly.
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -269,11 +269,13 @@ struct xfrm_replay {
@@ -269,9 +269,6 @@ struct xfrm_replay {
int (*check)(struct xfrm_state *x,
struct sk_buff *skb,
__be32 net_seq);
+ void (*notify)(struct xfrm_state *x, int event);
+ int (*overflow)(struct xfrm_state *x, struct sk_buff *skb);
+#ifndef __GENKSYMS__
int (*recheck)(struct xfrm_state *x,
struct sk_buff *skb,
__be32 net_seq);
- void (*notify)(struct xfrm_state *x, int event);
- int (*overflow)(struct xfrm_state *x, struct sk_buff *skb);
+#endif
- int (*recheck)(struct xfrm_state *x,
- struct sk_buff *skb,
- __be32 net_seq);
void (*notify)(struct xfrm_state *x, int event);
int (*overflow)(struct xfrm_state *x, struct sk_buff *skb);
};
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -102,6 +102,19 @@ int xfrm_prepare_input(struct xfrm_state
}
EXPORT_SYMBOL(xfrm_prepare_input);
+extern struct xfrm_replay xfrm_replay_esn;
+extern int xfrm_replay_recheck_esn(struct xfrm_state *x,
+ struct sk_buff *skb, __be32 net_seq);
+
+static int
+xfrm_recheck(struct xfrm_state *x, struct sk_buff *skb, __be32 net_seq)
+{
+ if (x->repl == &xfrm_replay_esn)
+ return xfrm_replay_recheck_esn(x, skb, net_seq);
+ else
+ return x->repl->check(x, skb, net_seq);
+}
+
int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
{
struct net *net = dev_net(skb->dev);
@@ -212,7 +225,7 @@ resume:
/* only the first xfrm gets the encap type */
encap_type = 0;
- if (async && x->repl->recheck(x, skb, seq)) {
+ if (async && xfrm_recheck(x, skb, seq)) {
XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATESEQERROR);
goto drop_unlock;
}
--- a/net/xfrm/xfrm_replay.c
+++ b/net/xfrm/xfrm_replay.c
@@ -420,7 +420,7 @@ err:
return -EINVAL;
}
-static int xfrm_replay_recheck_esn(struct xfrm_state *x,
+int xfrm_replay_recheck_esn(struct xfrm_state *x,
struct sk_buff *skb, __be32 net_seq)
{
if (unlikely(XFRM_SKB_CB(skb)->seq.input.hi !=
@@ -491,7 +491,6 @@ static void xfrm_replay_advance_esn(stru
static struct xfrm_replay xfrm_replay_legacy = {
.advance = xfrm_replay_advance,
.check = xfrm_replay_check,
- .recheck = xfrm_replay_check,
.notify = xfrm_replay_notify,
.overflow = xfrm_replay_overflow,
};
@@ -499,15 +498,13 @@ static struct xfrm_replay xfrm_replay_le
static struct xfrm_replay xfrm_replay_bmp = {
.advance = xfrm_replay_advance_bmp,
.check = xfrm_replay_check_bmp,
- .recheck = xfrm_replay_check_bmp,
.notify = xfrm_replay_notify_bmp,
.overflow = xfrm_replay_overflow_bmp,
};
struct net_device;
-static struct xfrm_replay xfrm_replay_esn = {
+struct xfrm_replay xfrm_replay_esn = {
.advance = xfrm_replay_advance_esn,
.check = xfrm_replay_check_esn,
- .recheck = xfrm_replay_recheck_esn,
.notify = xfrm_replay_notify_bmp,
.overflow = xfrm_replay_overflow_esn,
};