From: Yu Watanabe Date: Thu, 25 Jul 2019 01:11:45 +0000 (+0900) Subject: network: drop redundant Link::kind check X-Git-Tag: v243-rc1~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=500b96eb34adda950323e90189c262da3ece57c8;p=thirdparty%2Fsystemd.git network: drop redundant Link::kind check All CAN devices' iftype are ARPHRD_CAN. So, checking Link::kind is redundant. Follow-up for c6ac3729c9ece63185a3c4e7bc1970b98d2feb01. --- diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 64e8bac7ae2..17d37c16172 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -90,13 +90,6 @@ int link_sysctl_ipv6_enabled(Link *link) { return link->sysctl_ipv6_enabled; } -static bool link_is_can(Link *link) { - assert(link); - - return link->iftype == ARPHRD_CAN || - STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan"); -} - static bool link_dhcp6_enabled(Link *link) { assert(link); @@ -112,7 +105,7 @@ static bool link_dhcp6_enabled(Link *link) { if (link->network->bond) return false; - if (link_is_can(link)) + if (link->iftype == ARPHRD_CAN) return false; if (link_sysctl_ipv6_enabled(link) == 0) @@ -133,7 +126,7 @@ static bool link_dhcp4_enabled(Link *link) { if (link->network->bond) return false; - if (link_is_can(link)) + if (link->iftype == ARPHRD_CAN) return false; return link->network->dhcp & ADDRESS_FAMILY_IPV4; @@ -151,7 +144,7 @@ static bool link_dhcp4_server_enabled(Link *link) { if (link->network->bond) return false; - if (link_is_can(link)) + if (link->iftype == ARPHRD_CAN) return false; return link->network->dhcp_server; @@ -167,7 +160,7 @@ bool link_ipv4ll_enabled(Link *link, AddressFamilyBoolean mask) { if (!link->network) return false; - if (link_is_can(link)) + if (link->iftype == ARPHRD_CAN) return false; if (STRPTR_IN_SET(link->kind, @@ -197,7 +190,7 @@ static bool link_ipv6ll_enabled(Link *link) { if (!link->network) return false; - if (link_is_can(link)) + if (link->iftype == ARPHRD_CAN) return false; if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "sit", "vti", "nlmon")) @@ -224,7 +217,7 @@ static bool link_ipv6_enabled(Link *link) { if (link_sysctl_ipv6_enabled(link) == 0) return false; - if (link_is_can(link)) + if (link->iftype == ARPHRD_CAN) return false; /* DHCPv6 client will not be started if no IPv6 link-local address is configured. */ @@ -2508,7 +2501,7 @@ static int link_configure(Link *link) { assert(link->network); assert(link->state == LINK_STATE_INITIALIZED); - if (link_is_can(link)) + if (link->iftype == ARPHRD_CAN) return link_configure_can(link); /* Drop foreign config, but ignore loopback or critical devices.