aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/s390/net/qeth_main.c2
-rw-r--r--include/net/route.h4
-rw-r--r--net/atm/clip.c2
-rw-r--r--net/ipv4/af_inet.c2
-rw-r--r--net/ipv4/arp.c12
-rw-r--r--net/ipv4/fib_frontend.c18
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/icmp.c4
-rw-r--r--net/ipv4/ip_options.c4
-rw-r--r--net/ipv4/ipvs/ip_vs_core.c2
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c4
-rw-r--r--net/ipv4/netfilter.c2
-rw-r--r--net/ipv4/netfilter/ipt_addrtype.c2
-rw-r--r--net/ipv4/raw.c2
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv6/af_inet6.c2
-rw-r--r--net/sctp/protocol.c2
17 files changed, 36 insertions, 34 deletions
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index ff999ff0b627..f1866a283850 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -8340,7 +8340,7 @@ qeth_arp_constructor(struct neighbour *neigh)
8340 neigh->parms = neigh_parms_clone(parms); 8340 neigh->parms = neigh_parms_clone(parms);
8341 rcu_read_unlock(); 8341 rcu_read_unlock();
8342 8342
8343 neigh->type = inet_addr_type(*(__be32 *) neigh->primary_key); 8343 neigh->type = inet_addr_type(&init_net, *(__be32 *) neigh->primary_key);
8344 neigh->nud_state = NUD_NOARP; 8344 neigh->nud_state = NUD_NOARP;
8345 neigh->ops = arp_direct_ops; 8345 neigh->ops = arp_direct_ops;
8346 neigh->output = neigh->ops->queue_xmit; 8346 neigh->output = neigh->ops->queue_xmit;
diff --git a/include/net/route.h b/include/net/route.h
index 76b08c1affc0..b77700059252 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -117,8 +117,8 @@ extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, stru
117extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); 117extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu);
118extern void ip_rt_send_redirect(struct sk_buff *skb); 118extern void ip_rt_send_redirect(struct sk_buff *skb);
119 119
120extern unsigned inet_addr_type(__be32 addr); 120extern unsigned inet_addr_type(struct net *net, __be32 addr);
121extern unsigned inet_dev_addr_type(const struct net_device *dev, __be32 addr); 121extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr);
122extern void ip_rt_multicast_event(struct in_device *); 122extern void ip_rt_multicast_event(struct in_device *);
123extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); 123extern int ip_rt_ioctl(unsigned int cmd, void __user *arg);
124extern void ip_rt_get_source(u8 *src, struct rtable *rt); 124extern void ip_rt_get_source(u8 *src, struct rtable *rt);
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 47fbdc0c5f72..df7d218a6827 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -285,7 +285,7 @@ static int clip_constructor(struct neighbour *neigh)
285 struct neigh_parms *parms; 285 struct neigh_parms *parms;
286 286
287 pr_debug("clip_constructor (neigh %p, entry %p)\n", neigh, entry); 287 pr_debug("clip_constructor (neigh %p, entry %p)\n", neigh, entry);
288 neigh->type = inet_addr_type(entry->ip); 288 neigh->type = inet_addr_type(&init_net, entry->ip);
289 if (neigh->type != RTN_UNICAST) 289 if (neigh->type != RTN_UNICAST)
290 return -EINVAL; 290 return -EINVAL;
291 291
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 40ecaae7be32..d76f8d8d5eba 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -446,7 +446,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
446 if (addr_len < sizeof(struct sockaddr_in)) 446 if (addr_len < sizeof(struct sockaddr_in))
447 goto out; 447 goto out;
448 448
449 chk_addr_ret = inet_addr_type(addr->sin_addr.s_addr); 449 chk_addr_ret = inet_addr_type(&init_net, addr->sin_addr.s_addr);
450 450
451 /* Not specified by any standard per-se, however it breaks too 451 /* Not specified by any standard per-se, however it breaks too
452 * many applications when removed. It is unfortunate since 452 * many applications when removed. It is unfortunate since
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 46edf1c32a40..3f0730ec0a21 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -235,7 +235,7 @@ static int arp_constructor(struct neighbour *neigh)
235 struct in_device *in_dev; 235 struct in_device *in_dev;
236 struct neigh_parms *parms; 236 struct neigh_parms *parms;
237 237
238 neigh->type = inet_addr_type(addr); 238 neigh->type = inet_addr_type(&init_net, addr);
239 239
240 rcu_read_lock(); 240 rcu_read_lock();
241 in_dev = __in_dev_get_rcu(dev); 241 in_dev = __in_dev_get_rcu(dev);
@@ -341,14 +341,14 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
341 switch (IN_DEV_ARP_ANNOUNCE(in_dev)) { 341 switch (IN_DEV_ARP_ANNOUNCE(in_dev)) {
342 default: 342 default:
343 case 0: /* By default announce any local IP */ 343 case 0: /* By default announce any local IP */
344 if (skb && inet_addr_type(ip_hdr(skb)->saddr) == RTN_LOCAL) 344 if (skb && inet_addr_type(&init_net, ip_hdr(skb)->saddr) == RTN_LOCAL)
345 saddr = ip_hdr(skb)->saddr; 345 saddr = ip_hdr(skb)->saddr;
346 break; 346 break;
347 case 1: /* Restrict announcements of saddr in same subnet */ 347 case 1: /* Restrict announcements of saddr in same subnet */
348 if (!skb) 348 if (!skb)
349 break; 349 break;
350 saddr = ip_hdr(skb)->saddr; 350 saddr = ip_hdr(skb)->saddr;
351 if (inet_addr_type(saddr) == RTN_LOCAL) { 351 if (inet_addr_type(&init_net, saddr) == RTN_LOCAL) {
352 /* saddr should be known to target */ 352 /* saddr should be known to target */
353 if (inet_addr_onlink(in_dev, target, saddr)) 353 if (inet_addr_onlink(in_dev, target, saddr))
354 break; 354 break;
@@ -479,7 +479,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
479 479
480 paddr = ((struct rtable*)skb->dst)->rt_gateway; 480 paddr = ((struct rtable*)skb->dst)->rt_gateway;
481 481
482 if (arp_set_predefined(inet_addr_type(paddr), haddr, paddr, dev)) 482 if (arp_set_predefined(inet_addr_type(&init_net, paddr), haddr, paddr, dev))
483 return 0; 483 return 0;
484 484
485 n = __neigh_lookup(&arp_tbl, &paddr, dev, 1); 485 n = __neigh_lookup(&arp_tbl, &paddr, dev, 1);
@@ -806,7 +806,7 @@ static int arp_process(struct sk_buff *skb)
806 /* Special case: IPv4 duplicate address detection packet (RFC2131) */ 806 /* Special case: IPv4 duplicate address detection packet (RFC2131) */
807 if (sip == 0) { 807 if (sip == 0) {
808 if (arp->ar_op == htons(ARPOP_REQUEST) && 808 if (arp->ar_op == htons(ARPOP_REQUEST) &&
809 inet_addr_type(tip) == RTN_LOCAL && 809 inet_addr_type(&init_net, tip) == RTN_LOCAL &&
810 !arp_ignore(in_dev,dev,sip,tip)) 810 !arp_ignore(in_dev,dev,sip,tip))
811 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha, 811 arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
812 dev->dev_addr, sha); 812 dev->dev_addr, sha);
@@ -866,7 +866,7 @@ static int arp_process(struct sk_buff *skb)
866 */ 866 */
867 if (n == NULL && 867 if (n == NULL &&
868 arp->ar_op == htons(ARPOP_REPLY) && 868 arp->ar_op == htons(ARPOP_REPLY) &&
869 inet_addr_type(sip) == RTN_UNICAST) 869 inet_addr_type(&init_net, sip) == RTN_UNICAST)
870 n = __neigh_lookup(&arp_tbl, &sip, dev, 1); 870 n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
871 } 871 }
872 872
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 7718823711e3..d1a45cb6f6b0 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -166,7 +166,8 @@ out:
166 * Find address type as if only "dev" was present in the system. If 166 * Find address type as if only "dev" was present in the system. If
167 * on_dev is NULL then all interfaces are taken into consideration. 167 * on_dev is NULL then all interfaces are taken into consideration.
168 */ 168 */
169static inline unsigned __inet_dev_addr_type(const struct net_device *dev, 169static inline unsigned __inet_dev_addr_type(struct net *net,
170 const struct net_device *dev,
170 __be32 addr) 171 __be32 addr)
171{ 172{
172 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } }; 173 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
@@ -183,7 +184,7 @@ static inline unsigned __inet_dev_addr_type(const struct net_device *dev,
183 res.r = NULL; 184 res.r = NULL;
184#endif 185#endif
185 186
186 local_table = fib_get_table(&init_net, RT_TABLE_LOCAL); 187 local_table = fib_get_table(net, RT_TABLE_LOCAL);
187 if (local_table) { 188 if (local_table) {
188 ret = RTN_UNICAST; 189 ret = RTN_UNICAST;
189 if (!local_table->tb_lookup(local_table, &fl, &res)) { 190 if (!local_table->tb_lookup(local_table, &fl, &res)) {
@@ -195,14 +196,15 @@ static inline unsigned __inet_dev_addr_type(const struct net_device *dev,
195 return ret; 196 return ret;
196} 197}
197 198
198unsigned int inet_addr_type(__be32 addr) 199unsigned int inet_addr_type(struct net *net, __be32 addr)
199{ 200{
200 return __inet_dev_addr_type(NULL, addr); 201 return __inet_dev_addr_type(net, NULL, addr);
201} 202}
202 203
203unsigned int inet_dev_addr_type(const struct net_device *dev, __be32 addr) 204unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
205 __be32 addr)
204{ 206{
205 return __inet_dev_addr_type(dev, addr); 207 return __inet_dev_addr_type(net, dev, addr);
206} 208}
207 209
208/* Given (packet source, input interface) and optional (dst, oif, tos): 210/* Given (packet source, input interface) and optional (dst, oif, tos):
@@ -391,7 +393,7 @@ static int rtentry_to_fib_config(int cmd, struct rtentry *rt,
391 if (rt->rt_gateway.sa_family == AF_INET && addr) { 393 if (rt->rt_gateway.sa_family == AF_INET && addr) {
392 cfg->fc_gw = addr; 394 cfg->fc_gw = addr;
393 if (rt->rt_flags & RTF_GATEWAY && 395 if (rt->rt_flags & RTF_GATEWAY &&
394 inet_addr_type(addr) == RTN_UNICAST) 396 inet_addr_type(&init_net, addr) == RTN_UNICAST)
395 cfg->fc_scope = RT_SCOPE_UNIVERSE; 397 cfg->fc_scope = RT_SCOPE_UNIVERSE;
396 } 398 }
397 399
@@ -782,7 +784,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
782 fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim); 784 fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim);
783 785
784 /* Check, that this local address finally disappeared. */ 786 /* Check, that this local address finally disappeared. */
785 if (inet_addr_type(ifa->ifa_local) != RTN_LOCAL) { 787 if (inet_addr_type(&init_net, ifa->ifa_local) != RTN_LOCAL) {
786 /* And the last, but not the least thing. 788 /* And the last, but not the least thing.
787 We must flush stray FIB entries. 789 We must flush stray FIB entries.
788 790
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index bbd4a247b195..c1263e23876b 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -531,7 +531,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
531 531
532 if (cfg->fc_scope >= RT_SCOPE_LINK) 532 if (cfg->fc_scope >= RT_SCOPE_LINK)
533 return -EINVAL; 533 return -EINVAL;
534 if (inet_addr_type(nh->nh_gw) != RTN_UNICAST) 534 if (inet_addr_type(&init_net, nh->nh_gw) != RTN_UNICAST)
535 return -EINVAL; 535 return -EINVAL;
536 if ((dev = __dev_get_by_index(&init_net, nh->nh_oif)) == NULL) 536 if ((dev = __dev_get_by_index(&init_net, nh->nh_oif)) == NULL)
537 return -ENODEV; 537 return -ENODEV;
@@ -809,7 +809,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
809 if (fi->fib_prefsrc) { 809 if (fi->fib_prefsrc) {
810 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst || 810 if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
811 fi->fib_prefsrc != cfg->fc_dst) 811 fi->fib_prefsrc != cfg->fc_dst)
812 if (inet_addr_type(fi->fib_prefsrc) != RTN_LOCAL) 812 if (inet_addr_type(&init_net, fi->fib_prefsrc) != RTN_LOCAL)
813 goto err_inval; 813 goto err_inval;
814 } 814 }
815 815
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 1a6024978e28..e57f1673bf6b 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -590,7 +590,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
590 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET)) 590 if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET))
591 goto out_unlock; 591 goto out_unlock;
592 592
593 if (inet_addr_type(fl.fl4_src) == RTN_LOCAL) 593 if (inet_addr_type(&init_net, fl.fl4_src) == RTN_LOCAL)
594 err = __ip_route_output_key(&rt2, &fl); 594 err = __ip_route_output_key(&rt2, &fl);
595 else { 595 else {
596 struct flowi fl2 = {}; 596 struct flowi fl2 = {};
@@ -733,7 +733,7 @@ static void icmp_unreach(struct sk_buff *skb)
733 */ 733 */
734 734
735 if (!sysctl_icmp_ignore_bogus_error_responses && 735 if (!sysctl_icmp_ignore_bogus_error_responses &&
736 inet_addr_type(iph->daddr) == RTN_BROADCAST) { 736 inet_addr_type(&init_net, iph->daddr) == RTN_BROADCAST) {
737 if (net_ratelimit()) 737 if (net_ratelimit())
738 printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP " 738 printk(KERN_WARNING "%u.%u.%u.%u sent an invalid ICMP "
739 "type %u, code %u " 739 "type %u, code %u "
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
index 2f14745a9e1f..4d315158fd3c 100644
--- a/net/ipv4/ip_options.c
+++ b/net/ipv4/ip_options.c
@@ -151,7 +151,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
151 __be32 addr; 151 __be32 addr;
152 152
153 memcpy(&addr, sptr+soffset-1, 4); 153 memcpy(&addr, sptr+soffset-1, 4);
154 if (inet_addr_type(addr) != RTN_LOCAL) { 154 if (inet_addr_type(&init_net, addr) != RTN_LOCAL) {
155 dopt->ts_needtime = 1; 155 dopt->ts_needtime = 1;
156 soffset += 8; 156 soffset += 8;
157 } 157 }
@@ -400,7 +400,7 @@ int ip_options_compile(struct ip_options * opt, struct sk_buff * skb)
400 { 400 {
401 __be32 addr; 401 __be32 addr;
402 memcpy(&addr, &optptr[optptr[2]-1], 4); 402 memcpy(&addr, &optptr[optptr[2]-1], 4);
403 if (inet_addr_type(addr) == RTN_UNICAST) 403 if (inet_addr_type(&init_net, addr) == RTN_UNICAST)
404 break; 404 break;
405 if (skb) 405 if (skb)
406 timeptr = (__be32*)&optptr[optptr[2]+3]; 406 timeptr = (__be32*)&optptr[optptr[2]+3];
diff --git a/net/ipv4/ipvs/ip_vs_core.c b/net/ipv4/ipvs/ip_vs_core.c
index 041f5120808a..963981a9d501 100644
--- a/net/ipv4/ipvs/ip_vs_core.c
+++ b/net/ipv4/ipvs/ip_vs_core.c
@@ -423,7 +423,7 @@ int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
423 and the destination is RTN_UNICAST (and not local), then create 423 and the destination is RTN_UNICAST (and not local), then create
424 a cache_bypass connection entry */ 424 a cache_bypass connection entry */
425 if (sysctl_ip_vs_cache_bypass && svc->fwmark 425 if (sysctl_ip_vs_cache_bypass && svc->fwmark
426 && (inet_addr_type(iph->daddr) == RTN_UNICAST)) { 426 && (inet_addr_type(&init_net, iph->daddr) == RTN_UNICAST)) {
427 int ret, cs; 427 int ret, cs;
428 struct ip_vs_conn *cp; 428 struct ip_vs_conn *cp;
429 429
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index 9fecfe7d1164..94c5767c8e01 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -704,7 +704,7 @@ __ip_vs_update_dest(struct ip_vs_service *svc,
704 conn_flags = udest->conn_flags | IP_VS_CONN_F_INACTIVE; 704 conn_flags = udest->conn_flags | IP_VS_CONN_F_INACTIVE;
705 705
706 /* check if local node and update the flags */ 706 /* check if local node and update the flags */
707 if (inet_addr_type(udest->addr) == RTN_LOCAL) { 707 if (inet_addr_type(&init_net, udest->addr) == RTN_LOCAL) {
708 conn_flags = (conn_flags & ~IP_VS_CONN_F_FWD_MASK) 708 conn_flags = (conn_flags & ~IP_VS_CONN_F_FWD_MASK)
709 | IP_VS_CONN_F_LOCALNODE; 709 | IP_VS_CONN_F_LOCALNODE;
710 } 710 }
@@ -756,7 +756,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest,
756 756
757 EnterFunction(2); 757 EnterFunction(2);
758 758
759 atype = inet_addr_type(udest->addr); 759 atype = inet_addr_type(&init_net, udest->addr);
760 if (atype != RTN_LOCAL && atype != RTN_UNICAST) 760 if (atype != RTN_LOCAL && atype != RTN_UNICAST)
761 return -EINVAL; 761 return -EINVAL;
762 762
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 4011f8f987c0..0ed843ed420a 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -19,7 +19,7 @@ int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type)
19 unsigned int hh_len; 19 unsigned int hh_len;
20 unsigned int type; 20 unsigned int type;
21 21
22 type = inet_addr_type(iph->saddr); 22 type = inet_addr_type(&init_net, iph->saddr);
23 if (addr_type == RTN_UNSPEC) 23 if (addr_type == RTN_UNSPEC)
24 addr_type = type; 24 addr_type = type;
25 25
diff --git a/net/ipv4/netfilter/ipt_addrtype.c b/net/ipv4/netfilter/ipt_addrtype.c
index 14394c6a3c29..8763902944b7 100644
--- a/net/ipv4/netfilter/ipt_addrtype.c
+++ b/net/ipv4/netfilter/ipt_addrtype.c
@@ -26,7 +26,7 @@ MODULE_DESCRIPTION("iptables addrtype match");
26static inline bool match_type(const struct net_device *dev, __be32 addr, 26static inline bool match_type(const struct net_device *dev, __be32 addr,
27 u_int16_t mask) 27 u_int16_t mask)
28{ 28{
29 return !!(mask & (1 << inet_dev_addr_type(dev, addr))); 29 return !!(mask & (1 << inet_dev_addr_type(&init_net, dev, addr)));
30} 30}
31 31
32static bool 32static bool
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index e811034b1b01..747911a8241c 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -620,7 +620,7 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
620 620
621 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in)) 621 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in))
622 goto out; 622 goto out;
623 chk_addr_ret = inet_addr_type(addr->sin_addr.s_addr); 623 chk_addr_ret = inet_addr_type(&init_net, addr->sin_addr.s_addr);
624 ret = -EADDRNOTAVAIL; 624 ret = -EADDRNOTAVAIL;
625 if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL && 625 if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
626 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) 626 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 78c4ce424a68..1e59c0d4b11e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1164,7 +1164,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
1164 if (IN_DEV_SEC_REDIRECTS(in_dev) && ip_fib_check_default(new_gw, dev)) 1164 if (IN_DEV_SEC_REDIRECTS(in_dev) && ip_fib_check_default(new_gw, dev))
1165 goto reject_redirect; 1165 goto reject_redirect;
1166 } else { 1166 } else {
1167 if (inet_addr_type(new_gw) != RTN_UNICAST) 1167 if (inet_addr_type(&init_net, new_gw) != RTN_UNICAST)
1168 goto reject_redirect; 1168 goto reject_redirect;
1169 } 1169 }
1170 1170
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 218b8b3050a1..ac8772dd968f 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -280,7 +280,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
280 /* Check if the address belongs to the host. */ 280 /* Check if the address belongs to the host. */
281 if (addr_type == IPV6_ADDR_MAPPED) { 281 if (addr_type == IPV6_ADDR_MAPPED) {
282 v4addr = addr->sin6_addr.s6_addr32[3]; 282 v4addr = addr->sin6_addr.s6_addr32[3];
283 if (inet_addr_type(v4addr) != RTN_LOCAL) { 283 if (inet_addr_type(&init_net, v4addr) != RTN_LOCAL) {
284 err = -EADDRNOTAVAIL; 284 err = -EADDRNOTAVAIL;
285 goto out; 285 goto out;
286 } 286 }
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index b92196495027..3f7def2936b4 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -372,7 +372,7 @@ static int sctp_v4_addr_valid(union sctp_addr *addr,
372/* Should this be available for binding? */ 372/* Should this be available for binding? */
373static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) 373static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
374{ 374{
375 int ret = inet_addr_type(addr->v4.sin_addr.s_addr); 375 int ret = inet_addr_type(&init_net, addr->v4.sin_addr.s_addr);
376 376
377 377
378 if (addr->v4.sin_addr.s_addr != INADDR_ANY && 378 if (addr->v4.sin_addr.s_addr != INADDR_ANY &&