aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/af_inet.c18
-rw-r--r--net/ipv4/ah4.c2
-rw-r--r--net/ipv4/devinet.c6
-rw-r--r--net/ipv4/esp4.c2
-rw-r--r--net/ipv4/icmp.c2
-rw-r--r--net/ipv4/igmp.c22
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ip_input.c2
-rw-r--r--net/ipv4/ipcomp.c2
-rw-r--r--net/ipv4/ipmr.c6
-rw-r--r--net/ipv4/protocol.c6
-rw-r--r--net/ipv4/tcp.c2
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv4/tcp_ipv4.c4
-rw-r--r--net/ipv4/tcp_minisocks.c4
-rw-r--r--net/ipv4/tunnel4.c4
-rw-r--r--net/ipv4/udplite.c2
17 files changed, 56 insertions, 32 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 6c30a73f03f5..58c4b0f7c4aa 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(build_ehash_secret);
244static inline int inet_netns_ok(struct net *net, int protocol) 244static inline int inet_netns_ok(struct net *net, int protocol)
245{ 245{
246 int hash; 246 int hash;
247 struct net_protocol *ipprot; 247 const struct net_protocol *ipprot;
248 248
249 if (net_eq(net, &init_net)) 249 if (net_eq(net, &init_net))
250 return 1; 250 return 1;
@@ -1162,7 +1162,7 @@ EXPORT_SYMBOL(inet_sk_rebuild_header);
1162static int inet_gso_send_check(struct sk_buff *skb) 1162static int inet_gso_send_check(struct sk_buff *skb)
1163{ 1163{
1164 struct iphdr *iph; 1164 struct iphdr *iph;
1165 struct net_protocol *ops; 1165 const struct net_protocol *ops;
1166 int proto; 1166 int proto;
1167 int ihl; 1167 int ihl;
1168 int err = -EINVAL; 1168 int err = -EINVAL;
@@ -1198,7 +1198,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
1198{ 1198{
1199 struct sk_buff *segs = ERR_PTR(-EINVAL); 1199 struct sk_buff *segs = ERR_PTR(-EINVAL);
1200 struct iphdr *iph; 1200 struct iphdr *iph;
1201 struct net_protocol *ops; 1201 const struct net_protocol *ops;
1202 int proto; 1202 int proto;
1203 int ihl; 1203 int ihl;
1204 int id; 1204 int id;
@@ -1265,7 +1265,7 @@ out:
1265static struct sk_buff **inet_gro_receive(struct sk_buff **head, 1265static struct sk_buff **inet_gro_receive(struct sk_buff **head,
1266 struct sk_buff *skb) 1266 struct sk_buff *skb)
1267{ 1267{
1268 struct net_protocol *ops; 1268 const struct net_protocol *ops;
1269 struct sk_buff **pp = NULL; 1269 struct sk_buff **pp = NULL;
1270 struct sk_buff *p; 1270 struct sk_buff *p;
1271 struct iphdr *iph; 1271 struct iphdr *iph;
@@ -1342,7 +1342,7 @@ out:
1342 1342
1343static int inet_gro_complete(struct sk_buff *skb) 1343static int inet_gro_complete(struct sk_buff *skb)
1344{ 1344{
1345 struct net_protocol *ops; 1345 const struct net_protocol *ops;
1346 struct iphdr *iph = ip_hdr(skb); 1346 struct iphdr *iph = ip_hdr(skb);
1347 int proto = iph->protocol & (MAX_INET_PROTOS - 1); 1347 int proto = iph->protocol & (MAX_INET_PROTOS - 1);
1348 int err = -ENOSYS; 1348 int err = -ENOSYS;
@@ -1427,13 +1427,13 @@ void snmp_mib_free(void *ptr[2])
1427EXPORT_SYMBOL_GPL(snmp_mib_free); 1427EXPORT_SYMBOL_GPL(snmp_mib_free);
1428 1428
1429#ifdef CONFIG_IP_MULTICAST 1429#ifdef CONFIG_IP_MULTICAST
1430static struct net_protocol igmp_protocol = { 1430static const struct net_protocol igmp_protocol = {
1431 .handler = igmp_rcv, 1431 .handler = igmp_rcv,
1432 .netns_ok = 1, 1432 .netns_ok = 1,
1433}; 1433};
1434#endif 1434#endif
1435 1435
1436static struct net_protocol tcp_protocol = { 1436static const struct net_protocol tcp_protocol = {
1437 .handler = tcp_v4_rcv, 1437 .handler = tcp_v4_rcv,
1438 .err_handler = tcp_v4_err, 1438 .err_handler = tcp_v4_err,
1439 .gso_send_check = tcp_v4_gso_send_check, 1439 .gso_send_check = tcp_v4_gso_send_check,
@@ -1444,7 +1444,7 @@ static struct net_protocol tcp_protocol = {
1444 .netns_ok = 1, 1444 .netns_ok = 1,
1445}; 1445};
1446 1446
1447static struct net_protocol udp_protocol = { 1447static const struct net_protocol udp_protocol = {
1448 .handler = udp_rcv, 1448 .handler = udp_rcv,
1449 .err_handler = udp_err, 1449 .err_handler = udp_err,
1450 .gso_send_check = udp4_ufo_send_check, 1450 .gso_send_check = udp4_ufo_send_check,
@@ -1453,7 +1453,7 @@ static struct net_protocol udp_protocol = {
1453 .netns_ok = 1, 1453 .netns_ok = 1,
1454}; 1454};
1455 1455
1456static struct net_protocol icmp_protocol = { 1456static const struct net_protocol icmp_protocol = {
1457 .handler = icmp_rcv, 1457 .handler = icmp_rcv,
1458 .no_policy = 1, 1458 .no_policy = 1,
1459 .netns_ok = 1, 1459 .netns_ok = 1,
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index e878e494296e..5c662703eb1e 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -311,7 +311,7 @@ static const struct xfrm_type ah_type =
311 .output = ah_output 311 .output = ah_output
312}; 312};
313 313
314static struct net_protocol ah4_protocol = { 314static const struct net_protocol ah4_protocol = {
315 .handler = xfrm4_rcv, 315 .handler = xfrm4_rcv,
316 .err_handler = ah4_err, 316 .err_handler = ah4_err,
317 .no_policy = 1, 317 .no_policy = 1,
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 3863c3a4223f..07336c6201f0 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1087,6 +1087,12 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
1087 case NETDEV_DOWN: 1087 case NETDEV_DOWN:
1088 ip_mc_down(in_dev); 1088 ip_mc_down(in_dev);
1089 break; 1089 break;
1090 case NETDEV_BONDING_OLDTYPE:
1091 ip_mc_unmap(in_dev);
1092 break;
1093 case NETDEV_BONDING_NEWTYPE:
1094 ip_mc_remap(in_dev);
1095 break;
1090 case NETDEV_CHANGEMTU: 1096 case NETDEV_CHANGEMTU:
1091 if (inetdev_valid_mtu(dev->mtu)) 1097 if (inetdev_valid_mtu(dev->mtu))
1092 break; 1098 break;
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 18bb383ea393..12f7287e902d 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -615,7 +615,7 @@ static const struct xfrm_type esp_type =
615 .output = esp_output 615 .output = esp_output
616}; 616};
617 617
618static struct net_protocol esp4_protocol = { 618static const struct net_protocol esp4_protocol = {
619 .handler = xfrm4_rcv, 619 .handler = xfrm4_rcv,
620 .err_handler = esp4_err, 620 .err_handler = esp4_err,
621 .no_policy = 1, 621 .no_policy = 1,
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 97c410e84388..5bc13fe816d1 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -655,7 +655,7 @@ static void icmp_unreach(struct sk_buff *skb)
655 struct iphdr *iph; 655 struct iphdr *iph;
656 struct icmphdr *icmph; 656 struct icmphdr *icmph;
657 int hash, protocol; 657 int hash, protocol;
658 struct net_protocol *ipprot; 658 const struct net_protocol *ipprot;
659 u32 info = 0; 659 u32 info = 0;
660 struct net *net; 660 struct net *net;
661 661
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index 01b4284ed694..d41e5de79a82 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -1298,6 +1298,28 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
1298 } 1298 }
1299} 1299}
1300 1300
1301/* Device changing type */
1302
1303void ip_mc_unmap(struct in_device *in_dev)
1304{
1305 struct ip_mc_list *i;
1306
1307 ASSERT_RTNL();
1308
1309 for (i = in_dev->mc_list; i; i = i->next)
1310 igmp_group_dropped(i);
1311}
1312
1313void ip_mc_remap(struct in_device *in_dev)
1314{
1315 struct ip_mc_list *i;
1316
1317 ASSERT_RTNL();
1318
1319 for (i = in_dev->mc_list; i; i = i->next)
1320 igmp_group_added(i);
1321}
1322
1301/* Device going down */ 1323/* Device going down */
1302 1324
1303void ip_mc_down(struct in_device *in_dev) 1325void ip_mc_down(struct in_device *in_dev)
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 533afaadefd4..d9645c94a067 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1288,7 +1288,7 @@ static void ipgre_fb_tunnel_init(struct net_device *dev)
1288} 1288}
1289 1289
1290 1290
1291static struct net_protocol ipgre_protocol = { 1291static const struct net_protocol ipgre_protocol = {
1292 .handler = ipgre_rcv, 1292 .handler = ipgre_rcv,
1293 .err_handler = ipgre_err, 1293 .err_handler = ipgre_err,
1294 .netns_ok = 1, 1294 .netns_ok = 1,
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index db46b4b5b2b9..6c98b43badf4 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -202,7 +202,7 @@ static int ip_local_deliver_finish(struct sk_buff *skb)
202 { 202 {
203 int protocol = ip_hdr(skb)->protocol; 203 int protocol = ip_hdr(skb)->protocol;
204 int hash, raw; 204 int hash, raw;
205 struct net_protocol *ipprot; 205 const struct net_protocol *ipprot;
206 206
207 resubmit: 207 resubmit:
208 raw = raw_local_deliver(skb, protocol); 208 raw = raw_local_deliver(skb, protocol);
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index 3262ce06294c..38fbf04150ae 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -146,7 +146,7 @@ static const struct xfrm_type ipcomp_type = {
146 .output = ipcomp_output 146 .output = ipcomp_output
147}; 147};
148 148
149static struct net_protocol ipcomp4_protocol = { 149static const struct net_protocol ipcomp4_protocol = {
150 .handler = xfrm4_rcv, 150 .handler = xfrm4_rcv,
151 .err_handler = ipcomp4_err, 151 .err_handler = ipcomp4_err,
152 .no_policy = 1, 152 .no_policy = 1,
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 65d421cf5bc7..c43ec2d51ce2 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -99,10 +99,6 @@ static int ipmr_cache_report(struct net *net,
99 struct sk_buff *pkt, vifi_t vifi, int assert); 99 struct sk_buff *pkt, vifi_t vifi, int assert);
100static int ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm); 100static int ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm);
101 101
102#ifdef CONFIG_IP_PIMSM_V2
103static struct net_protocol pim_protocol;
104#endif
105
106static struct timer_list ipmr_expire_timer; 102static struct timer_list ipmr_expire_timer;
107 103
108/* Service routines creating virtual interfaces: DVMRP tunnels and PIMREG */ 104/* Service routines creating virtual interfaces: DVMRP tunnels and PIMREG */
@@ -1945,7 +1941,7 @@ static const struct file_operations ipmr_mfc_fops = {
1945#endif 1941#endif
1946 1942
1947#ifdef CONFIG_IP_PIMSM_V2 1943#ifdef CONFIG_IP_PIMSM_V2
1948static struct net_protocol pim_protocol = { 1944static const struct net_protocol pim_protocol = {
1949 .handler = pim_rcv, 1945 .handler = pim_rcv,
1950 .netns_ok = 1, 1946 .netns_ok = 1,
1951}; 1947};
diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c
index a2e5fc0a15e1..542f22fc98b3 100644
--- a/net/ipv4/protocol.c
+++ b/net/ipv4/protocol.c
@@ -28,14 +28,14 @@
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29#include <net/protocol.h> 29#include <net/protocol.h>
30 30
31struct net_protocol *inet_protos[MAX_INET_PROTOS] ____cacheline_aligned_in_smp; 31const struct net_protocol *inet_protos[MAX_INET_PROTOS] ____cacheline_aligned_in_smp;
32static DEFINE_SPINLOCK(inet_proto_lock); 32static DEFINE_SPINLOCK(inet_proto_lock);
33 33
34/* 34/*
35 * Add a protocol handler to the hash tables 35 * Add a protocol handler to the hash tables
36 */ 36 */
37 37
38int inet_add_protocol(struct net_protocol *prot, unsigned char protocol) 38int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol)
39{ 39{
40 int hash, ret; 40 int hash, ret;
41 41
@@ -57,7 +57,7 @@ int inet_add_protocol(struct net_protocol *prot, unsigned char protocol)
57 * Remove a protocol from the hash tables. 57 * Remove a protocol from the hash tables.
58 */ 58 */
59 59
60int inet_del_protocol(struct net_protocol *prot, unsigned char protocol) 60int inet_del_protocol(const struct net_protocol *prot, unsigned char protocol)
61{ 61{
62 int hash, ret; 62 int hash, ret;
63 63
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index edeea060db44..19a0612b8a20 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2012,7 +2012,7 @@ int tcp_disconnect(struct sock *sk, int flags)
2012 tp->snd_cwnd = 2; 2012 tp->snd_cwnd = 2;
2013 icsk->icsk_probes_out = 0; 2013 icsk->icsk_probes_out = 0;
2014 tp->packets_out = 0; 2014 tp->packets_out = 0;
2015 tp->snd_ssthresh = 0x7fffffff; 2015 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
2016 tp->snd_cwnd_cnt = 0; 2016 tp->snd_cwnd_cnt = 0;
2017 tp->bytes_acked = 0; 2017 tp->bytes_acked = 0;
2018 tcp_set_ca_state(sk, TCP_CA_Open); 2018 tcp_set_ca_state(sk, TCP_CA_Open);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index af6d6fa00db1..d86784be7ab3 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -761,7 +761,7 @@ void tcp_update_metrics(struct sock *sk)
761 set_dst_metric_rtt(dst, RTAX_RTTVAR, var); 761 set_dst_metric_rtt(dst, RTAX_RTTVAR, var);
762 } 762 }
763 763
764 if (tp->snd_ssthresh >= 0xFFFF) { 764 if (tcp_in_initial_slowstart(tp)) {
765 /* Slow start still did not finish. */ 765 /* Slow start still did not finish. */
766 if (dst_metric(dst, RTAX_SSTHRESH) && 766 if (dst_metric(dst, RTAX_SSTHRESH) &&
767 !dst_metric_locked(dst, RTAX_SSTHRESH) && 767 !dst_metric_locked(dst, RTAX_SSTHRESH) &&
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0543561da999..7cda24b53f61 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1808,7 +1808,7 @@ static int tcp_v4_init_sock(struct sock *sk)
1808 /* See draft-stevens-tcpca-spec-01 for discussion of the 1808 /* See draft-stevens-tcpca-spec-01 for discussion of the
1809 * initialization of these values. 1809 * initialization of these values.
1810 */ 1810 */
1811 tp->snd_ssthresh = 0x7fffffff; /* Infinity */ 1811 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
1812 tp->snd_cwnd_clamp = ~0; 1812 tp->snd_cwnd_clamp = ~0;
1813 tp->mss_cache = 536; 1813 tp->mss_cache = 536;
1814 1814
@@ -2284,7 +2284,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
2284 jiffies_to_clock_t(icsk->icsk_ack.ato), 2284 jiffies_to_clock_t(icsk->icsk_ack.ato),
2285 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong, 2285 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
2286 tp->snd_cwnd, 2286 tp->snd_cwnd,
2287 tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh, 2287 tcp_in_initial_slowstart(tp) ? -1 : tp->snd_ssthresh,
2288 len); 2288 len);
2289} 2289}
2290 2290
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index e48c37d74d77..624c3c9b3c2b 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -363,7 +363,7 @@ void tcp_twsk_destructor(struct sock *sk)
363#ifdef CONFIG_TCP_MD5SIG 363#ifdef CONFIG_TCP_MD5SIG
364 struct tcp_timewait_sock *twsk = tcp_twsk(sk); 364 struct tcp_timewait_sock *twsk = tcp_twsk(sk);
365 if (twsk->tw_md5_keylen) 365 if (twsk->tw_md5_keylen)
366 tcp_put_md5sig_pool(); 366 tcp_free_md5sig_pool();
367#endif 367#endif
368} 368}
369 369
@@ -410,7 +410,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req,
410 newtp->retrans_out = 0; 410 newtp->retrans_out = 0;
411 newtp->sacked_out = 0; 411 newtp->sacked_out = 0;
412 newtp->fackets_out = 0; 412 newtp->fackets_out = 0;
413 newtp->snd_ssthresh = 0x7fffffff; 413 newtp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
414 414
415 /* So many TCP implementations out there (incorrectly) count the 415 /* So many TCP implementations out there (incorrectly) count the
416 * initial SYN frame in their delayed-ACK and congestion control 416 * initial SYN frame in their delayed-ACK and congestion control
diff --git a/net/ipv4/tunnel4.c b/net/ipv4/tunnel4.c
index cb1f0e83830b..3959e0ca456a 100644
--- a/net/ipv4/tunnel4.c
+++ b/net/ipv4/tunnel4.c
@@ -132,7 +132,7 @@ static void tunnel64_err(struct sk_buff *skb, u32 info)
132} 132}
133#endif 133#endif
134 134
135static struct net_protocol tunnel4_protocol = { 135static const struct net_protocol tunnel4_protocol = {
136 .handler = tunnel4_rcv, 136 .handler = tunnel4_rcv,
137 .err_handler = tunnel4_err, 137 .err_handler = tunnel4_err,
138 .no_policy = 1, 138 .no_policy = 1,
@@ -140,7 +140,7 @@ static struct net_protocol tunnel4_protocol = {
140}; 140};
141 141
142#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 142#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
143static struct net_protocol tunnel64_protocol = { 143static const struct net_protocol tunnel64_protocol = {
144 .handler = tunnel64_rcv, 144 .handler = tunnel64_rcv,
145 .err_handler = tunnel64_err, 145 .err_handler = tunnel64_err,
146 .no_policy = 1, 146 .no_policy = 1,
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c
index c784891cb7e5..95248d7f75ec 100644
--- a/net/ipv4/udplite.c
+++ b/net/ipv4/udplite.c
@@ -25,7 +25,7 @@ static void udplite_err(struct sk_buff *skb, u32 info)
25 __udp4_lib_err(skb, info, &udplite_table); 25 __udp4_lib_err(skb, info, &udplite_table);
26} 26}
27 27
28static struct net_protocol udplite_protocol = { 28static const struct net_protocol udplite_protocol = {
29 .handler = udplite_rcv, 29 .handler = udplite_rcv,
30 .err_handler = udplite_err, 30 .err_handler = udplite_err,
31 .no_policy = 1, 31 .no_policy = 1,