aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_frontend.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/fib_frontend.c')
-rw-r--r--net/ipv4/fib_frontend.c18
1 files changed, 10 insertions, 8 deletions
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