diff options
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_output.c | 21 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 9 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 7 |
3 files changed, 24 insertions, 13 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index eb4a84288648..3bb2cdc13b46 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
@@ -214,5 +214,26 @@ int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb) | |||
214 | return inner_mode->afinfo->extract_output(x, skb); | 214 | return inner_mode->afinfo->extract_output(x, skb); |
215 | } | 215 | } |
216 | 216 | ||
217 | void xfrm_local_error(struct sk_buff *skb, int mtu) | ||
218 | { | ||
219 | unsigned int proto; | ||
220 | struct xfrm_state_afinfo *afinfo; | ||
221 | |||
222 | if (skb->protocol == htons(ETH_P_IP)) | ||
223 | proto = AF_INET; | ||
224 | else if (skb->protocol == htons(ETH_P_IPV6)) | ||
225 | proto = AF_INET6; | ||
226 | else | ||
227 | return; | ||
228 | |||
229 | afinfo = xfrm_state_get_afinfo(proto); | ||
230 | if (!afinfo) | ||
231 | return; | ||
232 | |||
233 | afinfo->local_error(skb, mtu); | ||
234 | xfrm_state_put_afinfo(afinfo); | ||
235 | } | ||
236 | |||
217 | EXPORT_SYMBOL_GPL(xfrm_output); | 237 | EXPORT_SYMBOL_GPL(xfrm_output); |
218 | EXPORT_SYMBOL_GPL(xfrm_inner_extract_output); | 238 | EXPORT_SYMBOL_GPL(xfrm_inner_extract_output); |
239 | EXPORT_SYMBOL_GPL(xfrm_local_error); | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index ad8cc7bcf065..ed38d5d81f9e 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -320,10 +320,8 @@ static void xfrm_queue_purge(struct sk_buff_head *list) | |||
320 | { | 320 | { |
321 | struct sk_buff *skb; | 321 | struct sk_buff *skb; |
322 | 322 | ||
323 | while ((skb = skb_dequeue(list)) != NULL) { | 323 | while ((skb = skb_dequeue(list)) != NULL) |
324 | dev_put(skb->dev); | ||
325 | kfree_skb(skb); | 324 | kfree_skb(skb); |
326 | } | ||
327 | } | 325 | } |
328 | 326 | ||
329 | /* Rule must be locked. Release descentant resources, announce | 327 | /* Rule must be locked. Release descentant resources, announce |
@@ -1764,7 +1762,6 @@ static void xfrm_policy_queue_process(unsigned long arg) | |||
1764 | struct sk_buff *skb; | 1762 | struct sk_buff *skb; |
1765 | struct sock *sk; | 1763 | struct sock *sk; |
1766 | struct dst_entry *dst; | 1764 | struct dst_entry *dst; |
1767 | struct net_device *dev; | ||
1768 | struct xfrm_policy *pol = (struct xfrm_policy *)arg; | 1765 | struct xfrm_policy *pol = (struct xfrm_policy *)arg; |
1769 | struct xfrm_policy_queue *pq = &pol->polq; | 1766 | struct xfrm_policy_queue *pq = &pol->polq; |
1770 | struct flowi fl; | 1767 | struct flowi fl; |
@@ -1811,7 +1808,6 @@ static void xfrm_policy_queue_process(unsigned long arg) | |||
1811 | dst = xfrm_lookup(xp_net(pol), skb_dst(skb)->path, | 1808 | dst = xfrm_lookup(xp_net(pol), skb_dst(skb)->path, |
1812 | &fl, skb->sk, 0); | 1809 | &fl, skb->sk, 0); |
1813 | if (IS_ERR(dst)) { | 1810 | if (IS_ERR(dst)) { |
1814 | dev_put(skb->dev); | ||
1815 | kfree_skb(skb); | 1811 | kfree_skb(skb); |
1816 | continue; | 1812 | continue; |
1817 | } | 1813 | } |
@@ -1820,9 +1816,7 @@ static void xfrm_policy_queue_process(unsigned long arg) | |||
1820 | skb_dst_drop(skb); | 1816 | skb_dst_drop(skb); |
1821 | skb_dst_set(skb, dst); | 1817 | skb_dst_set(skb, dst); |
1822 | 1818 | ||
1823 | dev = skb->dev; | ||
1824 | err = dst_output(skb); | 1819 | err = dst_output(skb); |
1825 | dev_put(dev); | ||
1826 | } | 1820 | } |
1827 | 1821 | ||
1828 | return; | 1822 | return; |
@@ -1845,7 +1839,6 @@ static int xdst_queue_output(struct sk_buff *skb) | |||
1845 | } | 1839 | } |
1846 | 1840 | ||
1847 | skb_dst_force(skb); | 1841 | skb_dst_force(skb); |
1848 | dev_hold(skb->dev); | ||
1849 | 1842 | ||
1850 | spin_lock_bh(&pq->hold_queue.lock); | 1843 | spin_lock_bh(&pq->hold_queue.lock); |
1851 | 1844 | ||
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 4f8ace855864..b9c3f9e943a9 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -39,9 +39,6 @@ static DEFINE_SPINLOCK(xfrm_state_lock); | |||
39 | 39 | ||
40 | static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; | 40 | static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; |
41 | 41 | ||
42 | static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); | ||
43 | static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo); | ||
44 | |||
45 | static inline unsigned int xfrm_dst_hash(struct net *net, | 42 | static inline unsigned int xfrm_dst_hash(struct net *net, |
46 | const xfrm_address_t *daddr, | 43 | const xfrm_address_t *daddr, |
47 | const xfrm_address_t *saddr, | 44 | const xfrm_address_t *saddr, |
@@ -1863,7 +1860,7 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo) | |||
1863 | } | 1860 | } |
1864 | EXPORT_SYMBOL(xfrm_state_unregister_afinfo); | 1861 | EXPORT_SYMBOL(xfrm_state_unregister_afinfo); |
1865 | 1862 | ||
1866 | static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family) | 1863 | struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family) |
1867 | { | 1864 | { |
1868 | struct xfrm_state_afinfo *afinfo; | 1865 | struct xfrm_state_afinfo *afinfo; |
1869 | if (unlikely(family >= NPROTO)) | 1866 | if (unlikely(family >= NPROTO)) |
@@ -1875,7 +1872,7 @@ static struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family) | |||
1875 | return afinfo; | 1872 | return afinfo; |
1876 | } | 1873 | } |
1877 | 1874 | ||
1878 | static void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo) | 1875 | void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo) |
1879 | { | 1876 | { |
1880 | rcu_read_unlock(); | 1877 | rcu_read_unlock(); |
1881 | } | 1878 | } |