aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2013-04-05 02:41:12 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2013-04-08 06:34:01 -0400
commitaaa795ad25e18488b026572c7ba2ca8f99ced0b7 (patch)
treec3a4063079921aeca40976aa631b8dba0113507d /net/netfilter
parent58e35d1471287c59b9749fb82f04c628c36b9994 (diff)
netfilter: nat: propagate errors from xfrm_me_harder()
Propagate errors from ip_xfrm_me_harder() instead of returning EPERM in all cases. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_nat_core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 8d5769c6d16e..346f871cf096 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -87,9 +87,10 @@ int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family)
87 struct flowi fl; 87 struct flowi fl;
88 unsigned int hh_len; 88 unsigned int hh_len;
89 struct dst_entry *dst; 89 struct dst_entry *dst;
90 int err;
90 91
91 if (xfrm_decode_session(skb, &fl, family) < 0) 92 err = xfrm_decode_session(skb, &fl, family);
92 return -1; 93 return err;
93 94
94 dst = skb_dst(skb); 95 dst = skb_dst(skb);
95 if (dst->xfrm) 96 if (dst->xfrm)
@@ -98,7 +99,7 @@ int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family)
98 99
99 dst = xfrm_lookup(dev_net(dst->dev), dst, &fl, skb->sk, 0); 100 dst = xfrm_lookup(dev_net(dst->dev), dst, &fl, skb->sk, 0);
100 if (IS_ERR(dst)) 101 if (IS_ERR(dst))
101 return -1; 102 return PTR_ERR(dst);
102 103
103 skb_dst_drop(skb); 104 skb_dst_drop(skb);
104 skb_dst_set(skb, dst); 105 skb_dst_set(skb, dst);
@@ -107,7 +108,7 @@ int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family)
107 hh_len = skb_dst(skb)->dev->hard_header_len; 108 hh_len = skb_dst(skb)->dev->hard_header_len;
108 if (skb_headroom(skb) < hh_len && 109 if (skb_headroom(skb) < hh_len &&
109 pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC)) 110 pskb_expand_head(skb, hh_len - skb_headroom(skb), 0, GFP_ATOMIC))
110 return -1; 111 return -ENOMEM;
111 return 0; 112 return 0;
112} 113}
113EXPORT_SYMBOL(nf_xfrm_me_harder); 114EXPORT_SYMBOL(nf_xfrm_me_harder);