Commit b9066c268abfe353edf5d646bb486bc03c839348
Exists in
master
and in
4 other branches
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (24 commits) [IPSEC]: Add xfrm_sysctl.txt. [BRIDGE]: Round off STP perodic timers. [BRIDGE]: Reduce frequency of forwarding cleanup timer in bridge. [TCP] tcp_probe: use GCC printf attribute [TCP] tcp_probe: a trivial fix for mismatched number of printl arguments. [IPV6] ADDRCONF: Fix conflicts in DEVCONF_xxx constant. [NET] napi: Call __netif_rx_complete in netif_rx_complete [TCP]: Consolidate checking for tcp orphan count being too big. [SOCK]: Shrink struct sock by 8 bytes on 64-bit. [AF_PACKET]: Kill CONFIG_PACKET_SOCKET. [IPV6]: Fix build warning. [AF_PACKET]: Kill bogus CONFIG_PACKET_MULTICAST [IPV4]: Kill references to bogus non-existent CONFIG_IP_NOSIOCRT [IPSEC]: Fix panic when using inter address familiy IPsec on loopback. [NET]: parse ip:port strings correctly in in4_pton [IPV6] ROUTE: No longer handle ::/0 specially. [IPSEC]: Fix IPv6 AH calculation in outbound [XFRM]: xfrm_larval_drop sysctl should be __read_mostly. [XFRM]: Allow XFRM_ACQ_EXPIRES to be tunable via sysctl. [CASSINI]: Fix printk message typo. ...
Showing 27 changed files Side-by-side Diff
- Documentation/networking/xfrm_sysctl.txt
- drivers/net/cassini.c
- include/linux/ipv6.h
- include/linux/netdevice.h
- include/net/sock.h
- include/net/tcp.h
- include/net/xfrm.h
- net/bridge/br_fdb.c
- net/bridge/br_stp.c
- net/bridge/br_stp_timer.c
- net/core/sysctl_net_core.c
- net/core/utils.c
- net/ipv4/fib_frontend.c
- net/ipv4/tcp.c
- net/ipv4/tcp_probe.c
- net/ipv4/tcp_timer.c
- net/ipv4/xfrm4_input.c
- net/ipv4/xfrm4_mode_tunnel.c
- net/ipv6/ah6.c
- net/ipv6/ip6_fib.c
- net/ipv6/xfrm6_input.c
- net/ipv6/xfrm6_mode_tunnel.c
- net/mac80211/ieee80211.c
- net/mac80211/ieee80211_sta.c
- net/packet/af_packet.c
- net/xfrm/xfrm_policy.c
- net/xfrm/xfrm_state.c
Documentation/networking/xfrm_sysctl.txt
drivers/net/cassini.c
... | ... | @@ -4920,7 +4920,7 @@ |
4920 | 4920 | pci_cmd |= PCI_COMMAND_PARITY; |
4921 | 4921 | pci_write_config_word(pdev, PCI_COMMAND, pci_cmd); |
4922 | 4922 | if (pci_set_mwi(pdev)) |
4923 | - printk(KERN_WARNING PFX "Could enable MWI for %s\n", | |
4923 | + printk(KERN_WARNING PFX "Could not enable MWI for %s\n", | |
4924 | 4924 | pci_name(pdev)); |
4925 | 4925 | |
4926 | 4926 | /* |
include/linux/ipv6.h
... | ... | @@ -209,9 +209,8 @@ |
209 | 209 | DEVCONF_RTR_PROBE_INTERVAL, |
210 | 210 | DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN, |
211 | 211 | DEVCONF_PROXY_NDP, |
212 | - __DEVCONF_OPTIMISTIC_DAD, | |
213 | - DEVCONF_ACCEPT_SOURCE_ROUTE, | |
214 | 212 | DEVCONF_OPTIMISTIC_DAD, |
213 | + DEVCONF_ACCEPT_SOURCE_ROUTE, | |
215 | 214 | DEVCONF_MAX |
216 | 215 | }; |
217 | 216 |
include/linux/netdevice.h
... | ... | @@ -910,6 +910,17 @@ |
910 | 910 | return 0; |
911 | 911 | } |
912 | 912 | |
913 | +/* same as netif_rx_complete, except that local_irq_save(flags) | |
914 | + * has already been issued | |
915 | + */ | |
916 | +static inline void __netif_rx_complete(struct net_device *dev) | |
917 | +{ | |
918 | + BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); | |
919 | + list_del(&dev->poll_list); | |
920 | + smp_mb__before_clear_bit(); | |
921 | + clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | |
922 | +} | |
923 | + | |
913 | 924 | /* Remove interface from poll list: it must be in the poll list |
914 | 925 | * on current cpu. This primitive is called by dev->poll(), when |
915 | 926 | * it completes the work. The device cannot be out of poll list at this |
... | ... | @@ -920,10 +931,7 @@ |
920 | 931 | unsigned long flags; |
921 | 932 | |
922 | 933 | local_irq_save(flags); |
923 | - BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); | |
924 | - list_del(&dev->poll_list); | |
925 | - smp_mb__before_clear_bit(); | |
926 | - clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | |
934 | + __netif_rx_complete(dev); | |
927 | 935 | local_irq_restore(flags); |
928 | 936 | } |
929 | 937 | |
... | ... | @@ -936,17 +944,6 @@ |
936 | 944 | |
937 | 945 | static inline void netif_poll_enable(struct net_device *dev) |
938 | 946 | { |
939 | - smp_mb__before_clear_bit(); | |
940 | - clear_bit(__LINK_STATE_RX_SCHED, &dev->state); | |
941 | -} | |
942 | - | |
943 | -/* same as netif_rx_complete, except that local_irq_save(flags) | |
944 | - * has already been issued | |
945 | - */ | |
946 | -static inline void __netif_rx_complete(struct net_device *dev) | |
947 | -{ | |
948 | - BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state)); | |
949 | - list_del(&dev->poll_list); | |
950 | 947 | smp_mb__before_clear_bit(); |
951 | 948 | clear_bit(__LINK_STATE_RX_SCHED, &dev->state); |
952 | 949 | } |
include/net/sock.h
... | ... | @@ -218,13 +218,13 @@ |
218 | 218 | atomic_t sk_rmem_alloc; |
219 | 219 | atomic_t sk_wmem_alloc; |
220 | 220 | atomic_t sk_omem_alloc; |
221 | + int sk_sndbuf; | |
221 | 222 | struct sk_buff_head sk_receive_queue; |
222 | 223 | struct sk_buff_head sk_write_queue; |
223 | 224 | struct sk_buff_head sk_async_wait_queue; |
224 | 225 | int sk_wmem_queued; |
225 | 226 | int sk_forward_alloc; |
226 | 227 | gfp_t sk_allocation; |
227 | - int sk_sndbuf; | |
228 | 228 | int sk_route_caps; |
229 | 229 | int sk_gso_type; |
230 | 230 | int sk_rcvlowat; |
include/net/tcp.h
... | ... | @@ -254,6 +254,12 @@ |
254 | 254 | return seq3 - seq2 >= seq1 - seq2; |
255 | 255 | } |
256 | 256 | |
257 | +static inline int tcp_too_many_orphans(struct sock *sk, int num) | |
258 | +{ | |
259 | + return (num > sysctl_tcp_max_orphans) || | |
260 | + (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | |
261 | + atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); | |
262 | +} | |
257 | 263 | |
258 | 264 | extern struct proto tcp_prot; |
259 | 265 |
include/net/xfrm.h
... | ... | @@ -237,7 +237,6 @@ |
237 | 237 | extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); |
238 | 238 | extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c); |
239 | 239 | extern void km_state_notify(struct xfrm_state *x, struct km_event *c); |
240 | -#define XFRM_ACQ_EXPIRES 30 | |
241 | 240 | |
242 | 241 | struct xfrm_tmpl; |
243 | 242 | extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); |
net/bridge/br_fdb.c
... | ... | @@ -121,6 +121,7 @@ |
121 | 121 | { |
122 | 122 | struct net_bridge *br = (struct net_bridge *)_data; |
123 | 123 | unsigned long delay = hold_time(br); |
124 | + unsigned long next_timer = jiffies + br->forward_delay; | |
124 | 125 | int i; |
125 | 126 | |
126 | 127 | spin_lock_bh(&br->hash_lock); |
127 | 128 | |
128 | 129 | |
... | ... | @@ -129,14 +130,21 @@ |
129 | 130 | struct hlist_node *h, *n; |
130 | 131 | |
131 | 132 | hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { |
132 | - if (!f->is_static && | |
133 | - time_before_eq(f->ageing_timer + delay, jiffies)) | |
133 | + unsigned long this_timer; | |
134 | + if (f->is_static) | |
135 | + continue; | |
136 | + this_timer = f->ageing_timer + delay; | |
137 | + if (time_before_eq(this_timer, jiffies)) | |
134 | 138 | fdb_delete(f); |
139 | + else if (this_timer < next_timer) | |
140 | + next_timer = this_timer; | |
135 | 141 | } |
136 | 142 | } |
137 | 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 | 150 | /* Completely flush all dynamic entries in forwarding database.*/ |
net/bridge/br_stp.c
net/bridge/br_stp_timer.c
net/core/sysctl_net_core.c
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 | extern u32 sysctl_xfrm_aevent_etime; |
26 | 26 | extern u32 sysctl_xfrm_aevent_rseqth; |
27 | 27 | extern int sysctl_xfrm_larval_drop; |
28 | +extern u32 sysctl_xfrm_acq_expires; | |
28 | 29 | #endif |
29 | 30 | |
30 | 31 | ctl_table core_table[] = { |
... | ... | @@ -123,6 +124,14 @@ |
123 | 124 | .ctl_name = CTL_UNNUMBERED, |
124 | 125 | .procname = "xfrm_larval_drop", |
125 | 126 | .data = &sysctl_xfrm_larval_drop, |
127 | + .maxlen = sizeof(int), | |
128 | + .mode = 0644, | |
129 | + .proc_handler = &proc_dointvec | |
130 | + }, | |
131 | + { | |
132 | + .ctl_name = CTL_UNNUMBERED, | |
133 | + .procname = "xfrm_acq_expires", | |
134 | + .data = &sysctl_xfrm_acq_expires, | |
126 | 135 | .maxlen = sizeof(int), |
127 | 136 | .mode = 0644, |
128 | 137 | .proc_handler = &proc_dointvec |
net/core/utils.c
... | ... | @@ -139,16 +139,16 @@ |
139 | 139 | while(1) { |
140 | 140 | int c; |
141 | 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 | 143 | goto out; |
144 | 144 | } |
145 | - if (c & (IN6PTON_DOT | IN6PTON_DELIM)) { | |
145 | + if (c & (IN6PTON_DOT | IN6PTON_DELIM | IN6PTON_COLON_MASK)) { | |
146 | 146 | if (w == 0) |
147 | 147 | goto out; |
148 | 148 | *d++ = w & 0xff; |
149 | 149 | w = 0; |
150 | 150 | i++; |
151 | - if (c & IN6PTON_DELIM) { | |
151 | + if (c & (IN6PTON_DELIM | IN6PTON_COLON_MASK)) { | |
152 | 152 | if (i != 4) |
153 | 153 | goto out; |
154 | 154 | break; |
net/ipv4/fib_frontend.c
... | ... | @@ -250,8 +250,6 @@ |
250 | 250 | return -EINVAL; |
251 | 251 | } |
252 | 252 | |
253 | -#ifndef CONFIG_IP_NOSIOCRT | |
254 | - | |
255 | 253 | static inline __be32 sk_extract_addr(struct sockaddr *addr) |
256 | 254 | { |
257 | 255 | return ((struct sockaddr_in *) addr)->sin_addr.s_addr; |
... | ... | @@ -442,15 +440,6 @@ |
442 | 440 | } |
443 | 441 | return -EINVAL; |
444 | 442 | } |
445 | - | |
446 | -#else | |
447 | - | |
448 | -int ip_rt_ioctl(unsigned int cmd, void *arg) | |
449 | -{ | |
450 | - return -EINVAL; | |
451 | -} | |
452 | - | |
453 | -#endif | |
454 | 443 | |
455 | 444 | struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = { |
456 | 445 | [RTA_DST] = { .type = NLA_U32 }, |
net/ipv4/tcp.c
... | ... | @@ -1674,9 +1674,8 @@ |
1674 | 1674 | } |
1675 | 1675 | if (sk->sk_state != TCP_CLOSE) { |
1676 | 1676 | sk_stream_mem_reclaim(sk); |
1677 | - if (atomic_read(sk->sk_prot->orphan_count) > sysctl_tcp_max_orphans || | |
1678 | - (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | |
1679 | - atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) { | |
1677 | + if (tcp_too_many_orphans(sk, | |
1678 | + atomic_read(sk->sk_prot->orphan_count))) { | |
1680 | 1679 | if (net_ratelimit()) |
1681 | 1680 | printk(KERN_INFO "TCP: too many of orphaned " |
1682 | 1681 | "sockets\n"); |
net/ipv4/tcp_probe.c
... | ... | @@ -80,8 +80,9 @@ |
80 | 80 | |
81 | 81 | kfifo_put(tcpw.fifo, tbuf, len); |
82 | 82 | wake_up(&tcpw.wait); |
83 | -} | |
83 | +} __attribute__ ((format (printf, 1, 2))); | |
84 | 84 | |
85 | + | |
85 | 86 | /* |
86 | 87 | * Hook inserted to be called before each receive packet. |
87 | 88 | * Note: arguments must match tcp_rcv_established()! |
... | ... | @@ -95,7 +96,7 @@ |
95 | 96 | /* Only update if port matches */ |
96 | 97 | if ((port == 0 || ntohs(inet->dport) == port || ntohs(inet->sport) == port) |
97 | 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 | 100 | NIPQUAD(inet->saddr), ntohs(inet->sport), |
100 | 101 | NIPQUAD(inet->daddr), ntohs(inet->dport), |
101 | 102 | skb->len, tp->snd_nxt, tp->snd_una, |
net/ipv4/tcp_timer.c
... | ... | @@ -78,9 +78,7 @@ |
78 | 78 | if (sk->sk_err_soft) |
79 | 79 | orphans <<= 1; |
80 | 80 | |
81 | - if (orphans >= sysctl_tcp_max_orphans || | |
82 | - (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | |
83 | - atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2])) { | |
81 | + if (tcp_too_many_orphans(sk, orphans)) { | |
84 | 82 | if (net_ratelimit()) |
85 | 83 | printk(KERN_INFO "Out of socket memory\n"); |
86 | 84 |
net/ipv4/xfrm4_input.c
net/ipv4/xfrm4_mode_tunnel.c
net/ipv6/ah6.c
... | ... | @@ -247,7 +247,7 @@ |
247 | 247 | memcpy(tmp_base, top_iph, sizeof(tmp_base)); |
248 | 248 | |
249 | 249 | tmp_ext = NULL; |
250 | - extlen = skb_transport_offset(skb) + sizeof(struct ipv6hdr); | |
250 | + extlen = skb_transport_offset(skb) - sizeof(struct ipv6hdr); | |
251 | 251 | if (extlen) { |
252 | 252 | extlen += sizeof(*tmp_ext); |
253 | 253 | tmp_ext = kmalloc(extlen, GFP_ATOMIC); |
net/ipv6/ip6_fib.c
... | ... | @@ -619,14 +619,6 @@ |
619 | 619 | |
620 | 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 | 622 | for (iter = fn->leaf; iter; iter=iter->u.dst.rt6_next) { |
631 | 623 | /* |
632 | 624 | * Search for duplicates |
... | ... | @@ -666,7 +658,6 @@ |
666 | 658 | * insert node |
667 | 659 | */ |
668 | 660 | |
669 | -out: | |
670 | 661 | rt->u.dst.rt6_next = iter; |
671 | 662 | *ins = rt; |
672 | 663 | rt->rt6i_node = fn; |
net/ipv6/xfrm6_input.c
net/ipv6/xfrm6_mode_tunnel.c
... | ... | @@ -80,6 +80,7 @@ |
80 | 80 | top_iph->hop_limit = dst_metric(dst->child, RTAX_HOPLIMIT); |
81 | 81 | ipv6_addr_copy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr); |
82 | 82 | ipv6_addr_copy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr); |
83 | + skb->protocol = htons(ETH_P_IPV6); | |
83 | 84 | return 0; |
84 | 85 | } |
85 | 86 |
net/mac80211/ieee80211.c
... | ... | @@ -2474,6 +2474,8 @@ |
2474 | 2474 | if (sdata->type == IEEE80211_IF_TYPE_STA && |
2475 | 2475 | !local->user_space_mlme) |
2476 | 2476 | netif_carrier_off(dev); |
2477 | + else | |
2478 | + netif_carrier_on(dev); | |
2477 | 2479 | |
2478 | 2480 | netif_start_queue(dev); |
2479 | 2481 | return 0; |
2480 | 2482 | |
... | ... | @@ -3278,8 +3280,10 @@ |
3278 | 3280 | return TXRX_DROP; |
3279 | 3281 | } |
3280 | 3282 | } |
3281 | - while ((skb = __skb_dequeue(&entry->skb_list))) | |
3283 | + while ((skb = __skb_dequeue(&entry->skb_list))) { | |
3282 | 3284 | memcpy(skb_put(rx->skb, skb->len), skb->data, skb->len); |
3285 | + dev_kfree_skb(skb); | |
3286 | + } | |
3283 | 3287 | |
3284 | 3288 | /* Complete frame has been reassembled - process it now */ |
3285 | 3289 | rx->fragmented = 1; |
net/mac80211/ieee80211_sta.c
... | ... | @@ -1155,6 +1155,8 @@ |
1155 | 1155 | if (status_code != WLAN_STATUS_SUCCESS) { |
1156 | 1156 | printk(KERN_DEBUG "%s: AP denied association (code=%d)\n", |
1157 | 1157 | dev->name, status_code); |
1158 | + if (status_code == WLAN_STATUS_REASSOC_NO_ASSOC) | |
1159 | + ifsta->prev_bssid_set = 0; | |
1158 | 1160 | return; |
1159 | 1161 | } |
1160 | 1162 | |
... | ... | @@ -2995,7 +2997,7 @@ |
2995 | 2997 | { |
2996 | 2998 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
2997 | 2999 | struct sta_info *sta; |
2998 | - struct ieee80211_sub_if_data *sdata = NULL; | |
3000 | + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | |
2999 | 3001 | |
3000 | 3002 | /* TODO: Could consider removing the least recently used entry and |
3001 | 3003 | * allow new one to be added. */ |
net/packet/af_packet.c
... | ... | @@ -83,23 +83,7 @@ |
83 | 83 | #include <net/inet_common.h> |
84 | 84 | #endif |
85 | 85 | |
86 | -#define CONFIG_SOCK_PACKET 1 | |
87 | - | |
88 | 86 | /* |
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 | -/* | |
103 | 87 | Assumptions: |
104 | 88 | - if device has no dev->hard_header routine, it adds and removes ll header |
105 | 89 | inside itself. In this case ll header is invisible outside of device, |
... | ... | @@ -159,7 +143,6 @@ |
159 | 143 | |
160 | 144 | /* Private packet socket structures. */ |
161 | 145 | |
162 | -#ifdef CONFIG_PACKET_MULTICAST | |
163 | 146 | struct packet_mclist |
164 | 147 | { |
165 | 148 | struct packet_mclist *next; |
... | ... | @@ -179,7 +162,7 @@ |
179 | 162 | unsigned short mr_alen; |
180 | 163 | unsigned char mr_address[MAX_ADDR_LEN]; |
181 | 164 | }; |
182 | -#endif | |
165 | + | |
183 | 166 | #ifdef CONFIG_PACKET_MMAP |
184 | 167 | static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing); |
185 | 168 | #endif |
186 | 169 | |
... | ... | @@ -205,9 +188,7 @@ |
205 | 188 | origdev:1; |
206 | 189 | int ifindex; /* bound device */ |
207 | 190 | __be16 num; |
208 | -#ifdef CONFIG_PACKET_MULTICAST | |
209 | 191 | struct packet_mclist *mclist; |
210 | -#endif | |
211 | 192 | #ifdef CONFIG_PACKET_MMAP |
212 | 193 | atomic_t mapped; |
213 | 194 | unsigned int pg_vec_order; |
... | ... | @@ -263,7 +244,6 @@ |
263 | 244 | |
264 | 245 | static const struct proto_ops packet_ops; |
265 | 246 | |
266 | -#ifdef CONFIG_SOCK_PACKET | |
267 | 247 | static const struct proto_ops packet_ops_spkt; |
268 | 248 | |
269 | 249 | static 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 @@ |
435 | 415 | dev_put(dev); |
436 | 416 | return err; |
437 | 417 | } |
438 | -#endif | |
439 | 418 | |
440 | 419 | static inline unsigned int run_filter(struct sk_buff *skb, struct sock *sk, |
441 | 420 | unsigned int res) |
442 | 421 | |
... | ... | @@ -851,9 +830,7 @@ |
851 | 830 | __sock_put(sk); |
852 | 831 | } |
853 | 832 | |
854 | -#ifdef CONFIG_PACKET_MULTICAST | |
855 | 833 | packet_flush_mclist(sk); |
856 | -#endif | |
857 | 834 | |
858 | 835 | #ifdef CONFIG_PACKET_MMAP |
859 | 836 | if (po->pg_vec) { |
... | ... | @@ -936,8 +913,6 @@ |
936 | 913 | * Bind a packet socket to a device |
937 | 914 | */ |
938 | 915 | |
939 | -#ifdef CONFIG_SOCK_PACKET | |
940 | - | |
941 | 916 | static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
942 | 917 | { |
943 | 918 | struct sock *sk=sock->sk; |
... | ... | @@ -960,7 +935,6 @@ |
960 | 935 | } |
961 | 936 | return err; |
962 | 937 | } |
963 | -#endif | |
964 | 938 | |
965 | 939 | static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
966 | 940 | { |
... | ... | @@ -1012,11 +986,8 @@ |
1012 | 986 | |
1013 | 987 | if (!capable(CAP_NET_RAW)) |
1014 | 988 | return -EPERM; |
1015 | - if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW | |
1016 | -#ifdef CONFIG_SOCK_PACKET | |
1017 | - && sock->type != SOCK_PACKET | |
1018 | -#endif | |
1019 | - ) | |
989 | + if (sock->type != SOCK_DGRAM && sock->type != SOCK_RAW && | |
990 | + sock->type != SOCK_PACKET) | |
1020 | 991 | return -ESOCKTNOSUPPORT; |
1021 | 992 | |
1022 | 993 | sock->state = SS_UNCONNECTED; |
1023 | 994 | |
... | ... | @@ -1027,10 +998,9 @@ |
1027 | 998 | goto out; |
1028 | 999 | |
1029 | 1000 | sock->ops = &packet_ops; |
1030 | -#ifdef CONFIG_SOCK_PACKET | |
1031 | 1001 | if (sock->type == SOCK_PACKET) |
1032 | 1002 | sock->ops = &packet_ops_spkt; |
1033 | -#endif | |
1003 | + | |
1034 | 1004 | sock_init_data(sock, sk); |
1035 | 1005 | |
1036 | 1006 | po = pkt_sk(sk); |
1037 | 1007 | |
... | ... | @@ -1046,10 +1016,10 @@ |
1046 | 1016 | |
1047 | 1017 | spin_lock_init(&po->bind_lock); |
1048 | 1018 | po->prot_hook.func = packet_rcv; |
1049 | -#ifdef CONFIG_SOCK_PACKET | |
1019 | + | |
1050 | 1020 | if (sock->type == SOCK_PACKET) |
1051 | 1021 | po->prot_hook.func = packet_rcv_spkt; |
1052 | -#endif | |
1022 | + | |
1053 | 1023 | po->prot_hook.af_packet_priv = sk; |
1054 | 1024 | |
1055 | 1025 | if (proto) { |
... | ... | @@ -1169,7 +1139,6 @@ |
1169 | 1139 | return err; |
1170 | 1140 | } |
1171 | 1141 | |
1172 | -#ifdef CONFIG_SOCK_PACKET | |
1173 | 1142 | static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, |
1174 | 1143 | int *uaddr_len, int peer) |
1175 | 1144 | { |
... | ... | @@ -1190,7 +1159,6 @@ |
1190 | 1159 | |
1191 | 1160 | return 0; |
1192 | 1161 | } |
1193 | -#endif | |
1194 | 1162 | |
1195 | 1163 | static int packet_getname(struct socket *sock, struct sockaddr *uaddr, |
1196 | 1164 | int *uaddr_len, int peer) |
... | ... | @@ -1221,7 +1189,6 @@ |
1221 | 1189 | return 0; |
1222 | 1190 | } |
1223 | 1191 | |
1224 | -#ifdef CONFIG_PACKET_MULTICAST | |
1225 | 1192 | static void packet_dev_mc(struct net_device *dev, struct packet_mclist *i, int what) |
1226 | 1193 | { |
1227 | 1194 | switch (i->type) { |
... | ... | @@ -1349,7 +1316,6 @@ |
1349 | 1316 | } |
1350 | 1317 | rtnl_unlock(); |
1351 | 1318 | } |
1352 | -#endif | |
1353 | 1319 | |
1354 | 1320 | static int |
1355 | 1321 | packet_setsockopt(struct socket *sock, int level, int optname, char __user *optval, int optlen) |
... | ... | @@ -1362,7 +1328,6 @@ |
1362 | 1328 | return -ENOPROTOOPT; |
1363 | 1329 | |
1364 | 1330 | switch(optname) { |
1365 | -#ifdef CONFIG_PACKET_MULTICAST | |
1366 | 1331 | case PACKET_ADD_MEMBERSHIP: |
1367 | 1332 | case PACKET_DROP_MEMBERSHIP: |
1368 | 1333 | { |
... | ... | @@ -1383,7 +1348,7 @@ |
1383 | 1348 | ret = packet_mc_drop(sk, &mreq); |
1384 | 1349 | return ret; |
1385 | 1350 | } |
1386 | -#endif | |
1351 | + | |
1387 | 1352 | #ifdef CONFIG_PACKET_MMAP |
1388 | 1353 | case PACKET_RX_RING: |
1389 | 1354 | { |
1390 | 1355 | |
... | ... | @@ -1506,11 +1471,10 @@ |
1506 | 1471 | |
1507 | 1472 | switch (msg) { |
1508 | 1473 | case NETDEV_UNREGISTER: |
1509 | -#ifdef CONFIG_PACKET_MULTICAST | |
1510 | 1474 | if (po->mclist) |
1511 | 1475 | packet_dev_mclist(dev, po->mclist, -1); |
1512 | - // fallthrough | |
1513 | -#endif | |
1476 | + /* fallthrough */ | |
1477 | + | |
1514 | 1478 | case NETDEV_DOWN: |
1515 | 1479 | if (dev->ifindex == po->ifindex) { |
1516 | 1480 | spin_lock(&po->bind_lock); |
... | ... | @@ -1856,7 +1820,6 @@ |
1856 | 1820 | #endif |
1857 | 1821 | |
1858 | 1822 | |
1859 | -#ifdef CONFIG_SOCK_PACKET | |
1860 | 1823 | static const struct proto_ops packet_ops_spkt = { |
1861 | 1824 | .family = PF_PACKET, |
1862 | 1825 | .owner = THIS_MODULE, |
... | ... | @@ -1877,7 +1840,6 @@ |
1877 | 1840 | .mmap = sock_no_mmap, |
1878 | 1841 | .sendpage = sock_no_sendpage, |
1879 | 1842 | }; |
1880 | -#endif | |
1881 | 1843 | |
1882 | 1844 | static const struct proto_ops packet_ops = { |
1883 | 1845 | .family = PF_PACKET, |
net/xfrm/xfrm_policy.c
... | ... | @@ -26,10 +26,11 @@ |
26 | 26 | #include <net/xfrm.h> |
27 | 27 | #include <net/ip.h> |
28 | 28 | #include <linux/audit.h> |
29 | +#include <linux/cache.h> | |
29 | 30 | |
30 | 31 | #include "xfrm_hash.h" |
31 | 32 | |
32 | -int sysctl_xfrm_larval_drop; | |
33 | +int sysctl_xfrm_larval_drop __read_mostly; | |
33 | 34 | |
34 | 35 | DEFINE_MUTEX(xfrm_cfg_mutex); |
35 | 36 | EXPORT_SYMBOL(xfrm_cfg_mutex); |
net/xfrm/xfrm_state.c
... | ... | @@ -21,18 +21,21 @@ |
21 | 21 | #include <linux/cache.h> |
22 | 22 | #include <asm/uaccess.h> |
23 | 23 | #include <linux/audit.h> |
24 | +#include <linux/cache.h> | |
24 | 25 | |
25 | 26 | #include "xfrm_hash.h" |
26 | 27 | |
27 | 28 | struct sock *xfrm_nl; |
28 | 29 | EXPORT_SYMBOL(xfrm_nl); |
29 | 30 | |
30 | -u32 sysctl_xfrm_aevent_etime = XFRM_AE_ETIME; | |
31 | +u32 sysctl_xfrm_aevent_etime __read_mostly = XFRM_AE_ETIME; | |
31 | 32 | EXPORT_SYMBOL(sysctl_xfrm_aevent_etime); |
32 | 33 | |
33 | -u32 sysctl_xfrm_aevent_rseqth = XFRM_AE_SEQT_SIZE; | |
34 | +u32 sysctl_xfrm_aevent_rseqth __read_mostly = XFRM_AE_SEQT_SIZE; | |
34 | 35 | EXPORT_SYMBOL(sysctl_xfrm_aevent_rseqth); |
35 | 36 | |
37 | +u32 sysctl_xfrm_acq_expires __read_mostly = 30; | |
38 | + | |
36 | 39 | /* Each xfrm_state may be linked to two tables: |
37 | 40 | |
38 | 41 | 1. Hash table by (spi,daddr,ah/esp) to find SA by SPI. (input,ctl) |
... | ... | @@ -622,8 +625,8 @@ |
622 | 625 | h = xfrm_spi_hash(&x->id.daddr, x->id.spi, x->id.proto, family); |
623 | 626 | hlist_add_head(&x->byspi, xfrm_state_byspi+h); |
624 | 627 | } |
625 | - x->lft.hard_add_expires_seconds = XFRM_ACQ_EXPIRES; | |
626 | - x->timer.expires = jiffies + XFRM_ACQ_EXPIRES*HZ; | |
628 | + x->lft.hard_add_expires_seconds = sysctl_xfrm_acq_expires; | |
629 | + x->timer.expires = jiffies + sysctl_xfrm_acq_expires*HZ; | |
627 | 630 | add_timer(&x->timer); |
628 | 631 | xfrm_state_num++; |
629 | 632 | xfrm_hash_grow_check(x->bydst.next != NULL); |
630 | 633 | |
... | ... | @@ -772,9 +775,9 @@ |
772 | 775 | x->props.family = family; |
773 | 776 | x->props.mode = mode; |
774 | 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 | 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 | 781 | add_timer(&x->timer); |
779 | 782 | hlist_add_head(&x->bydst, xfrm_state_bydst+h); |
780 | 783 | h = xfrm_src_hash(daddr, saddr, family); |