network: selinux hook handling to enumerate nexthop
authorPurushottam choudhary <purushottam.choudhary@kpit.com>
Wed, 28 Oct 2020 16:41:49 +0000 (22:11 +0530)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 1 Nov 2020 14:28:21 +0000 (23:28 +0900)
commit92b555aaabf710e0a672a7244e8c0e3963075133
tree97a6388fca6ce52d9b9185092175916ef5a6f75e
parentd008666aca9f74a267bd6d14ef4047e8a6487864
network: selinux hook handling to enumerate nexthop

When selinux is enabled, the call of
manager_rtnl_enumerate_nexthop() fails.

This fix is to facilitate selinux hook handling for enumerating
nexthop.

In manager_rtnl_enumerate_nexthop() there is a check
if "Not supported" is returned by the send_netlink() call.

This check expects that -EOPNOTSUPP is returned,
the selinux hook seems to return -EINVAL instead.

This happens in kernel older than 5.3
(more specificallytorvalds/linux@65ee00a) as it does not support
nexthop handling through netlink.

And if SELinux is enforced in the order kernel, callingRTM_GETNEXTHOP
returns -EINVAL.

Thus adding a call in the manager_rtnl_enumerate_nexthop for the
extra return -EINVAL.
src/network/networkd-manager.c