]> git.ipfire.org Git - thirdparty/iproute2.git/commit
ip-monitor: Fix the selection of rtnl groups when listening for all object types
authorBenjamin Poirier <bpoirier@nvidia.com>
Thu, 22 Sep 2022 06:19:38 +0000 (15:19 +0900)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 30 Sep 2022 19:36:40 +0000 (12:36 -0700)
commit831f7c6f237bf071c2e573ffb84fe04887bacfcd
tree85431356d2f9955b3dbbc5c45b9b760d84e03bcb
parent4e8a9914c4d459be57ddedf1df35b315e7fea8a5
ip-monitor: Fix the selection of rtnl groups when listening for all object types

Currently, when using `ip monitor`, family-specific rtnl multicast groups
(ex. RTNLGRP_IPV4_IFADDR) are used when specifying the '-family' option (or
one of its short forms) and an object type is specified (ex. `ip -4 monitor
addr`) but not when listening for changes to all object types (ex. `ip -4
monitor`). In that case, multicast groups for all families, regardless of
the '-family' option, are used. Depending on the object type, this leads to
ignoring the '-family' selection (MROUTE, ADDR, NETCONF), or printing stray
prefix headers with no event (ROUTE, RULE).

Rewrite the parameter parsing code so that per-family rtnl multicast groups
are selected in all cases.

The issue can be witnessed while running `ip -4 monitor label` at the same
time as the following command:
ip link add dummy0 address 02:00:00:00:00:01 up type dummy
The output includes:
[ROUTE][ROUTE][ADDR]9: dummy0    inet6 fe80::ff:fe00:1/64 scope link
       valid_lft forever preferred_lft forever
Notice the stray "[ROUTE]" labels (related to filtered out ipv6 routes) and
the ipv6 ADDR entry. Those do not appear if using `ip -4 monitor label
route address`.

Fixes: aba5acdfdb34 ("(Logical change 1.3)")
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ipmonitor.c