aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bridge/br_fdb.c14
-rw-r--r--net/bridge/br_stp.c3
-rw-r--r--net/bridge/br_stp_timer.c2
-rw-r--r--net/core/sysctl_net_core.c9
-rw-r--r--net/core/utils.c6
-rw-r--r--net/ieee80211/ieee80211_module.c2
-rw-r--r--net/ieee80211/softmac/ieee80211softmac_module.c5
-rw-r--r--net/ipv4/fib_frontend.c11
-rw-r--r--net/ipv4/tcp.c5
-rw-r--r--net/ipv4/tcp_probe.c5
-rw-r--r--net/ipv4/tcp_timer.c4
-rw-r--r--net/ipv4/xfrm4_input.c6
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c2
-rw-r--r--net/ipv6/ah6.c2
-rw-r--r--net/ipv6/ip6_fib.c9
-rw-r--r--net/ipv6/xfrm6_input.c6
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c1
-rw-r--r--net/packet/af_packet.c56
-rw-r--r--net/xfrm/xfrm_policy.c3
-rw-r--r--net/xfrm/xfrm_state.c15
20 files changed, 65 insertions, 101 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 91b017016d5..3fc69729381 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -121,6 +121,7 @@ void br_fdb_cleanup(unsigned long _data)
121{ 121{
122 struct net_bridge *br = (struct net_bridge *)_data; 122 struct net_bridge *br = (struct net_bridge *)_data;
123 unsigned long delay = hold_time(br); 123 unsigned long delay = hold_time(br);
124 unsigned long next_timer = jiffies + br->forward_delay;
124 int i; 125 int i;
125 126
126 spin_lock_bh(&br->hash_lock); 127 spin_lock_bh(&br->hash_lock);
@@ -129,14 +130,21 @@ void br_fdb_cleanup(unsigned long _data)
129 struct hlist_node *h, *n; 130 struct hlist_node *h, *n;
130 131
131 hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { 132 hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) {
132 if (!f->is_static && 133 unsigned long this_timer;
133 time_before_eq(f->ageing_timer + delay, jiffies)) 134 if (f->is_static)
135 continue;
136 this_timer = f->ageing_timer + delay;
137 if (time_before_eq(this_timer, jiffies))
134 fdb_delete(f); 138 fdb_delete(f);
139 else if (this_timer < next_timer)
140 next_timer = this_timer;
135 } 141 }
136 } 142 }
137 spin_unlock_bh(&br->hash_lock); 143 spin_unlock_bh(&br->hash_lock);
138 144
139 mod_timer(&br->gc_timer, jiffies + HZ/10); 145 /* Add HZ/4 to ensure we round the jiffies upwards to be after the next
146 * timer, otherwise we might round down and will have no-op run. */
147 mod_timer(&br->gc_timer, round_jiffies(next_timer + HZ/4));
140} 148}
141 149
142/* Completely flush all dynamic entries in forwarding database.*/ 150/* Completely flush all dynamic entries in forwarding database.*/
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 0e035d6162c..e38034aa56f 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -178,7 +178,8 @@ void br_transmit_config(struct net_bridge_port *p)
178 br_send_config_bpdu(p, &bpdu); 178 br_send_config_bpdu(p, &bpdu);
179 p->topology_change_ack = 0; 179 p->topology_change_ack = 0;
180 p->config_pending = 0; 180 p->config_pending = 0;
181 mod_timer(&p->hold_timer, jiffies + BR_HOLD_TIME); 181 mod_timer(&p->hold_timer,
182 round_jiffies(jiffies + BR_HOLD_TIME));
182 } 183 }
183} 184}
184 185
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c
index 24e0ca4a313..77f5255e691 100644
--- a/net/bridge/br_stp_timer.c
+++ b/net/bridge/br_stp_timer.c
@@ -42,7 +42,7 @@ static void br_hello_timer_expired(unsigned long arg)
42 if (br->dev->flags & IFF_UP) { 42 if (br->dev->flags & IFF_UP) {
43 br_config_bpdu_generation(br); 43 br_config_bpdu_generation(br);
44 44
45 mod_timer(&br->hello_timer, jiffies + br->hello_time); 45 mod_timer(&br->hello_timer, round_jiffies(jiffies + br->hello_time));
46 } 46 }
47 spin_unlock(&br->lock); 47 spin_unlock(&br->lock);
48} 48}
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index f34aca041a2..6d5ea976204 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -25,6 +25,7 @@ extern int sysctl_core_destroy_delay;
25extern u32 sysctl_xfrm_aevent_etime; 25extern u32 sysctl_xfrm_aevent_etime;
26extern u32 sysctl_xfrm_aevent_rseqth; 26extern u32 sysctl_xfrm_aevent_rseqth;
27extern int sysctl_xfrm_larval_drop; 27extern int sysctl_xfrm_larval_drop;
28extern u32 sysctl_xfrm_acq_expires;
28#endif 29#endif
29 30
30ctl_table core_table[] = { 31ctl_table core_table[] = {
@@ -127,6 +128,14 @@ ctl_table core_table[] = {
127 .mode = 0644, 128 .mode = 0644,
128 .proc_handler = &proc_dointvec 129 .proc_handler = &proc_dointvec
129 }, 130 },
131 {
132 .ctl_name = CTL_UNNUMBERED,
133 .procname = "xfrm_acq_expires",
134 .data = &sysctl_xfrm_acq_expires,
135 .maxlen = sizeof(int),
136 .mode = 0644,
137 .proc_handler = &proc_dointvec
138 },
130#endif /* CONFIG_XFRM */ 139#endif /* CONFIG_XFRM */
131#endif /* CONFIG_NET */ 140#endif /* CONFIG_NET */
132 { 141 {
diff --git a/net/core/utils.c b/net/core/utils.c
index adecfd281ae..2030bb8c2d3 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -139,16 +139,16 @@ int in4_pton(const char *src, int srclen,
139 while(1) { 139 while(1) {
140 int c; 140 int c;
141 c = xdigit2bin(srclen > 0 ? *s : '\0', delim); 141 c = xdigit2bin(srclen > 0 ? *s : '\0', delim);
142 if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM))) { 142 if (!(c & (IN6PTON_DIGIT | IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK))) {
143 goto out; 143 goto out;
144 } 144 }
145 if (c & (IN6PTON_DOT | IN6PTON_DELIM)) { 145 if (c & (IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK)) {
146 if (w == 0) 146 if (w == 0)
147 goto out; 147 goto out;
148 *d++ = w & 0xff; 148 *d++ = w & 0xff;
149 w = 0; 149 w = 0;
150 i++; 150 i++;
151 if (c & IN6PTON_DELIM) { 151 if (c & (IN6PTON_DELIM | IN6PTON_COLON_MASK)) {
152 if (i != 4) 152 if (i != 4)
153 goto out; 153 goto out;
154 break; 154 break;
diff --git a/net/ieee80211/ieee80211_module.c b/net/ieee80211/ieee80211_module.c
index 7ec6610841b..17ad278696e 100644
--- a/net/ieee80211/ieee80211_module.c
+++ b/net/ieee80211/ieee80211_module.c
@@ -140,7 +140,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
140 140
141 dev = alloc_etherdev(sizeof(struct ieee80211_device) + sizeof_priv); 141 dev = alloc_etherdev(sizeof(struct ieee80211_device) + sizeof_priv);
142 if (!dev) { 142 if (!dev) {
143 IEEE80211_ERROR("Unable to network device.\n"); 143 IEEE80211_ERROR("Unable to allocate network device.\n");
144 goto failed; 144 goto failed;
145 } 145 }
146 ieee = netdev_priv(dev); 146 ieee = netdev_priv(dev);
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c
index e9cdc6615dd..c308756c2f9 100644
--- a/net/ieee80211/softmac/ieee80211softmac_module.c
+++ b/net/ieee80211/softmac/ieee80211softmac_module.c
@@ -33,7 +33,10 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv)
33 struct ieee80211softmac_device *softmac; 33 struct ieee80211softmac_device *softmac;
34 struct net_device *dev; 34 struct net_device *dev;
35 35
36 dev = alloc_ieee80211(sizeof(struct ieee80211softmac_device) + sizeof_priv); 36 dev = alloc_ieee80211(sizeof(*softmac) + sizeof_priv);
37 if (!dev)
38 return NULL;
39
37 softmac = ieee80211_priv(dev); 40 softmac = ieee80211_priv(dev);
38 softmac->dev = dev; 41 softmac->dev = dev;
39 softmac->ieee = netdev_priv(dev); 42 softmac->ieee = netdev_priv(dev);
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 837f2957fa8..9ad1f6252a9 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -250,8 +250,6 @@ e_inval:
250 return -EINVAL; 250 return -EINVAL;
251} 251}
252 252
253#ifndef CONFIG_IP_NOSIOCRT
254
255static inline __be32 sk_extract_addr(struct sockaddr *addr) 253static inline __be32 sk_extract_addr(struct sockaddr *addr)
256{ 254{
257 return ((struct sockaddr_in *) addr)->sin_addr.s_addr; 255 return ((struct sockaddr_in *) addr)->sin_addr.s_addr;
@@ -443,15 +441,6 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
443 return -EINVAL; 441 return -EINVAL;
444} 442}
445 443
446#else
447
448int ip_rt_ioctl(unsigned int cmd, void *arg)
449{
450 return -EINVAL;
451}
452
453#endif
454
455struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = { 444struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = {
456 [RTA_DST] = { .type = NLA_U32 }, 445 [RTA_DST] = { .type = NLA_U32 },
457 [RTA_SRC] = { .type = NLA_U32 }, 446 [RTA_SRC] = { .type = NLA_U32 },
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index bd4c295f5d7..766314505c0 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1674,9 +1674,8 @@ adjudge_to_death:
1674 } 1674 }
1675 if (sk->sk_state != TCP_CLOSE) { 1675 if (sk->sk_state != TCP_CLOSE) {
1676 sk_stream_mem_reclaim(sk); 1676 sk_stream_mem_reclaim(sk);
1677 if (atomic_read(sk->sk_prot->orphan_count) > sysctl_tcp_max_orphans || 1677 if (tcp_too_many_orphans(sk,
1678 (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && 1678 atomic_read(sk->sk_prot->orphan_count))) {
1679 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) {
1680 if (net_ratelimit()) 1679 if (net_ratelimit())
1681 printk(KERN_INFO "TCP: too many of orphaned " 1680 printk(KERN_INFO "TCP: too many of orphaned "
1682 "sockets\n"); 1681 "sockets\n");
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index 3938d5dbdf2..760165a0800 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -80,7 +80,8 @@ static void printl(const char *fmt, ...)
80 80
81 kfifo_put(tcpw.fifo, tbuf, len); 81 kfifo_put(tcpw.fifo, tbuf, len);
82 wake_up(&tcpw.wait); 82 wake_up(&tcpw.wait);
83} 83} __attribute__ ((format (printf, 1, 2)));
84
84 85
85/* 86/*
86 * Hook inserted to be called before each receive packet. 87 * Hook inserted to be called before each receive packet.
@@ -95,7 +96,7 @@ static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
95 /* Only update if port matches */ 96 /* Only update if port matches */
96 if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port) 97 if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port)
97 && (full || tp->snd_cwnd != tcpw.lastcwnd)) { 98 && (full || tp->snd_cwnd != tcpw.lastcwnd)) {
98 printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %#x %#x %u %u %u\n", 99 printl("%d.%d.%d.%d:%u %d.%d.%d.%d:%u %d %#x %#x %u %u %u %u\n",
99 NIPQUAD(inet->saddr), ntohs(inet->sport), 100 NIPQUAD(inet->saddr), ntohs(inet->sport),
100 NIPQUAD(inet->daddr), ntohs(inet->dport), 101 NIPQUAD(inet->daddr), ntohs(inet->dport),
101 skb->len, tp->snd_nxt, tp->snd_una, 102 skb->len, tp->snd_nxt, tp->snd_una,
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 2ca97b20929..e61340150ba 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -78,9 +78,7 @@ static int tcp_out_of_resources(struct sock *sk, int do_reset)
78 if (sk->sk_err_soft) 78 if (sk->sk_err_soft)
79 orphans <<= 1; 79 orphans <<= 1;
80 80
81 if (orphans >= sysctl_tcp_max_orphans || 81 if (tcp_too_many_orphans(sk, orphans)) {
82 (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
83 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) {
84 if (net_ratelimit()) 82 if (net_ratelimit())
85 printk(KERN_INFO "Out of socket memory\n"); 83 printk(KERN_INFO "Out of socket memory\n");
86 84
diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
index 5ceca951d73..fa1902dc81b 100644
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -139,10 +139,8 @@ int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type)
139 nf_reset(skb); 139 nf_reset(skb);
140 140
141 if (decaps) { 141 if (decaps) {
142 if (!(skb->dev->flags&IFF_LOOPBACK)) { 142 dst_release(skb->dst);
143 dst_release(skb->dst); 143 skb->dst = NULL;
144 skb->dst = NULL;
145 }
146 netif_rx(skb); 144 netif_rx(skb);
147 return 0; 145 return 0;
148 } else { 146 } else {
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index a2f2e6a5ec5..9963700e74c 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -85,6 +85,8 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
85 top_iph->saddr = x->props.saddr.a4; 85 top_iph->saddr = x->props.saddr.a4;
86 top_iph->daddr = x->id.daddr.a4; 86 top_iph->daddr = x->id.daddr.a4;
87 87
88 skb->protocol = htons(ETH_P_IP);
89
88 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options)); 90 memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
89 return 0; 91 return 0;
90} 92}
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index b696c840120..128f94c79c6 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -247,7 +247,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
247 memcpy(tmp_base, top_iph, sizeof(tmp_base)); 247 memcpy(tmp_base, top_iph, sizeof(tmp_base));
248 248
249 tmp_ext = NULL; 249 tmp_ext = NULL;
250 extlen = skb_transport_offset(skb) + sizeof(struct ipv6hdr); 250 extlen = skb_transport_offset(skb) - sizeof(struct ipv6hdr);
251 if (extlen) { 251 if (extlen) {
252 extlen += sizeof(*tmp_ext); 252 extlen += sizeof(*tmp_ext);
253 tmp_ext = kmalloc(extlen, GFP_ATOMIC); 253 tmp_ext = kmalloc(extlen, GFP_ATOMIC);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index ca08ee88d07..662a7d9681f 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -619,14 +619,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
619 619
620 ins = &fn->leaf; 620 ins = &fn->leaf;
621 621
622 if (fn->fn_flags&RTN_TL_ROOT &&
623 fn->leaf == &ip6_null_entry &&
624 !(rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) ){
625 fn->leaf = rt;
626 rt->u.dst.rt6_next = NULL;
627 goto out;
628 }
629
630 for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) { 622 for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) {
631 /* 623 /*
632 * Search for duplicates 624 * Search for duplicates
@@ -666,7 +658,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
666 * insert node 658 * insert node
667 */ 659 */
668 660
669out:
670 rt->u.dst.rt6_next = iter; 661 rt->u.dst.rt6_next = iter;
671 *ins = rt; 662 *ins = rt;
672 rt->rt6i_node = fn; 663 rt->rt6i_node = fn;
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
index d7ed8aa56ec..c858537cec4 100644
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -104,10 +104,8 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
104 nf_reset(skb); 104 nf_reset(skb);
105 105
106 if (decaps) { 106 if (decaps) {
107 if (!(skb->dev->flags&IFF_LOOPBACK)) { 107 dst_release(skb->dst);
108 dst_release(skb->dst); 108 skb->dst = NULL;
109 skb->dst = NULL;
110 }
111 netif_rx(skb); 109 netif_rx(skb);
112 return -1; 110 return -1;
113 } else { 111 } else {
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index a6c0cdf46ad..9fc95bc6509 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -80,6 +80,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
80 top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT); 80 top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT);
81 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); 81 ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr);
82 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); 82 ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr);
83 skb->protocol = htons(ETH_P_IPV6);
83 return 0; 84 return 0;
84} 85}
85 86
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 02e401cd683..f8b83014ccc 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -83,22 +83,6 @@
83#include <net/inet_common.h> 83#include <net/inet_common.h>
84#endif 84#endif
85 85
86#define CONFIG_SOCK_PACKET 1
87
88/*
89 Proposed replacement for SIOC{ADD,DEL}MULTI and
90 IFF_PROMISC, IFF_ALLMULTI flags.
91
92 It is more expensive, but I believe,
93 it is really correct solution: reentereble, safe and fault tolerant.
94
95 IFF_PROMISC/IFF_ALLMULTI/SIOC{ADD/DEL}MULTI are faked by keeping
96 reference count and global flag, so that real status is
97 (gflag|(count != 0)), so that we can use obsolete faulty interface
98 not harming clever users.
99 */
100#define CONFIG_PACKET_MULTICAST 1
101
102/* 86/*
103 Assumptions: 87 Assumptions:
104 - if device has no dev->hard_header routine, it adds and removes ll header 88 - if device has no dev->hard_header routine, it adds and removes ll header
@@ -159,7 +143,6 @@ static atomic_t packet_socks_nr;
159 143
160/* Private packet socket structures. */ 144/* Private packet socket structures. */
161 145
162#ifdef CONFIG_PACKET_MULTICAST
163struct packet_mclist 146struct packet_mclist
164{ 147{
165 struct packet_mclist *next; 148 struct packet_mclist *next;
@@ -179,7 +162,7 @@ struct packet_mreq_max
179 unsigned short mr_alen; 162 unsigned short mr_alen;
180 unsigned char mr_address[MAX_ADDR_LEN]; 163 unsigned char mr_address[MAX_ADDR_LEN];
181}; 164};
182#endif 165
183#ifdef CONFIG_PACKET_MMAP 166#ifdef CONFIG_PACKET_MMAP
184static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing); 167static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing);
185#endif 168#endif
@@ -205,9 +188,7 @@ struct packet_sock {
205 origdev:1; 188 origdev:1;
206 int ifindex; /* bound device */ 189 int ifindex; /* bound device */
207 __be16 num; 190 __be16 num;
208#ifdef CONFIG_PACKET_MULTICAST
209 struct packet_mclist *mclist; 191 struct packet_mclist *mclist;
210#endif
211#ifdef CONFIG_PACKET_MMAP 192#ifdef CONFIG_PACKET_MMAP
212 atomic_t mapped; 193 atomic_t mapped;
213 unsigned int pg_vec_order; 194 unsigned int pg_vec_order;
@@ -263,7 +244,6 @@ static void packet_sock_destruct(struct sock *sk)
263 244
264static const struct proto_ops packet_ops; 245static const struct proto_ops packet_ops;
265 246
266#ifdef CONFIG_SOCK_PACKET
267static const struct proto_ops packet_ops_spkt; 247static const struct proto_ops packet_ops_spkt;
268 248
269static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) 249static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
@@ -435,7 +415,6 @@ out_unlock:
435 dev_put(dev); 415 dev_put(dev);
436 return err; 416 return err;
437} 417}
438#endif
439 418
440static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, 419static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk,
441 unsigned int res) 420 unsigned int res)
@@ -851,9 +830,7 @@ static int packet_release(struct socket *sock)
851 __sock_put(sk); 830 __sock_put(sk);
852 } 831 }
853 832
854#ifdef CONFIG_PACKET_MULTICAST
855 packet_flush_mclist(sk); 833 packet_flush_mclist(sk);
856#endif
857 834
858#ifdef CONFIG_PACKET_MMAP 835#ifdef CONFIG_PACKET_MMAP
859 if (po->pg_vec) { 836 if (po->pg_vec) {
@@ -936,8 +913,6 @@ out_unlock:
936 * Bind a packet socket to a device 913 * Bind a packet socket to a device
937 */ 914 */
938 915
939#ifdef CONFIG_SOCK_PACKET
940
941static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) 916static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len)
942{ 917{
943 struct sock *sk=sock->sk; 918 struct sock *sk=sock->sk;
@@ -960,7 +935,6 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add
960 } 935 }
961 return err; 936 return err;
962} 937}
963#endif
964 938
965static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 939static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
966{ 940{
@@ -1012,11 +986,8 @@ static int packet_create(struct socket *sock, int protocol)
1012 986
1013 if (!capable(CAP_NET_RAW)) 987 if (!capable(CAP_NET_RAW))
1014 return -EPERM; 988 return -EPERM;
1015 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW 989 if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW &&
1016#ifdef CONFIG_SOCK_PACKET 990 sock->type != SOCK_PACKET)
1017 && sock->type != SOCK_PACKET
1018#endif
1019 )
1020 return -ESOCKTNOSUPPORT; 991 return -ESOCKTNOSUPPORT;
1021 992
1022 sock->state = SS_UNCONNECTED; 993 sock->state = SS_UNCONNECTED;
@@ -1027,10 +998,9 @@ static int packet_create(struct socket *sock, int protocol)
1027 goto out; 998 goto out;
1028 999
1029 sock->ops = &packet_ops; 1000 sock->ops = &packet_ops;
1030#ifdef CONFIG_SOCK_PACKET
1031 if (sock->type == SOCK_PACKET) 1001 if (sock->type == SOCK_PACKET)
1032 sock->ops = &packet_ops_spkt; 1002 sock->ops = &packet_ops_spkt;
1033#endif 1003
1034 sock_init_data(sock, sk); 1004 sock_init_data(sock, sk);
1035 1005
1036 po = pkt_sk(sk); 1006 po = pkt_sk(sk);
@@ -1046,10 +1016,10 @@ static int packet_create(struct socket *sock, int protocol)
1046 1016
1047 spin_lock_init(&po->bind_lock); 1017 spin_lock_init(&po->bind_lock);
1048 po->prot_hook.func = packet_rcv; 1018 po->prot_hook.func = packet_rcv;
1049#ifdef CONFIG_SOCK_PACKET 1019
1050 if (sock->type == SOCK_PACKET) 1020 if (sock->type == SOCK_PACKET)
1051 po->prot_hook.func = packet_rcv_spkt; 1021 po->prot_hook.func = packet_rcv_spkt;
1052#endif 1022
1053 po->prot_hook.af_packet_priv = sk; 1023 po->prot_hook.af_packet_priv = sk;
1054 1024
1055 if (proto) { 1025 if (proto) {
@@ -1169,7 +1139,6 @@ out:
1169 return err; 1139 return err;
1170} 1140}
1171 1141
1172#ifdef CONFIG_SOCK_PACKET
1173static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, 1142static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
1174 int *uaddr_len, int peer) 1143 int *uaddr_len, int peer)
1175{ 1144{
@@ -1190,7 +1159,6 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
1190 1159
1191 return 0; 1160 return 0;
1192} 1161}
1193#endif
1194 1162
1195static int packet_getname(struct socket *sock, struct sockaddr *uaddr, 1163static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
1196 int *uaddr_len, int peer) 1164 int *uaddr_len, int peer)
@@ -1221,7 +1189,6 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
1221 return 0; 1189 return 0;
1222} 1190}
1223 1191
1224#ifdef CONFIG_PACKET_MULTICAST
1225static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what) 1192static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what)
1226{ 1193{
1227 switch (i->type) { 1194 switch (i->type) {
@@ -1349,7 +1316,6 @@ static void packet_flush_mclist(struct sock *sk)
1349 } 1316 }
1350 rtnl_unlock(); 1317 rtnl_unlock();
1351} 1318}
1352#endif
1353 1319
1354static int 1320static int
1355packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) 1321packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen)
@@ -1362,7 +1328,6 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
1362 return -ENOPROTOOPT; 1328 return -ENOPROTOOPT;
1363 1329
1364 switch(optname) { 1330 switch(optname) {
1365#ifdef CONFIG_PACKET_MULTICAST
1366 case PACKET_ADD_MEMBERSHIP: 1331 case PACKET_ADD_MEMBERSHIP:
1367 case PACKET_DROP_MEMBERSHIP: 1332 case PACKET_DROP_MEMBERSHIP:
1368 { 1333 {
@@ -1383,7 +1348,7 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
1383 ret = packet_mc_drop(sk, &mreq); 1348 ret = packet_mc_drop(sk, &mreq);
1384 return ret; 1349 return ret;
1385 } 1350 }
1386#endif 1351
1387#ifdef CONFIG_PACKET_MMAP 1352#ifdef CONFIG_PACKET_MMAP
1388 case PACKET_RX_RING: 1353 case PACKET_RX_RING:
1389 { 1354 {
@@ -1506,11 +1471,10 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void
1506 1471
1507 switch (msg) { 1472 switch (msg) {
1508 case NETDEV_UNREGISTER: 1473 case NETDEV_UNREGISTER:
1509#ifdef CONFIG_PACKET_MULTICAST
1510 if (po->mclist) 1474 if (po->mclist)
1511 packet_dev_mclist(dev, po->mclist, -1); 1475 packet_dev_mclist(dev, po->mclist, -1);
1512 // fallthrough 1476 /* fallthrough */
1513#endif 1477
1514 case NETDEV_DOWN: 1478 case NETDEV_DOWN:
1515 if (dev->ifindex == po->ifindex) { 1479 if (dev->ifindex == po->ifindex) {
1516 spin_lock(&po->bind_lock); 1480 spin_lock(&po->bind_lock);
@@ -1856,7 +1820,6 @@ out:
1856#endif 1820#endif
1857 1821
1858 1822
1859#ifdef CONFIG_SOCK_PACKET
1860static const struct proto_ops packet_ops_spkt = { 1823static const struct proto_ops packet_ops_spkt = {
1861 .family = PF_PACKET, 1824 .family = PF_PACKET,
1862 .owner = THIS_MODULE, 1825 .owner = THIS_MODULE,
@@ -1877,7 +1840,6 @@ static const struct proto_ops packet_ops_spkt = {
1877 .mmap = sock_no_mmap, 1840 .mmap = sock_no_mmap,
1878 .sendpage = sock_no_sendpage, 1841 .sendpage = sock_no_sendpage,
1879}; 1842};
1880#endif
1881 1843
1882static const struct proto_ops packet_ops = { 1844static const struct proto_ops packet_ops = {
1883 .family = PF_PACKET, 1845 .family = PF_PACKET,
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b8bab89616a..64a375178c5 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -26,10 +26,11 @@
26#include <net/xfrm.h> 26#include <net/xfrm.h>
27#include <net/ip.h> 27#include <net/ip.h>
28#include <linux/audit.h> 28#include <linux/audit.h>
29#include <linux/cache.h>
29 30
30#include "xfrm_hash.h" 31#include "xfrm_hash.h"
31 32
32int sysctl_xfrm_larval_drop; 33int sysctl_xfrm_larval_drop __read_mostly;
33 34
34DEFINE_MUTEX(xfrm_cfg_mutex); 35DEFINE_MUTEX(xfrm_cfg_mutex);
35EXPORT_SYMBOL(xfrm_cfg_mutex); 36EXPORT_SYMBOL(xfrm_cfg_mutex);
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 9955ff4da0a..372f06eb8bb 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -21,18 +21,21 @@
21#include <linux/cache.h> 21#include <linux/cache.h>
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <linux/audit.h> 23#include <linux/audit.h>
24#include <linux/cache.h>
24 25
25#include "xfrm_hash.h" 26#include "xfrm_hash.h"
26 27
27struct sock *xfrm_nl; 28struct sock *xfrm_nl;
28EXPORT_SYMBOL(xfrm_nl); 29EXPORT_SYMBOL(xfrm_nl);
29 30
30u32 sysctl_xfrm_aevent_etime = XFRM_AE_ETIME; 31u32 sysctl_xfrm_aevent_etime __read_mostly = XFRM_AE_ETIME;
31EXPORT_SYMBOL(sysctl_xfrm_aevent_etime); 32EXPORT_SYMBOL(sysctl_xfrm_aevent_etime);
32 33
33u32 sysctl_xfrm_aevent_rseqth = XFRM_AE_SEQT_SIZE; 34u32 sysctl_xfrm_aevent_rseqth __read_mostly = XFRM_AE_SEQT_SIZE;
34EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth); 35EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth);
35 36
37u32 sysctl_xfrm_acq_expires __read_mostly = 30;
38
36/* Each xfrm_state may be linked to two tables: 39/* Each xfrm_state may be linked to two tables:
37 40
38 1. Hash table by (spi,daddr,ah/esp) to find SA by SPI. (input,ctl) 41 1. Hash table by (spi,daddr,ah/esp) to find SA by SPI. (input,ctl)
@@ -622,8 +625,8 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
622 h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, family); 625 h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, family);
623 hlist_add_head(&x->byspi, xfrm_state_byspi+h); 626 hlist_add_head(&x->byspi, xfrm_state_byspi+h);
624 } 627 }
625 x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; 628 x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires;
626 x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; 629 x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
627 add_timer(&x->timer); 630 add_timer(&x->timer);
628 xfrm_state_num++; 631 xfrm_state_num++;
629 xfrm_hash_grow_check(x->bydst.next != NULL); 632 xfrm_hash_grow_check(x->bydst.next != NULL);
@@ -772,9 +775,9 @@ static struct xfrm_state *__find_acq_core(unsigned short family, u8 mode, u32 re
772 x->props.family = family; 775 x->props.family = family;
773 x->props.mode = mode; 776 x->props.mode = mode;
774 x->props.reqid = reqid; 777 x->props.reqid = reqid;
775 x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; 778 x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires;
776 xfrm_state_hold(x); 779 xfrm_state_hold(x);
777 x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; 780 x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ;
778 add_timer(&x->timer); 781 add_timer(&x->timer);
779 hlist_add_head(&x->bydst, xfrm_state_bydst+h); 782 hlist_add_head(&x->bydst, xfrm_state_bydst+h);
780 h = xfrm_src_hash(daddr, saddr, family); 783 h = xfrm_src_hash(daddr, saddr, family);