* [PATCH] ipv4/route/rtnl: get mcast attributes when dst is multicast
@ 2012-12-04 11:03 Nicolas Dichtel
2012-12-07 17:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Dichtel @ 2012-12-04 11:03 UTC (permalink / raw)
To: netdev; +Cc: davem, Nicolas Dichtel
Commit f1ce3062c538 (ipv4: Remove 'rt_dst' from 'struct rtable') removes the
call to ipmr_get_route(), which will get multicast parameters of the route.
I revert the part of the patch that remove this call. I think the goal was only
to get rid of rt_dst field.
The patch is only compiled-tested. My first idea was to remove ipmr_get_route()
because rt_fill_info() was the only user, but it seems the previous patch cleans
the code a bit too much ;-)
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
net/ipv4/route.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index df25142..69135ed 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2232,8 +2232,27 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
error = rt->dst.error;
if (rt_is_input_route(rt)) {
- if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
- goto nla_put_failure;
+#ifdef CONFIG_IP_MROUTE
+ if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
+ IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
+ int err = ipmr_get_route(net, skb,
+ fl4->saddr, fl4->daddr,
+ r, nowait);
+ if (err <= 0) {
+ if (!nowait) {
+ if (err == 0)
+ return 0;
+ goto nla_put_failure;
+ } else {
+ if (err == -EMSGSIZE)
+ goto nla_put_failure;
+ error = err;
+ }
+ }
+ } else
+#endif
+ if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
+ goto nla_put_failure;
}
if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0)
--
1.8.0.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipv4/route/rtnl: get mcast attributes when dst is multicast
2012-12-04 11:03 [PATCH] ipv4/route/rtnl: get mcast attributes when dst is multicast Nicolas Dichtel
@ 2012-12-07 17:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-12-07 17:25 UTC (permalink / raw)
To: nicolas.dichtel; +Cc: netdev
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 4 Dec 2012 12:03:07 +0100
> Commit f1ce3062c538 (ipv4: Remove 'rt_dst' from 'struct rtable') removes the
> call to ipmr_get_route(), which will get multicast parameters of the route.
>
> I revert the part of the patch that remove this call. I think the goal was only
> to get rid of rt_dst field.
>
> The patch is only compiled-tested. My first idea was to remove ipmr_get_route()
> because rt_fill_info() was the only user, but it seems the previous patch cleans
> the code a bit too much ;-)
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Good catch, applied to net-next.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-07 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-04 11:03 [PATCH] ipv4/route/rtnl: get mcast attributes when dst is multicast Nicolas Dichtel
2012-12-07 17:25 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).