mroute: "ip mroute show" not working when "to" and/or "from" is given
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>
This commit is contained in:
parent
4e4b78324f
commit
45b01c46d4
|
|
@ -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)
|
if (filter.af && filter.af != r->rtm_family)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (tb[RTA_DST] &&
|
if (tb[RTA_DST] && filter.mdst.bitlen > 0) {
|
||||||
filter.mdst.bitlen > 0 &&
|
inet_prefix dst;
|
||||||
inet_addr_match(RTA_DATA(tb[RTA_DST]), &filter.mdst, filter.mdst.bitlen))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (tb[RTA_SRC] &&
|
memset(&dst, 0, sizeof(dst));
|
||||||
filter.msrc.bitlen > 0 &&
|
dst.family = r->rtm_family;
|
||||||
inet_addr_match(RTA_DATA(tb[RTA_SRC]), &filter.msrc, filter.msrc.bitlen))
|
memcpy(&dst.data, RTA_DATA(tb[RTA_DST]), RTA_PAYLOAD(tb[RTA_DST]));
|
||||||
return 0;
|
if (inet_addr_match(&dst, &filter.mdst, filter.mdst.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;
|
family = r->rtm_family == RTNL_FAMILY_IPMR ? AF_INET : AF_INET6;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue