aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-09-28 14:40:49 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-28 14:40:49 -0400
commit6a06e5e1bb217be077e1f8ee2745b4c5b1aa02db (patch)
tree8faea23112a11f52524eb413f71b7b02712d8b53 /net/ipv4
parentd9f72f359e00a45a6cd7cc2d5121b04b9dc927e1 (diff)
parent6672d90fe779dc0dfffe027c3ede12609df091c2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/team/team.c drivers/net/usb/qmi_wwan.c net/batman-adv/bat_iv_ogm.c net/ipv4/fib_frontend.c net/ipv4/route.c net/l2tp/l2tp_netlink.c The team, fib_frontend, route, and l2tp_netlink conflicts were simply overlapping changes. qmi_wwan and bat_iv_ogm were of the "use HEAD" variety. With help from Antonio Quartulli. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/devinet.c4
-rw-r--r--net/ipv4/inetpeer.c5
-rw-r--r--net/ipv4/raw.c14
-rw-r--r--net/ipv4/route.c9
-rw-r--r--net/ipv4/tcp.c23
-rw-r--r--net/ipv4/tcp_input.c5
6 files changed, 36 insertions, 24 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7b00556e184b..2a6abc163ed2 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -722,7 +722,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
722 break; 722 break;
723 723
724 case SIOCSIFFLAGS: 724 case SIOCSIFFLAGS:
725 ret = -EACCES; 725 ret = -EPERM;
726 if (!capable(CAP_NET_ADMIN)) 726 if (!capable(CAP_NET_ADMIN))
727 goto out; 727 goto out;
728 break; 728 break;
@@ -730,7 +730,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
730 case SIOCSIFBRDADDR: /* Set the broadcast address */ 730 case SIOCSIFBRDADDR: /* Set the broadcast address */
731 case SIOCSIFDSTADDR: /* Set the destination address */ 731 case SIOCSIFDSTADDR: /* Set the destination address */
732 case SIOCSIFNETMASK: /* Set the netmask for the interface */ 732 case SIOCSIFNETMASK: /* Set the netmask for the interface */
733 ret = -EACCES; 733 ret = -EPERM;
734 if (!capable(CAP_NET_ADMIN)) 734 if (!capable(CAP_NET_ADMIN))
735 goto out; 735 goto out;
736 ret = -EINVAL; 736 ret = -EINVAL;
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index e1e0a4e8fd34..c7527f6b9ad9 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -510,7 +510,10 @@ relookup:
510 secure_ipv6_id(daddr->addr.a6)); 510 secure_ipv6_id(daddr->addr.a6));
511 p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; 511 p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
512 p->rate_tokens = 0; 512 p->rate_tokens = 0;
513 p->rate_last = 0; 513 /* 60*HZ is arbitrary, but chosen enough high so that the first
514 * calculation of tokens is at its maximum.
515 */
516 p->rate_last = jiffies - 60*HZ;
514 INIT_LIST_HEAD(&p->gc_list); 517 INIT_LIST_HEAD(&p->gc_list);
515 518
516 /* Link the node. */ 519 /* Link the node. */
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index f2425785d40a..73d1e4df4bf6 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -131,18 +131,20 @@ found:
131 * 0 - deliver 131 * 0 - deliver
132 * 1 - block 132 * 1 - block
133 */ 133 */
134static __inline__ int icmp_filter(struct sock *sk, struct sk_buff *skb) 134static int icmp_filter(const struct sock *sk, const struct sk_buff *skb)
135{ 135{
136 int type; 136 struct icmphdr _hdr;
137 const struct icmphdr *hdr;
137 138
138 if (!pskb_may_pull(skb, sizeof(struct icmphdr))) 139 hdr = skb_header_pointer(skb, skb_transport_offset(skb),
140 sizeof(_hdr), &_hdr);
141 if (!hdr)
139 return 1; 142 return 1;
140 143
141 type = icmp_hdr(skb)->type; 144 if (hdr->type < 32) {
142 if (type < 32) {
143 __u32 data = raw_sk(sk)->filter.data; 145 __u32 data = raw_sk(sk)->filter.data;
144 146
145 return ((1 << type) & data) != 0; 147 return ((1U << hdr->type) & data) != 0;
146 } 148 }
147 149
148 /* Do not block unknown ICMP types */ 150 /* Do not block unknown ICMP types */
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 940f4f4cb201..ff622069fcef 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -202,11 +202,6 @@ EXPORT_SYMBOL(ip_tos2prio);
202static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat); 202static DEFINE_PER_CPU(struct rt_cache_stat, rt_cache_stat);
203#define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field) 203#define RT_CACHE_STAT_INC(field) __this_cpu_inc(rt_cache_stat.field)
204 204
205static inline int rt_genid(struct net *net)
206{
207 return atomic_read(&net->ipv4.rt_genid);
208}
209
210#ifdef CONFIG_PROC_FS 205#ifdef CONFIG_PROC_FS
211static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) 206static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
212{ 207{
@@ -449,7 +444,7 @@ static inline bool rt_is_expired(const struct rtable *rth)
449 444
450void rt_cache_flush(struct net *net) 445void rt_cache_flush(struct net *net)
451{ 446{
452 atomic_inc(&net->ipv4.rt_genid); 447 rt_genid_bump(net);
453} 448}
454 449
455static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst, 450static struct neighbour *ipv4_neigh_lookup(const struct dst_entry *dst,
@@ -2506,7 +2501,7 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
2506 2501
2507static __net_init int rt_genid_init(struct net *net) 2502static __net_init int rt_genid_init(struct net *net)
2508{ 2503{
2509 atomic_set(&net->ipv4.rt_genid, 0); 2504 atomic_set(&net->rt_genid, 0);
2510 get_random_bytes(&net->ipv4.dev_addr_genid, 2505 get_random_bytes(&net->ipv4.dev_addr_genid,
2511 sizeof(net->ipv4.dev_addr_genid)); 2506 sizeof(net->ipv4.dev_addr_genid));
2512 return 0; 2507 return 0;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 72ea4752f21b..f32c02e2a543 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1738,8 +1738,14 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
1738 } 1738 }
1739 1739
1740#ifdef CONFIG_NET_DMA 1740#ifdef CONFIG_NET_DMA
1741 if (tp->ucopy.dma_chan) 1741 if (tp->ucopy.dma_chan) {
1742 dma_async_memcpy_issue_pending(tp->ucopy.dma_chan); 1742 if (tp->rcv_wnd == 0 &&
1743 !skb_queue_empty(&sk->sk_async_wait_queue)) {
1744 tcp_service_net_dma(sk, true);
1745 tcp_cleanup_rbuf(sk, copied);
1746 } else
1747 dma_async_memcpy_issue_pending(tp->ucopy.dma_chan);
1748 }
1743#endif 1749#endif
1744 if (copied >= target) { 1750 if (copied >= target) {
1745 /* Do not sleep, just process backlog. */ 1751 /* Do not sleep, just process backlog. */
@@ -2320,10 +2326,17 @@ static int tcp_repair_options_est(struct tcp_sock *tp,
2320 tp->rx_opt.mss_clamp = opt.opt_val; 2326 tp->rx_opt.mss_clamp = opt.opt_val;
2321 break; 2327 break;
2322 case TCPOPT_WINDOW: 2328 case TCPOPT_WINDOW:
2323 if (opt.opt_val > 14) 2329 {
2324 return -EFBIG; 2330 u16 snd_wscale = opt.opt_val & 0xFFFF;
2331 u16 rcv_wscale = opt.opt_val >> 16;
2332
2333 if (snd_wscale > 14 || rcv_wscale > 14)
2334 return -EFBIG;
2325 2335
2326 tp->rx_opt.snd_wscale = opt.opt_val; 2336 tp->rx_opt.snd_wscale = snd_wscale;
2337 tp->rx_opt.rcv_wscale = rcv_wscale;
2338 tp->rx_opt.wscale_ok = 1;
2339 }
2327 break; 2340 break;
2328 case TCPOPT_SACK_PERM: 2341 case TCPOPT_SACK_PERM:
2329 if (opt.opt_val != 0) 2342 if (opt.opt_val != 0)
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e037697c3b77..432c36649db3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4634,7 +4634,7 @@ queue_and_out:
4634 4634
4635 if (eaten > 0) 4635 if (eaten > 0)
4636 kfree_skb_partial(skb, fragstolen); 4636 kfree_skb_partial(skb, fragstolen);
4637 else if (!sock_flag(sk, SOCK_DEAD)) 4637 if (!sock_flag(sk, SOCK_DEAD))
4638 sk->sk_data_ready(sk, 0); 4638 sk->sk_data_ready(sk, 0);
4639 return; 4639 return;
4640 } 4640 }
@@ -5529,8 +5529,7 @@ no_ack:
5529#endif 5529#endif
5530 if (eaten) 5530 if (eaten)
5531 kfree_skb_partial(skb, fragstolen); 5531 kfree_skb_partial(skb, fragstolen);
5532 else 5532 sk->sk_data_ready(sk, 0);
5533 sk->sk_data_ready(sk, 0);
5534 return 0; 5533 return 0;
5535 } 5534 }
5536 } 5535 }