network: drop redundant Link::kind check

All CAN devices' iftype are ARPHRD_CAN. So, checking Link::kind is
redundant.

Follow-up for c6ac3729c9.
This commit is contained in:
Yu Watanabe 2019-07-25 10:11:45 +09:00
parent b9109ff710
commit 500b96eb34

View File

@ -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.