From 56ea854f0691e93501edb45d11625da63106b0ca Mon Sep 17 00:00:00 2001 From: Susant Sahani <145210+ssahani@users.noreply.github.com> Date: Wed, 18 Oct 2017 11:55:57 +0530 Subject: [PATCH] networkd: Don't stop networkd if CONFIG_FIB_RULES=n in kernel (#7030) If FIB Rules are not supported by the kernel then networkd fails to start as it retuns error=-EOPNOTSUPP. In this case just ignore and let start networkd. ``` sendto(5, {{len=28, type=RTM_GETRULE, flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_DUMP, seq=8, pid=0}, {family=AF_UNSPEC, dst_len=0, src_len=0, tos=0, table=RT_TABLE_UNSPEC, action=FR_ACT_TO_TBL, flags=0}}, 28, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 16) = 28 recvmsg(5, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=128->12, msg_iov=[{iov_base=NULL, iov_len=0}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_NETLINK, cmsg_type=0x3}], msg_controllen=24, msg_flags=MSG_TRUNC}, MSG_PEEK|MSG_TRUNC) = 48 recvmsg(5, {msg_name={sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, msg_namelen=128->12, msg_iov=[{iov_base={{len=48, type=NLMSG_ERROR, flags=0, seq=8, pid=8856}, {error=-EOPNOTSUPP, msg={{len=28, type=RTM_GETRULE, flags=NLM_F_REQUEST|NLM_F_ACK|NLM_F_DUMP, seq=8, pid=0}, {family=AF_UNSPEC, dst_len=0, src_len=0, tos=0, table=RT_TABLE_UNSPEC, action=FR_ACT_TO_TBL, flags=0}}}}, iov_len=7416}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_NETLINK, cmsg_type=0x3}], msg_controllen=24, msg_flags=0}, MSG_TRUNC) = 48 ``` ``` Oct 08 10:22:24 naomi systemd[1]: Starting Network Service... Oct 08 10:22:24 naomi systemd-networkd[983]: Could not enumerate rules: Operation not supported Oct 08 10:22:24 naomi systemd[1]: systemd-networkd.service: Main process exited, code=exited, status=1/FAILURE ``` Fixes #7027 (cherry picked from commit 6acbbdd4da2d072112042abbce8c0a9523beed4e) --- src/network/networkd-manager.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 71445d5dda..200d0f622d 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -1454,8 +1454,14 @@ int manager_rtnl_enumerate_rules(Manager *m) { return r; r = sd_netlink_call(m->rtnl, req, 0, &reply); - if (r < 0) + if (r < 0) { + if (r == -EOPNOTSUPP) { + log_debug("FIB Rules are not supported by the kernel. Ignoring."); + return 0; + } + return r; + } for (rule = reply; rule; rule = sd_netlink_message_next(rule)) { int k;