]> git.ipfire.org Git - thirdparty/iproute2.git/commit
utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR
authorHangbin Liu <liuhangbin@gmail.com>
Thu, 27 Jul 2017 09:44:15 +0000 (17:44 +0800)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 27 Jul 2017 18:27:17 +0000 (11:27 -0700)
commit5ce897a03bfda76dc66dc1acfa014fc0e3d3022a
tree8ad5ee8e8db12f4b691287a8b6efbe56be176a6b
parentd3f0b091976b73842f2dbfcecaba341fd204c635
utils: return default family when rtm_family is not RTNL_FAMILY_IPMR/IP6MR

When we get a multicast route, the rtm_type is RTN_MULTICAST, but the
rtm_family may be AF_INET. If we only check the type with RTNL_FAMILY_IPMR,
we will get malformed address. e.g.

+ ip -4 route add multicast 172.111.1.1 dev em1 table main

Before fix:
+ ip route list type multicast table main
multicast ac6f:101:800:400:400:0:3c00:0 dev em1 scope link

After fix:
+ ip route list type multicast table main
multicast 172.111.1.1 dev em1 scope link

Fixes: 56e3eb4c3400 ("ip: route: fix multicast route dumps")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Acked-by: Phil Sutter <phil@nwl.cc>
lib/utils.c