icmp: move icmp_err_convert[] to .rodata
[safe/jmp/linux-2.6] / net / ipv4 / icmp.c
index 97c410e..4b4c2bc 100644 (file)
@@ -114,7 +114,7 @@ struct icmp_bxm {
 /* An array of errno for error messages from dest unreach. */
 /* RFC 1122: 3.2.2.1 States that NET_UNREACH, HOST_UNREACH and SR_FAILED MUST be considered 'transient errs'. */
 
-struct icmp_err icmp_err_convert[] = {
+const struct icmp_err icmp_err_convert[] = {
        {
                .errno = ENETUNREACH,   /* ICMP_NET_UNREACH */
                .fatal = 0,
@@ -501,15 +501,16 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
        if (!(rt->rt_flags & RTCF_LOCAL)) {
                struct net_device *dev = NULL;
 
+               rcu_read_lock();
                if (rt->fl.iif &&
                        net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr)
-                       dev = dev_get_by_index(net, rt->fl.iif);
+                       dev = dev_get_by_index_rcu(net, rt->fl.iif);
 
-               if (dev) {
+               if (dev)
                        saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
-                       dev_put(dev);
-               } else
+               else
                        saddr = 0;
+               rcu_read_unlock();
        }
 
        tos = icmp_pointers[type].error ? ((iph->tos & IPTOS_TOS_MASK) |
@@ -655,7 +656,7 @@ static void icmp_unreach(struct sk_buff *skb)
        struct iphdr *iph;
        struct icmphdr *icmph;
        int hash, protocol;
-       struct net_protocol *ipprot;
+       const struct net_protocol *ipprot;
        u32 info = 0;
        struct net *net;
 
@@ -1165,6 +1166,10 @@ static int __net_init icmp_sk_init(struct net *net)
                sk->sk_sndbuf =
                        (2 * ((64 * 1024) + sizeof(struct sk_buff)));
 
+               /*
+                * Speedup sock_wfree()
+                */
+               sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
                inet_sk(sk)->pmtudisc = IP_PMTUDISC_DONT;
        }