Message ID | alpine.LFD.2.00.1211210055040.1751@ja.ssi.bg |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
From: Julian Anastasov <ja@ssi.bg> Date: Wed, 21 Nov 2012 02:35:34 +0200 (EET) > [PATCH net-next] ipv4: do not cache looped multicasts > > We have two cases for outgoing multicasts > depending on the membership: with or without RTCF_LOCAL. > Currently, we use caching only if route to 224/4 is used. > As we can not cache for both cases, optimize the caching > for senders only, do not cache routes with RTCF_LOCAL > flag set. > > Signed-off-by: Julian Anastasov <ja@ssi.bg> The sad part is that you warned me about this issue nearly 2 years ago Julian, sorry :-/ -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2012-11-21 at 02:35 +0200, Julian Anastasov wrote: Hi, > Do you also have CONFIG_IP_MROUTE enabled? I see the I don't > problem with caching both "RTCF_MULTICAST | RTCF_LOCAL" and > "RTCF_MULTICAST" flags to same place but I'm not sure in the > sequence of route lookups for your setup. ip_mc_output does > not care about RTCF_LOCAL when CONFIG_IP_MROUTE is disabled, > so in this case it should loop the packet even on wrong > caching (without RTCF_LOCAL flag). but the problem here was that dst was using ip_output() instead of ip_mc_output(). > Can you try the following patch. If it does not > solve the problem we have to add some debugs in __mkroute_output. > And I'm not sure if this is fatal only when CONFIG_IP_MROUTE > is enabled, I have to spend more time to check the code. > As an optimization, the patch avoids lookup for fnhe > when multicast is not cached because multicasts are > not redirected and they do not learn PMTU. > > The patch is not tested. I'll update the commit > message after your tests. the patch fixes the problem, and it looks valid to me. thanks !
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 5b58788..0d73f86 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1785,6 +1785,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res, if (dev_out->flags & IFF_LOOPBACK) flags |= RTCF_LOCAL; + do_cache = true; if (type == RTN_BROADCAST) { flags |= RTCF_BROADCAST | RTCF_LOCAL; fi = NULL; @@ -1793,6 +1794,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res, if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr, fl4->flowi4_proto)) flags &= ~RTCF_LOCAL; + else + do_cache = false; /* If multicast route do not exist use * default one, but do not gateway in this case. * Yes, it is hack. @@ -1802,8 +1805,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res, } fnhe = NULL; - do_cache = fi != NULL; - if (fi) { + do_cache &= fi != NULL; + if (do_cache) { struct rtable __rcu **prth; struct fib_nh *nh = &FIB_RES_NH(*res);