Compare commits
3 Commits
f12d19b304
...
08c588d18b
Author | SHA1 | Date |
---|---|---|
Yu Watanabe | 08c588d18b | |
Yu Watanabe | 74f0fb9095 | |
Susant Sahani | 6cfef1b308 |
|
@ -2317,6 +2317,16 @@
|
||||||
the value of a received bit by majority rule. When unset, the kernel's default will be used.</para>
|
the value of a received bit by majority rule. When unset, the kernel's default will be used.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>ListenOnly=</varname></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Takes a boolean. When <literal>yes</literal>, listen-only mode is enabled. When the
|
||||||
|
interface is in listen-only mode, the interface neither transmit CAN frames nor send ACK
|
||||||
|
bit. Listen-only mode is important to debug CAN networks without interfering with the
|
||||||
|
communication or acknowledge the CAN frame. When unset, the kernel's default will be used.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,7 @@ typedef struct LinkInfo {
|
||||||
unsigned short iftype;
|
unsigned short iftype;
|
||||||
struct ether_addr mac_address;
|
struct ether_addr mac_address;
|
||||||
struct ether_addr permanent_mac_address;
|
struct ether_addr permanent_mac_address;
|
||||||
|
uint32_t master;
|
||||||
uint32_t mtu;
|
uint32_t mtu;
|
||||||
uint32_t min_mtu;
|
uint32_t min_mtu;
|
||||||
uint32_t max_mtu;
|
uint32_t max_mtu;
|
||||||
|
@ -342,6 +343,8 @@ static int decode_link(sd_netlink_message *m, LinkInfo *info, char **patterns, b
|
||||||
return log_oom();
|
return log_oom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void) sd_netlink_message_read_u32(m, IFLA_MASTER, &info->master);
|
||||||
|
|
||||||
/* fill kind info */
|
/* fill kind info */
|
||||||
(void) decode_netdev(m, info);
|
(void) decode_netdev(m, info);
|
||||||
|
|
||||||
|
@ -1354,6 +1357,15 @@ static int link_status_one(
|
||||||
return table_log_add_error(r);
|
return table_log_add_error(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info->master > 0) {
|
||||||
|
r = table_add_many(table,
|
||||||
|
TABLE_EMPTY,
|
||||||
|
TABLE_STRING, "Master:",
|
||||||
|
TABLE_IFINDEX, info->master);
|
||||||
|
if (r < 0)
|
||||||
|
return table_log_add_error(r);
|
||||||
|
}
|
||||||
|
|
||||||
if (streq_ptr(info->netdev_kind, "bridge")) {
|
if (streq_ptr(info->netdev_kind, "bridge")) {
|
||||||
r = table_add_many(table,
|
r = table_add_many(table,
|
||||||
TABLE_EMPTY,
|
TABLE_EMPTY,
|
||||||
|
|
|
@ -71,6 +71,7 @@ static int link_set_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link)
|
||||||
|
|
||||||
static int link_set_can(Link *link) {
|
static int link_set_can(Link *link) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||||
|
struct can_ctrlmode cm = {};
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
|
@ -142,13 +143,18 @@ static int link_set_can(Link *link) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->network->can_triple_sampling >= 0) {
|
if (link->network->can_triple_sampling >= 0) {
|
||||||
struct can_ctrlmode cm = {
|
cm.mask |= CAN_CTRLMODE_3_SAMPLES;
|
||||||
.mask = CAN_CTRLMODE_3_SAMPLES,
|
SET_FLAG(cm.flags, CAN_CTRLMODE_3_SAMPLES, link->network->can_triple_sampling);
|
||||||
.flags = link->network->can_triple_sampling ? CAN_CTRLMODE_3_SAMPLES : 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
log_link_debug(link, "%sabling triple-sampling", link->network->can_triple_sampling ? "En" : "Dis");
|
log_link_debug(link, "%sabling triple-sampling", link->network->can_triple_sampling ? "En" : "Dis");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (link->network->can_listen_only >= 0) {
|
||||||
|
cm.mask |= CAN_CTRLMODE_LISTENONLY;
|
||||||
|
SET_FLAG(cm.flags, CAN_CTRLMODE_LISTENONLY, link->network->can_listen_only);
|
||||||
|
log_link_debug(link, "%sabling listen-only mode", link->network->can_listen_only ? "En" : "Dis");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cm.mask != 0) {
|
||||||
r = sd_netlink_message_append_data(m, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
|
r = sd_netlink_message_append_data(m, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not append IFLA_CAN_CTRLMODE attribute: %m");
|
return log_link_error_errno(link, r, "Could not append IFLA_CAN_CTRLMODE attribute: %m");
|
||||||
|
|
|
@ -1334,11 +1334,11 @@ int dhcp4_configure(Link *link) {
|
||||||
return log_oom();
|
return log_oom();
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to create DHCP4 client: %m");
|
return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to create DHCP4 client: %m");
|
||||||
}
|
|
||||||
|
|
||||||
r = sd_dhcp_client_attach_event(link->dhcp_client, NULL, 0);
|
r = sd_dhcp_client_attach_event(link->dhcp_client, NULL, 0);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to attach event: %m");
|
return log_link_error_errno(link, r, "DHCP4 CLIENT: Failed to attach event: %m");
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_dhcp_client_set_mac(link->dhcp_client,
|
r = sd_dhcp_client_set_mac(link->dhcp_client,
|
||||||
(const uint8_t *) &link->mac,
|
(const uint8_t *) &link->mac,
|
||||||
|
|
|
@ -154,6 +154,10 @@ int ipv4ll_configure(Link *link) {
|
||||||
r = sd_ipv4ll_new(&link->ipv4ll);
|
r = sd_ipv4ll_new(&link->ipv4ll);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
r = sd_ipv4ll_attach_event(link->ipv4ll, NULL, 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->sd_device &&
|
if (link->sd_device &&
|
||||||
|
@ -163,10 +167,6 @@ int ipv4ll_configure(Link *link) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_ipv4ll_attach_event(link->ipv4ll, NULL, 0);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_ipv4ll_set_mac(link->ipv4ll, &link->mac);
|
r = sd_ipv4ll_set_mac(link->ipv4ll, &link->mac);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -256,6 +256,7 @@ CAN.SamplePoint, config_parse_permille,
|
||||||
CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us)
|
CAN.RestartSec, config_parse_sec, 0, offsetof(Network, can_restart_us)
|
||||||
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
|
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
|
||||||
CAN.Termination, config_parse_tristate, 0, offsetof(Network, can_termination)
|
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
|
QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
|
||||||
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
|
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
|
||||||
BFIFO.Parent, config_parse_qdisc_parent, QDISC_KIND_BFIFO, 0
|
BFIFO.Parent, config_parse_qdisc_parent, QDISC_KIND_BFIFO, 0
|
||||||
|
|
|
@ -200,6 +200,7 @@ struct Network {
|
||||||
usec_t can_restart_us;
|
usec_t can_restart_us;
|
||||||
int can_triple_sampling;
|
int can_triple_sampling;
|
||||||
int can_termination;
|
int can_termination;
|
||||||
|
int can_listen_only;
|
||||||
|
|
||||||
AddressFamily ip_forward;
|
AddressFamily ip_forward;
|
||||||
bool ip_masquerade;
|
bool ip_masquerade;
|
||||||
|
|
|
@ -201,6 +201,7 @@ BitRate=
|
||||||
RestartSec=
|
RestartSec=
|
||||||
TripleSampling=
|
TripleSampling=
|
||||||
Termination=
|
Termination=
|
||||||
|
ListenOnly=
|
||||||
[Address]
|
[Address]
|
||||||
DuplicateAddressDetection=
|
DuplicateAddressDetection=
|
||||||
AutoJoin=
|
AutoJoin=
|
||||||
|
|
Loading…
Reference in New Issue