* [PATCH net] netfilter: remove the nh_scope test in rpfilter_lookup_reverse of ipt_rpfilter
@ 2015-10-04 14:56 Xin Long
2015-10-04 21:48 ` Florian Westphal
0 siblings, 1 reply; 2+ messages in thread
From: Xin Long @ 2015-10-04 14:56 UTC (permalink / raw)
To: network dev; +Cc: fw
--accept-local option works for res.type == RTN_LOCAL, which should be from
the local table, but there, the fib_info's nh->nh_scope = RT_SCOPE_NOWHERE
( > RT_SCOPE_HOST). in fib_create_info().
if (cfg->fc_scope == RT_SCOPE_HOST) {
struct fib_nh *nh = fi->fib_nh;
/* Local address is added. */
if (nhs != 1 || nh->nh_gw)
goto err_inval;
nh->nh_scope = RT_SCOPE_NOWHERE; <===
nh->nh_dev = dev_get_by_index(net, fi->fib_nh->nh_oif);
err = -ENODEV;
if (!nh->nh_dev)
goto failure;
but in our rpfilter_lookup_reverse():
if (dev_match || flags & XT_RPFILTER_LOOSE)
return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
if nh->nh_scope > RT_SCOPE_HOST, it will fail. --accept-local option will never
be passed.
it seems the test is bogus and can be removed to fix this issue.
if (dev_match || flags & XT_RPFILTER_LOOSE)
return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
ipv6 does not have this issue.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/ipv4/netfilter/ipt_rpfilter.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/ipv4/netfilter/ipt_rpfilter.c b/net/ipv4/netfilter/ipt_rpfilter.c
index 8618fd1..11c5662 100644
--- a/net/ipv4/netfilter/ipt_rpfilter.c
+++ b/net/ipv4/netfilter/ipt_rpfilter.c
@@ -61,8 +61,6 @@ static bool rpfilter_lookup_reverse(struct flowi4 *fl4,
if (FIB_RES_DEV(res) == dev)
dev_match = true;
#endif
- if (dev_match || flags & XT_RPFILTER_LOOSE)
- return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
return dev_match;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] netfilter: remove the nh_scope test in rpfilter_lookup_reverse of ipt_rpfilter
2015-10-04 14:56 [PATCH net] netfilter: remove the nh_scope test in rpfilter_lookup_reverse of ipt_rpfilter Xin Long
@ 2015-10-04 21:48 ` Florian Westphal
0 siblings, 0 replies; 2+ messages in thread
From: Florian Westphal @ 2015-10-04 21:48 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, fw
Xin Long <lucien.xin@gmail.com> wrote:
> it seems the test is bogus and can be removed to fix this issue.
>
> if (dev_match || flags & XT_RPFILTER_LOOSE)
> return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
>
> ipv6 does not have this issue.
netfilter patches should be sent to netfilter-devel@vger.kernel.org
> #endif
> - if (dev_match || flags & XT_RPFILTER_LOOSE)
> - return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
> return dev_match;
> }
This breaks --loose option, no?
Thats why I earlier suggested to change this to
> - if (dev_match || flags & XT_RPFILTER_LOOSE)
> - return FIB_RES_NH(res).nh_scope <= RT_SCOPE_HOST;
+ return dev_match || flags & XT_RPFILTER_LOOSE;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-04 21:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-04 14:56 [PATCH net] netfilter: remove the nh_scope test in rpfilter_lookup_reverse of ipt_rpfilter Xin Long
2015-10-04 21:48 ` Florian Westphal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.