mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 20:25:38 +03:00
Merge pull request #13166 from yuwata/network-slcan-support
network: slcan support
This commit is contained in:
commit
4410f5c902
@ -3,9 +3,9 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/if_ether.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
@ -3,8 +3,9 @@
|
||||
Copyright © 2014 Axis Communications AB. All rights reserved.
|
||||
***/
|
||||
|
||||
#include <linux/filter.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <linux/filter.h>
|
||||
#include <netinet/if_ether.h>
|
||||
|
||||
#include "arp-util.h"
|
||||
#include "fd-util.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
|
||||
#include "sd-dhcp6-client.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -4,6 +4,7 @@
|
||||
***/
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -4,6 +4,7 @@
|
||||
***/
|
||||
|
||||
#include <errno.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/socket.h>
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "hostname-util.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include "sd-radv.h"
|
||||
|
||||
#include "sd-dhcp6-client.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <linux/if.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
@ -89,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);
|
||||
|
||||
@ -104,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)
|
||||
@ -125,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;
|
||||
@ -143,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;
|
||||
@ -159,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. */
|
||||
@ -186,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)
|
||||
@ -210,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. */
|
||||
@ -2494,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.
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "fd-util.h"
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <endian.h>
|
||||
#include <inttypes.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "alloc-util.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <linux/neighbour.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
Loading…
Reference in New Issue
Block a user