* [PATCH iproute2] mroute: "ip mroute show" not working when "to" and/or "from" is given
@ 2015-06-11 16:07 Mazhar Rana
2015-06-25 12:47 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Mazhar Rana @ 2015-06-11 16:07 UTC (permalink / raw)
To: netdev, stephen; +Cc: Mazhar Rana
The command "ip mroute show" is not showing routes when "to" and/or "from"
filter is applied.
root@mazhar:~# ip mroute show
(10.202.30.101, 235.1.2.3) Iif: eth0 Oifs: eth1
But When I applied filter, it does not show anything.
root@mazhar:~# ip mroute show 235.1.2.3 from 10.202.30.101
root@mazhar:~#
Signed-off-by: Mazhar Rana <ranamazharp@gmail.com>
---
ip/ipmroute.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index 125a13f..fffa9e2 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -97,15 +97,25 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
if (filter.af && filter.af != r->rtm_family)
return 0;
- if (tb[RTA_DST] &&
- filter.mdst.bitlen > 0 &&
- inet_addr_match(RTA_DATA(tb[RTA_DST]), &filter.mdst, filter.mdst.bitlen))
- return 0;
+ if (tb[RTA_DST] && filter.mdst.bitlen > 0) {
+ inet_prefix dst;
+
+ memset(&dst, 0, sizeof(dst));
+ dst.family = r->rtm_family;
+ memcpy(&dst.data, RTA_DATA(tb[RTA_DST]), RTA_PAYLOAD(tb[RTA_DST]));
+ if (inet_addr_match(&dst, &filter.mdst, filter.mdst.bitlen))
+ return 0;
+ }
- if (tb[RTA_SRC] &&
- filter.msrc.bitlen > 0 &&
- inet_addr_match(RTA_DATA(tb[RTA_SRC]), &filter.msrc, filter.msrc.bitlen))
- return 0;
+ if (tb[RTA_SRC] && filter.msrc.bitlen > 0) {
+ inet_prefix src;
+
+ memset(&src, 0, sizeof(src));
+ src.family = r->rtm_family;
+ memcpy(&src.data, RTA_DATA(tb[RTA_SRC]), RTA_PAYLOAD(tb[RTA_SRC]));
+ if (inet_addr_match(&src, &filter.msrc, filter.msrc.bitlen))
+ return 0;
+ }
family = r->rtm_family == RTNL_FAMILY_IPMR ? AF_INET : AF_INET6;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iproute2] mroute: "ip mroute show" not working when "to" and/or "from" is given
2015-06-11 16:07 [PATCH iproute2] mroute: "ip mroute show" not working when "to" and/or "from" is given Mazhar Rana
@ 2015-06-25 12:47 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2015-06-25 12:47 UTC (permalink / raw)
To: Mazhar Rana; +Cc: netdev
On Thu, 11 Jun 2015 21:37:36 +0530
Mazhar Rana <ranamazharp@gmail.com> wrote:
> The command "ip mroute show" is not showing routes when "to" and/or "from"
> filter is applied.
>
> root@mazhar:~# ip mroute show
> (10.202.30.101, 235.1.2.3) Iif: eth0 Oifs: eth1
>
> But When I applied filter, it does not show anything.
>
> root@mazhar:~# ip mroute show 235.1.2.3 from 10.202.30.101
> root@mazhar:~#
>
> Signed-off-by: Mazhar Rana <ranamazharp@gmail.com>
Looks good. Applied
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-25 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-11 16:07 [PATCH iproute2] mroute: "ip mroute show" not working when "to" and/or "from" is given Mazhar Rana
2015-06-25 12:47 ` Stephen Hemminger
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).