• Jakub Kicinski's avatar
    rtnetlink: make the "split" NLM_DONE handling generic · 5b4b62a1
    Jakub Kicinski authored
    Jaroslav reports Dell's OMSA Systems Management Data Engine
    expects NLM_DONE in a separate recvmsg(), both for rtnl_dump_ifinfo()
    and inet_dump_ifaddr(). We already added a similar fix previously in
    commit 460b0d33 ("inet: bring NLM_DONE out to a separate recv() again")
    
    Instead of modifying all the dump handlers, and making them look
    different than modern for_each_netdev_dump()-based dump handlers -
    put the workaround in rtnetlink code. This will also help us move
    the custom rtnl-locking from af_netlink in the future (in net-next).
    
    Note that this change is not touching rtnl_dump_all(). rtnl_dump_all()
    is different kettle of fish and a potential problem. We now mix families
    in a single recvmsg(), but NLM_DONE is not coalesced.
    
    Tested:
    
      ./cli.py --dbg-small-recv 4096 --spec netlink/specs/rt_addr.yaml \
               --dump getaddr --json '{"ifa-family": 2}'
    
      ./cli.py --dbg-small-recv 4096 --spec netlink/specs/rt_route.yaml \
               --dump getroute --json '{"rtm-family": 2}'
    
      ./cli.py --dbg-small-recv 4096 --spec netlink/specs/rt_link.yaml \
               --dump getlink
    
    Fixes: 3e41af90 ("rtnetlink: use xarray iterator to implement rtnl_dump_ifinfo()")
    Fixes: cdb2f80f ("inet: use xa_array iterator to implement inet_dump_ifaddr()")
    Reported-by: default avatarJaroslav Pulchart <jaroslav.pulchart@gooddata.com>
    Link: https://lore.kernel.org/all/CAK8fFZ7MKoFSEzMBDAOjoUt+vTZRRQgLDNXEOfdCCXSoXXKE0g@mail.gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    5b4b62a1
rtnetlink.h 7.16 KB