summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/systemd.network.xml7
-rw-r--r--src/libsystemd/sd-netlink/netlink-types.c1
-rw-r--r--src/network/networkd-can.c13
-rw-r--r--src/network/networkd-network-gperf.gperf1
-rw-r--r--src/network/networkd-network.c1
-rw-r--r--src/network/networkd-network.h1
-rw-r--r--test/fuzz/fuzz-network-parser/directives.network1
7 files changed, 25 insertions, 0 deletions
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index 209787bf1b..6b8aa15ea3 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -2278,6 +2278,13 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><varname>Termination=</varname></term>
+ <listitem>
+ <para>Takes a boolean. When <literal>yes</literal>, the termination resistor will be selected for
+ the bias network. When unset, the kernel's default will be used.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><varname>TripleSampling=</varname></term>
<listitem>
<para>Takes a boolean. When <literal>yes</literal>, three samples (instead of one) are used to determine
diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
index e35127a4cd..3aa7002e80 100644
--- a/src/libsystemd/sd-netlink/netlink-types.c
+++ b/src/libsystemd/sd-netlink/netlink-types.c
@@ -316,6 +316,7 @@ static const NLType rtnl_link_info_data_can_types[] = {
[IFLA_CAN_BITTIMING] = { .size = sizeof(struct can_bittiming) },
[IFLA_CAN_RESTART_MS] = { .type = NETLINK_TYPE_U32 },
[IFLA_CAN_CTRLMODE] = { .size = sizeof(struct can_ctrlmode) },
+ [IFLA_CAN_TERMINATION] = { .type = NETLINK_TYPE_U16 },
};
static const NLType rtnl_link_info_data_macsec_types[] = {
diff --git a/src/network/networkd-can.c b/src/network/networkd-can.c
index 5087dbbc2e..c703f94f3a 100644
--- a/src/network/networkd-can.c
+++ b/src/network/networkd-can.c
@@ -9,6 +9,8 @@
#include "networkd-manager.h"
#include "string-util.h"
+#define CAN_TERMINATION_OHM_VALUE 120
+
static int link_up_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
int r;
@@ -152,6 +154,17 @@ static int link_set_can(Link *link) {
return log_link_error_errno(link, r, "Could not append IFLA_CAN_CTRLMODE attribute: %m");
}
+ if (link->network->can_termination >= 0) {
+
+ log_link_debug(link, "%sabling can-termination", link->network->can_termination ? "En" : "Dis");
+
+ r = sd_netlink_message_append_u16(m, IFLA_CAN_TERMINATION,
+ link->network->can_termination ? CAN_TERMINATION_OHM_VALUE : 0);
+ if (r < 0)
+ return log_link_error_errno(link, r, "Could not append IFLA_CAN_TERMINATION attribute: %m");
+
+ }
+
r = sd_netlink_message_close_container(m);
if (r < 0)
return log_link_error_errno(link, r, "Failed to close netlink container: %m");
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index 134f1535d6..9679300b62 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -251,6 +251,7 @@ CAN.BitRate, config_parse_si_uint64,
CAN.SamplePoint, config_parse_permille, 0, offsetof(Network, can_sample_point)
CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us)
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
+CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination)
QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index b06ae75c05..41f8245c22 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -455,6 +455,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
.can_triple_sampling = -1,
+ .can_termination = -1,
.ip_service_type = -1,
};
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index 66f010a793..3bcf9ac493 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -199,6 +199,7 @@ struct Network {
unsigned can_sample_point;
usec_t can_restart_us;
int can_triple_sampling;
+ int can_termination;
AddressFamily ip_forward;
bool ip_masquerade;
diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network
index 2b41239b74..c1c667d237 100644
--- a/test/fuzz/fuzz-network-parser/directives.network
+++ b/test/fuzz/fuzz-network-parser/directives.network
@@ -198,6 +198,7 @@ SamplePoint=
BitRate=
RestartSec=
TripleSampling=
+Termination=
[Address]
DuplicateAddressDetection=
AutoJoin=