aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_input.c10
-rw-r--r--net/xfrm/xfrm_output.c16
-rw-r--r--net/xfrm/xfrm_state.c8
-rw-r--r--net/xfrm/xfrm_user.c5
4 files changed, 22 insertions, 17 deletions
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 85d1d4764612..526c4feb3b50 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -238,11 +238,6 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
238 238
239 skb->sp->xvec[skb->sp->len++] = x; 239 skb->sp->xvec[skb->sp->len++] = x;
240 240
241 if (xfrm_tunnel_check(skb, x, family)) {
242 XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEMODEERROR);
243 goto drop;
244 }
245
246 spin_lock(&x->lock); 241 spin_lock(&x->lock);
247 if (unlikely(x->km.state == XFRM_STATE_ACQ)) { 242 if (unlikely(x->km.state == XFRM_STATE_ACQ)) {
248 XFRM_INC_STATS(net, LINUX_MIB_XFRMACQUIREERROR); 243 XFRM_INC_STATS(net, LINUX_MIB_XFRMACQUIREERROR);
@@ -271,6 +266,11 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
271 266
272 spin_unlock(&x->lock); 267 spin_unlock(&x->lock);
273 268
269 if (xfrm_tunnel_check(skb, x, family)) {
270 XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEMODEERROR);
271 goto drop;
272 }
273
274 seq_hi = htonl(xfrm_replay_seqhi(x, seq)); 274 seq_hi = htonl(xfrm_replay_seqhi(x, seq));
275 275
276 XFRM_SKB_CB(skb)->seq.input.low = seq; 276 XFRM_SKB_CB(skb)->seq.input.low = seq;
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 7c532856b398..fbcedbe33190 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -19,7 +19,7 @@
19#include <net/dst.h> 19#include <net/dst.h>
20#include <net/xfrm.h> 20#include <net/xfrm.h>
21 21
22static int xfrm_output2(struct sk_buff *skb); 22static int xfrm_output2(struct sock *sk, struct sk_buff *skb);
23 23
24static int xfrm_skb_check_space(struct sk_buff *skb) 24static int xfrm_skb_check_space(struct sk_buff *skb)
25{ 25{
@@ -130,7 +130,7 @@ int xfrm_output_resume(struct sk_buff *skb, int err)
130 return dst_output(skb); 130 return dst_output(skb);
131 131
132 err = nf_hook(skb_dst(skb)->ops->family, 132 err = nf_hook(skb_dst(skb)->ops->family,
133 NF_INET_POST_ROUTING, skb, 133 NF_INET_POST_ROUTING, skb->sk, skb,
134 NULL, skb_dst(skb)->dev, xfrm_output2); 134 NULL, skb_dst(skb)->dev, xfrm_output2);
135 if (unlikely(err != 1)) 135 if (unlikely(err != 1))
136 goto out; 136 goto out;
@@ -144,12 +144,12 @@ out:
144} 144}
145EXPORT_SYMBOL_GPL(xfrm_output_resume); 145EXPORT_SYMBOL_GPL(xfrm_output_resume);
146 146
147static int xfrm_output2(struct sk_buff *skb) 147static int xfrm_output2(struct sock *sk, struct sk_buff *skb)
148{ 148{
149 return xfrm_output_resume(skb, 1); 149 return xfrm_output_resume(skb, 1);
150} 150}
151 151
152static int xfrm_output_gso(struct sk_buff *skb) 152static int xfrm_output_gso(struct sock *sk, struct sk_buff *skb)
153{ 153{
154 struct sk_buff *segs; 154 struct sk_buff *segs;
155 155
@@ -165,7 +165,7 @@ static int xfrm_output_gso(struct sk_buff *skb)
165 int err; 165 int err;
166 166
167 segs->next = NULL; 167 segs->next = NULL;
168 err = xfrm_output2(segs); 168 err = xfrm_output2(sk, segs);
169 169
170 if (unlikely(err)) { 170 if (unlikely(err)) {
171 kfree_skb_list(nskb); 171 kfree_skb_list(nskb);
@@ -178,13 +178,13 @@ static int xfrm_output_gso(struct sk_buff *skb)
178 return 0; 178 return 0;
179} 179}
180 180
181int xfrm_output(struct sk_buff *skb) 181int xfrm_output(struct sock *sk, struct sk_buff *skb)
182{ 182{
183 struct net *net = dev_net(skb_dst(skb)->dev); 183 struct net *net = dev_net(skb_dst(skb)->dev);
184 int err; 184 int err;
185 185
186 if (skb_is_gso(skb)) 186 if (skb_is_gso(skb))
187 return xfrm_output_gso(skb); 187 return xfrm_output_gso(sk, skb);
188 188
189 if (skb->ip_summed == CHECKSUM_PARTIAL) { 189 if (skb->ip_summed == CHECKSUM_PARTIAL) {
190 err = skb_checksum_help(skb); 190 err = skb_checksum_help(skb);
@@ -195,7 +195,7 @@ int xfrm_output(struct sk_buff *skb)
195 } 195 }
196 } 196 }
197 197
198 return xfrm_output2(skb); 198 return xfrm_output2(sk, skb);
199} 199}
200EXPORT_SYMBOL_GPL(xfrm_output); 200EXPORT_SYMBOL_GPL(xfrm_output);
201 201
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index de971b6d38c5..f5e39e35d73a 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1043,12 +1043,12 @@ static struct xfrm_state *__find_acq_core(struct net *net,
1043 break; 1043 break;
1044 1044
1045 case AF_INET6: 1045 case AF_INET6:
1046 *(struct in6_addr *)x->sel.daddr.a6 = *(struct in6_addr *)daddr; 1046 x->sel.daddr.in6 = daddr->in6;
1047 *(struct in6_addr *)x->sel.saddr.a6 = *(struct in6_addr *)saddr; 1047 x->sel.saddr.in6 = saddr->in6;
1048 x->sel.prefixlen_d = 128; 1048 x->sel.prefixlen_d = 128;
1049 x->sel.prefixlen_s = 128; 1049 x->sel.prefixlen_s = 128;
1050 *(struct in6_addr *)x->props.saddr.a6 = *(struct in6_addr *)saddr; 1050 x->props.saddr.in6 = saddr->in6;
1051 *(struct in6_addr *)x->id.daddr.a6 = *(struct in6_addr *)daddr; 1051 x->id.daddr.in6 = daddr->in6;
1052 break; 1052 break;
1053 } 1053 }
1054 1054
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 7de2ed9ec46d..2091664295ba 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2423,6 +2423,11 @@ static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
2423 const struct xfrm_link *link; 2423 const struct xfrm_link *link;
2424 int type, err; 2424 int type, err;
2425 2425
2426#ifdef CONFIG_COMPAT
2427 if (is_compat_task())
2428 return -ENOTSUPP;
2429#endif
2430
2426 type = nlh->nlmsg_type; 2431 type = nlh->nlmsg_type;
2427 if (type > XFRM_MSG_MAX) 2432 if (type > XFRM_MSG_MAX)
2428 return -EINVAL; 2433 return -EINVAL;