Laszlo Attila Toth wrote:
+/*
+ * Find address type as if only "on_dev" was present in the system. If
+ * on_dev is NULL then all interfaces are taken into consideration.
+ */
+static inline unsigned __inet_addr_type_on_dev(__be32 addr, const struct net_device *on_dev)
I would prefer the name "__inet_dev_addr_type" or "__dev_inet_addr_type"
{
struct flowi fl = { .nl_u = { .ip4_u = { .daddr = addr } } };
struct fib_result res;
@@ -164,13 +168,25 @@ unsigned inet_addr_type(__be32 addr)
ret = RTN_UNICAST;
if (!ip_fib_local_table->tb_lookup(ip_fib_local_table,
&fl, &res)) {
- ret = res.type;
+ if ((!on_dev || on_dev == res.fi->fib_dev)) {
+ ret = res.type;
+ }
No braces around single statements that fit on one line please.
fib_res_put(&res);
}
}
return ret;
}
+unsigned inet_addr_type(__be32 addr)
+{
+ return __inet_addr_type_on_dev(addr, NULL);
Use tabs for indenting.
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html