diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-24 11:23:45 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-24 16:13:22 +0200 |
commit | c6ac3729c9ece63185a3c4e7bc1970b98d2feb01 (patch) | |
tree | a29920a864d7b153afe3257ee550a0018a653165 /src/network | |
parent | tree-wide: drop netinet/ether.h from socket-util.h and sd-netlink.h (diff) | |
download | systemd-c6ac3729c9ece63185a3c4e7bc1970b98d2feb01.tar.xz systemd-c6ac3729c9ece63185a3c4e7bc1970b98d2feb01.zip |
network: support slcan
The device driver does not have IFLA_INFO_KIND attribute. So, we need to
check iftype.
Closes #13150.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/networkd-link.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 61f2bcaaba..64e8bac7ae 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -90,6 +90,13 @@ 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); @@ -105,7 +112,7 @@ static bool link_dhcp6_enabled(Link *link) { if (link->network->bond) return false; - if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan")) + if (link_is_can(link)) return false; if (link_sysctl_ipv6_enabled(link) == 0) @@ -126,7 +133,7 @@ static bool link_dhcp4_enabled(Link *link) { if (link->network->bond) return false; - if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan")) + if (link_is_can(link)) return false; return link->network->dhcp & ADDRESS_FAMILY_IPV4; @@ -144,7 +151,7 @@ static bool link_dhcp4_server_enabled(Link *link) { if (link->network->bond) return false; - if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan")) + if (link_is_can(link)) return false; return link->network->dhcp_server; @@ -160,9 +167,12 @@ bool link_ipv4ll_enabled(Link *link, AddressFamilyBoolean mask) { if (!link->network) return false; + if (link_is_can(link)) + return false; + if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "ip6gre","ip6tnl", "sit", "vti", - "vti6", "can", "vcan", "vxcan", "nlmon", "xfrm")) + "vti6", "nlmon", "xfrm")) return false; /* L3 or L3S mode do not support ARP. */ @@ -187,7 +197,10 @@ static bool link_ipv6ll_enabled(Link *link) { if (!link->network) return false; - if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "sit", "vti", "can", "vcan", "vxcan", "nlmon")) + if (link_is_can(link)) + return false; + + if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "sit", "vti", "nlmon")) return false; if (link->network->bond) @@ -211,7 +224,7 @@ static bool link_ipv6_enabled(Link *link) { if (link_sysctl_ipv6_enabled(link) == 0) return false; - if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan")) + if (link_is_can(link)) return false; /* DHCPv6 client will not be started if no IPv6 link-local address is configured. */ @@ -2495,7 +2508,7 @@ static int link_configure(Link *link) { assert(link->network); assert(link->state == LINK_STATE_INITIALIZED); - if (STRPTR_IN_SET(link->kind, "can", "vcan", "vxcan")) + if (link_is_can(link)) return link_configure_can(link); /* Drop foreign config, but ignore loopback or critical devices. |