diff options
Diffstat (limited to 'net/ipv4/icmp.c')
| -rw-r--r-- | net/ipv4/icmp.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 5bc13fe816d1..ac4dec132735 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
| @@ -74,6 +74,7 @@ | |||
| 74 | #include <linux/netdevice.h> | 74 | #include <linux/netdevice.h> |
| 75 | #include <linux/string.h> | 75 | #include <linux/string.h> |
| 76 | #include <linux/netfilter_ipv4.h> | 76 | #include <linux/netfilter_ipv4.h> |
| 77 | #include <linux/slab.h> | ||
| 77 | #include <net/snmp.h> | 78 | #include <net/snmp.h> |
| 78 | #include <net/ip.h> | 79 | #include <net/ip.h> |
| 79 | #include <net/route.h> | 80 | #include <net/route.h> |
| @@ -114,7 +115,7 @@ struct icmp_bxm { | |||
| 114 | /* An array of errno for error messages from dest unreach. */ | 115 | /* An array of errno for error messages from dest unreach. */ |
| 115 | /* RFC 1122: 3.2.2.1 States that NET_UNREACH, HOST_UNREACH and SR_FAILED MUST be considered 'transient errs'. */ | 116 | /* RFC 1122: 3.2.2.1 States that NET_UNREACH, HOST_UNREACH and SR_FAILED MUST be considered 'transient errs'. */ |
| 116 | 117 | ||
| 117 | struct icmp_err icmp_err_convert[] = { | 118 | const struct icmp_err icmp_err_convert[] = { |
| 118 | { | 119 | { |
| 119 | .errno = ENETUNREACH, /* ICMP_NET_UNREACH */ | 120 | .errno = ENETUNREACH, /* ICMP_NET_UNREACH */ |
| 120 | .fatal = 0, | 121 | .fatal = 0, |
| @@ -501,15 +502,16 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
| 501 | if (!(rt->rt_flags & RTCF_LOCAL)) { | 502 | if (!(rt->rt_flags & RTCF_LOCAL)) { |
| 502 | struct net_device *dev = NULL; | 503 | struct net_device *dev = NULL; |
| 503 | 504 | ||
| 505 | rcu_read_lock(); | ||
| 504 | if (rt->fl.iif && | 506 | if (rt->fl.iif && |
| 505 | net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) | 507 | net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr) |
| 506 | dev = dev_get_by_index(net, rt->fl.iif); | 508 | dev = dev_get_by_index_rcu(net, rt->fl.iif); |
| 507 | 509 | ||
| 508 | if (dev) { | 510 | if (dev) |
| 509 | saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK); | 511 | saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK); |
| 510 | dev_put(dev); | 512 | else |
| 511 | } else | ||
| 512 | saddr = 0; | 513 | saddr = 0; |
| 514 | rcu_read_unlock(); | ||
| 513 | } | 515 | } |
| 514 | 516 | ||
| 515 | tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) | | 517 | tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) | |
| @@ -1165,6 +1167,10 @@ static int __net_init icmp_sk_init(struct net *net) | |||
| 1165 | sk->sk_sndbuf = | 1167 | sk->sk_sndbuf = |
| 1166 | (2 * ((64 * 1024) + sizeof(struct sk_buff))); | 1168 | (2 * ((64 * 1024) + sizeof(struct sk_buff))); |
| 1167 | 1169 | ||
| 1170 | /* | ||
| 1171 | * Speedup sock_wfree() | ||
| 1172 | */ | ||
| 1173 | sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); | ||
| 1168 | inet_sk(sk)->pmtudisc = IP_PMTUDISC_DONT; | 1174 | inet_sk(sk)->pmtudisc = IP_PMTUDISC_DONT; |
| 1169 | } | 1175 | } |
| 1170 | 1176 | ||
