Compare commits
No commits in common. "6878c02245b49987749e73a12003fcf07bf173ca" and "c0619079cc9f3c81da24b38f803e7aadb85be953" have entirely different histories.
6878c02245
...
c0619079cc
3
NEWS
3
NEWS
|
@ -127,8 +127,7 @@ CHANGES WITH 244 in spe:
|
||||||
disciplines in the kernel using the new
|
disciplines in the kernel using the new
|
||||||
[TrafficControlQueueingDiscipline] section and Parent=,
|
[TrafficControlQueueingDiscipline] section and Parent=,
|
||||||
NetworkEmulatorDelaySec=, NetworkEmulatorDelayJitterSec=,
|
NetworkEmulatorDelaySec=, NetworkEmulatorDelayJitterSec=,
|
||||||
NetworkEmulatorPacketLimit=, NetworkEmulatorLossRate=,
|
NetworkEmulatorPacketLimit=, NetworkEmulatorLossRate= settings.
|
||||||
NetworkEmulatorDuplicateRate= settings.
|
|
||||||
|
|
||||||
* systemd-tmpfiles gained a new w+ setting to append to files.
|
* systemd-tmpfiles gained a new w+ setting to append to files.
|
||||||
|
|
||||||
|
|
|
@ -2351,14 +2351,6 @@
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>NetworkEmulatorDuplicateRate=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies that the chosen percent of packets is duplicated before queuing them.
|
|
||||||
Takes a percentage value, suffixed with "%". Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
|
|
@ -151,8 +151,10 @@ _public_ int sd_dhcp_raw_option_new(uint8_t type, char *data, size_t length, sd_
|
||||||
.type = type,
|
.type = type,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!p->data)
|
if (!p->data) {
|
||||||
|
free(p);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
*ret = TAKE_PTR(p);
|
*ret = TAKE_PTR(p);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -247,8 +247,7 @@ CAN.TripleSampling, config_parse_tristate,
|
||||||
TrafficControlQueueingDiscipline.Parent, config_parse_tc_qdiscs_parent, 0, 0
|
TrafficControlQueueingDiscipline.Parent, config_parse_tc_qdiscs_parent, 0, 0
|
||||||
TrafficControlQueueingDiscipline.NetworkEmulatorDelaySec, config_parse_tc_network_emulator_delay, 0, 0
|
TrafficControlQueueingDiscipline.NetworkEmulatorDelaySec, config_parse_tc_network_emulator_delay, 0, 0
|
||||||
TrafficControlQueueingDiscipline.NetworkEmulatorDelayJitterSec, config_parse_tc_network_emulator_delay, 0, 0
|
TrafficControlQueueingDiscipline.NetworkEmulatorDelayJitterSec, config_parse_tc_network_emulator_delay, 0, 0
|
||||||
TrafficControlQueueingDiscipline.NetworkEmulatorLossRate, config_parse_tc_network_emulator_rate, 0, 0
|
TrafficControlQueueingDiscipline.NetworkEmulatorLossRate, config_parse_tc_network_emulator_loss_rate, 0, 0
|
||||||
TrafficControlQueueingDiscipline.NetworkEmulatorDuplicateRate, config_parse_tc_network_emulator_rate, 0, 0
|
|
||||||
TrafficControlQueueingDiscipline.NetworkEmulatorPacketLimit, config_parse_tc_network_emulator_packet_limit, 0, 0
|
TrafficControlQueueingDiscipline.NetworkEmulatorPacketLimit, config_parse_tc_network_emulator_packet_limit, 0, 0
|
||||||
/* backwards compatibility: do not add new entries to this section */
|
/* backwards compatibility: do not add new entries to this section */
|
||||||
Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
|
Network.IPv4LL, config_parse_ipv4ll, 0, offsetof(Network, link_local)
|
||||||
|
|
|
@ -50,9 +50,6 @@ int network_emulator_fill_message(Link *link, QDiscs *qdisc, sd_netlink_message
|
||||||
if (qdisc->ne.loss > 0)
|
if (qdisc->ne.loss > 0)
|
||||||
opt.loss = qdisc->ne.loss;
|
opt.loss = qdisc->ne.loss;
|
||||||
|
|
||||||
if (qdisc->ne.duplicate > 0)
|
|
||||||
opt.duplicate = qdisc->ne.duplicate;
|
|
||||||
|
|
||||||
if (qdisc->ne.delay != USEC_INFINITY) {
|
if (qdisc->ne.delay != USEC_INFINITY) {
|
||||||
r = tc_time_to_tick(qdisc->ne.delay, &opt.latency);
|
r = tc_time_to_tick(qdisc->ne.delay, &opt.latency);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -127,7 +124,7 @@ int config_parse_tc_network_emulator_delay(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config_parse_tc_network_emulator_rate(
|
int config_parse_tc_network_emulator_loss_rate(
|
||||||
const char *unit,
|
const char *unit,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
unsigned line,
|
unsigned line,
|
||||||
|
@ -141,7 +138,6 @@ int config_parse_tc_network_emulator_rate(
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDiscs *qdisc = NULL;
|
_cleanup_(qdisc_free_or_set_invalidp) QDiscs *qdisc = NULL;
|
||||||
Network *network = data;
|
Network *network = data;
|
||||||
uint32_t rate;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(filename);
|
assert(filename);
|
||||||
|
@ -160,19 +156,14 @@ int config_parse_tc_network_emulator_rate(
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = parse_tc_percent(rvalue, &rate);
|
r = parse_tc_percent(rvalue, &qdisc->ne.loss);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
"Failed to parse 'NetworkEmularorLossRate=', ignoring assignment: %s",
|
||||||
lvalue, rvalue);
|
rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streq(lvalue, "NetworkEmulatorLossRate"))
|
|
||||||
qdisc->ne.loss = rate;
|
|
||||||
else if (streq(lvalue, "NetworkEmulatorDuplicateRate"))
|
|
||||||
qdisc->ne.duplicate = rate;
|
|
||||||
|
|
||||||
qdisc = NULL;
|
qdisc = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,11 @@ typedef struct NetworkEmulator {
|
||||||
|
|
||||||
uint32_t limit;
|
uint32_t limit;
|
||||||
uint32_t loss;
|
uint32_t loss;
|
||||||
uint32_t duplicate;
|
|
||||||
} NetworkEmulator;
|
} NetworkEmulator;
|
||||||
|
|
||||||
int network_emulator_new(NetworkEmulator **ret);
|
int network_emulator_new(NetworkEmulator **ret);
|
||||||
int network_emulator_fill_message(Link *link, QDiscs *qdisc, sd_netlink_message *req);
|
int network_emulator_fill_message(Link *link, QDiscs *qdisc, sd_netlink_message *req);
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_tc_network_emulator_delay);
|
CONFIG_PARSER_PROTOTYPE(config_parse_tc_network_emulator_delay);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_tc_network_emulator_rate);
|
CONFIG_PARSER_PROTOTYPE(config_parse_tc_network_emulator_loss_rate);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_tc_network_emulator_packet_limit);
|
CONFIG_PARSER_PROTOTYPE(config_parse_tc_network_emulator_packet_limit);
|
||||||
|
|
|
@ -116,7 +116,6 @@ static int qdisc_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||||
|
|
||||||
int qdisc_configure(Link *link, QDiscs *qdisc) {
|
int qdisc_configure(Link *link, QDiscs *qdisc) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
|
||||||
_cleanup_free_ char *tca_kind = NULL;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
|
@ -133,31 +132,25 @@ int qdisc_configure(Link *link, QDiscs *qdisc) {
|
||||||
return log_link_error_errno(link, r, "Could not create tcm_parent message: %m");
|
return log_link_error_errno(link, r, "Could not create tcm_parent message: %m");
|
||||||
|
|
||||||
if (qdisc->parent == TC_H_CLSACT) {
|
if (qdisc->parent == TC_H_CLSACT) {
|
||||||
tca_kind = strdup("clsact");
|
|
||||||
if (!tca_kind)
|
|
||||||
return log_oom();
|
|
||||||
|
|
||||||
r = sd_rtnl_message_set_qdisc_handle(req, TC_H_MAKE(TC_H_CLSACT, 0));
|
r = sd_rtnl_message_set_qdisc_handle(req, TC_H_MAKE(TC_H_CLSACT, 0));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not set tcm_handle message: %m");
|
return log_link_error_errno(link, r, "Could not set tcm_handle message: %m");
|
||||||
|
|
||||||
|
r = sd_netlink_message_append_string(req, TCA_KIND, "clsact");
|
||||||
|
if (r < 0)
|
||||||
|
return log_link_error_errno(link, r, "Could not append TCA_KIND attribute: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qdisc->has_network_emulator) {
|
if (qdisc->has_network_emulator) {
|
||||||
r = free_and_strdup(&tca_kind, "netem");
|
r = sd_netlink_message_append_string(req, TCA_KIND, "netem");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_link_error_errno(link, r, "Could not append TCA_KIND attribute: %m");
|
||||||
|
|
||||||
r = network_emulator_fill_message(link, qdisc, req);
|
r = network_emulator_fill_message(link, qdisc, req);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tca_kind) {
|
|
||||||
r = sd_netlink_message_append_string(req, TCA_KIND, tca_kind);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_KIND attribute: %m");
|
|
||||||
}
|
|
||||||
|
|
||||||
r = netlink_call_async(link->manager->rtnl, NULL, req, qdisc_handler, link_netlink_destroy_callback, link);
|
r = netlink_call_async(link->manager->rtnl, NULL, req, qdisc_handler, link_netlink_destroy_callback, link);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
||||||
|
|
|
@ -268,5 +268,4 @@ Parent=
|
||||||
NetworkEmulatorDelaySec=
|
NetworkEmulatorDelaySec=
|
||||||
NetworkEmulatorDelayJitterSec=
|
NetworkEmulatorDelayJitterSec=
|
||||||
NetworkEmulatorLossRate=
|
NetworkEmulatorLossRate=
|
||||||
NetworkEmulatorDuplicateRate=
|
|
||||||
NetworkEmulatorPacketLimit=
|
NetworkEmulatorPacketLimit=
|
||||||
|
|
Loading…
Reference in New Issue