diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 422268b0f7..5a6613ab60 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -2742,6 +2742,16 @@ IPv6Token=prefixstable:2002:da8:1:: the value of a received bit by majority rule. When unset, the kernel's default will be used. + + BusErrorReporting= + + Takes a boolean. When yes, reporting of CAN bus errors is activated + (those include single bit, frame format, and bit stuffing errors, unable to send dominant bit, + unable to send recessive bit, bus overload, active error announcement, error occurred on + transmission). When unset, the kernel's default will be used. Note: in case of a CAN bus with a + single CAN device, sending a CAN frame may result in a huge number of CAN bus errors. + + ListenOnly= diff --git a/src/network/networkd-can.c b/src/network/networkd-can.c index d3aefe1970..c0018c306f 100644 --- a/src/network/networkd-can.c +++ b/src/network/networkd-can.c @@ -211,6 +211,12 @@ static int link_set_can(Link *link) { log_link_debug(link, "Setting triple-sampling to '%s'.", yes_no(link->network->can_triple_sampling)); } + if (link->network->can_berr_reporting >= 0) { + cm.mask |= CAN_CTRLMODE_BERR_REPORTING; + SET_FLAG(cm.flags, CAN_CTRLMODE_BERR_REPORTING, link->network->can_berr_reporting); + log_link_debug(link, "Setting bus error reporting to '%s'.", yes_no(link->network->can_berr_reporting)); + } + if (link->network->can_listen_only >= 0) { cm.mask |= CAN_CTRLMODE_LISTENONLY; SET_FLAG(cm.flags, CAN_CTRLMODE_LISTENONLY, link->network->can_listen_only); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 444c6c78bc..55c404a19b 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -320,6 +320,7 @@ CAN.FDMode, config_parse_tristate, CAN.FDNonISO, config_parse_tristate, 0, offsetof(Network, can_non_iso) CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us) CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling) +CAN.BusErrorReporting, config_parse_tristate, 0, offsetof(Network, can_berr_reporting) CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination) CAN.ListenOnly, config_parse_tristate, 0, offsetof(Network, can_listen_only) QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0 diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 6f1afed091..6b7c9aaa3f 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -415,6 +415,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi .ipv6_accept_ra_start_dhcp6_client = IPV6_ACCEPT_RA_START_DHCP6_CLIENT_YES, .can_triple_sampling = -1, + .can_berr_reporting = -1, .can_termination = -1, .can_listen_only = -1, .can_fd_mode = -1, diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 762dc971db..2b7dc4e94b 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -231,6 +231,7 @@ struct Network { unsigned can_data_sample_point; usec_t can_restart_us; int can_triple_sampling; + int can_berr_reporting; int can_termination; int can_listen_only; int can_fd_mode; diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index e7860702c6..a8324b3b01 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -246,6 +246,7 @@ FDMode= FDNonISO= RestartSec= TripleSampling= +BusErrorReporting= Termination= ListenOnly= [Address]