|
|
@@ -166,7 +166,8 @@ struct net_device * ip_dev_find(__be32 addr)
|
|
|
* Find address type as if only "dev" was present in the system. If
|
|
|
* on_dev is NULL then all interfaces are taken into consideration.
|
|
|
*/
|
|
|
-static inline unsigned __inet_dev_addr_type(const struct net_device *dev,
|
|
|
+static inline unsigned __inet_dev_addr_type(struct net *net,
|
|
|
+ const struct net_device *dev,
|
|
|
__be32 addr)
|
|
|
{
|
|
|
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,
|
|
|
res.r = NULL;
|
|
|
#endif
|
|
|
|
|
|
- local_table = fib_get_table(&init_net, RT_TABLE_LOCAL);
|
|
|
+ local_table = fib_get_table(net, RT_TABLE_LOCAL);
|
|
|
if (local_table) {
|
|
|
ret = RTN_UNICAST;
|
|
|
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,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-unsigned int inet_addr_type(__be32 addr)
|
|
|
+unsigned int inet_addr_type(struct net *net, __be32 addr)
|
|
|
{
|
|
|
- return __inet_dev_addr_type(NULL, addr);
|
|
|
+ return __inet_dev_addr_type(net, NULL, addr);
|
|
|
}
|
|
|
|
|
|
-unsigned int inet_dev_addr_type(const struct net_device *dev, __be32 addr)
|
|
|
+unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
|
|
|
+ __be32 addr)
|
|
|
{
|
|
|
- return __inet_dev_addr_type(dev, addr);
|
|
|
+ return __inet_dev_addr_type(net, dev, addr);
|
|
|
}
|
|
|
|
|
|
/* 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,
|
|
|
if (rt->rt_gateway.sa_family == AF_INET && addr) {
|
|
|
cfg->fc_gw = addr;
|
|
|
if (rt->rt_flags & RTF_GATEWAY &&
|
|
|
- inet_addr_type(addr) == RTN_UNICAST)
|
|
|
+ inet_addr_type(&init_net, addr) == RTN_UNICAST)
|
|
|
cfg->fc_scope = RT_SCOPE_UNIVERSE;
|
|
|
}
|
|
|
|
|
|
@@ -782,7 +784,7 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
|
|
|
fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim);
|
|
|
|
|
|
/* Check, that this local address finally disappeared. */
|
|
|
- if (inet_addr_type(ifa->ifa_local) != RTN_LOCAL) {
|
|
|
+ if (inet_addr_type(&init_net, ifa->ifa_local) != RTN_LOCAL) {
|
|
|
/* And the last, but not the least thing.
|
|
|
We must flush stray FIB entries.
|
|
|
|