mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
network: tc/cake: introduce NAT= setting
This commit is contained in:
@@ -3587,6 +3587,18 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>NAT=</varname></term>
|
||||||
|
<listitem>
|
||||||
|
<para>Takes a boolean value. When true, CAKE performs a NAT lookup before applying
|
||||||
|
flow-isolation rules, to determine the true addresses and port numbers of the packet, to
|
||||||
|
improve fairness between hosts inside the NAT. This has no practical effect when
|
||||||
|
<varname>FlowIsolationMode=</varname> is <literal>none</literal> or <literal>flows</literal>,
|
||||||
|
or if NAT is performed on a different host. Defaults to unset, and the kernel's default is
|
||||||
|
used.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
|||||||
@@ -390,6 +390,7 @@ CAKE.AutoRateIngress, config_parse_cake_tristate,
|
|||||||
CAKE.OverheadBytes, config_parse_cake_overhead, QDISC_KIND_CAKE, 0
|
CAKE.OverheadBytes, config_parse_cake_overhead, QDISC_KIND_CAKE, 0
|
||||||
CAKE.CompensationMode, config_parse_cake_compensation_mode, QDISC_KIND_CAKE, 0
|
CAKE.CompensationMode, config_parse_cake_compensation_mode, QDISC_KIND_CAKE, 0
|
||||||
CAKE.FlowIsolationMode, config_parse_cake_flow_isolation_mode, QDISC_KIND_CAKE, 0
|
CAKE.FlowIsolationMode, config_parse_cake_flow_isolation_mode, QDISC_KIND_CAKE, 0
|
||||||
|
CAKE.NAT, config_parse_cake_tristate, QDISC_KIND_CAKE, 0
|
||||||
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
|
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
|
||||||
ControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_CODEL, 0
|
ControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_CODEL, 0
|
||||||
ControlledDelay.PacketLimit, config_parse_controlled_delay_u32, QDISC_KIND_CODEL, 0
|
ControlledDelay.PacketLimit, config_parse_controlled_delay_u32, QDISC_KIND_CODEL, 0
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ static int cake_init(QDisc *qdisc) {
|
|||||||
c->autorate = -1;
|
c->autorate = -1;
|
||||||
c->compensation_mode = _CAKE_COMPENSATION_MODE_INVALID;
|
c->compensation_mode = _CAKE_COMPENSATION_MODE_INVALID;
|
||||||
c->flow_isolation_mode = _CAKE_FLOW_ISOLATION_MODE_INVALID;
|
c->flow_isolation_mode = _CAKE_FLOW_ISOLATION_MODE_INVALID;
|
||||||
|
c->nat = -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -70,6 +71,12 @@ static int cake_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req)
|
|||||||
return log_link_error_errno(link, r, "Could not append TCA_CAKE_FLOW_MODE attribute: %m");
|
return log_link_error_errno(link, r, "Could not append TCA_CAKE_FLOW_MODE attribute: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c->nat >= 0) {
|
||||||
|
r = sd_netlink_message_append_u32(req, TCA_CAKE_NAT, c->nat);
|
||||||
|
if (r < 0)
|
||||||
|
return log_link_error_errno(link, r, "Could not append TCA_CAKE_NAT attribute: %m");
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_netlink_message_close_container(req);
|
r = sd_netlink_message_close_container(req);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
|
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
|
||||||
@@ -227,6 +234,8 @@ int config_parse_cake_tristate(
|
|||||||
|
|
||||||
if (streq(lvalue, "AutoRateIngress"))
|
if (streq(lvalue, "AutoRateIngress"))
|
||||||
dest = &c->autorate;
|
dest = &c->autorate;
|
||||||
|
else if (streq(lvalue, "NAT"))
|
||||||
|
dest = &c->nat;
|
||||||
else
|
else
|
||||||
assert_not_reached();
|
assert_not_reached();
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ typedef struct CommonApplicationsKeptEnhanced {
|
|||||||
|
|
||||||
/* Flow isolation parameters */
|
/* Flow isolation parameters */
|
||||||
CakeFlowIsolationMode flow_isolation_mode;
|
CakeFlowIsolationMode flow_isolation_mode;
|
||||||
|
int nat;
|
||||||
|
|
||||||
} CommonApplicationsKeptEnhanced;
|
} CommonApplicationsKeptEnhanced;
|
||||||
|
|
||||||
|
|||||||
@@ -472,6 +472,7 @@ AutoRateIngress=
|
|||||||
OverheadBytes=
|
OverheadBytes=
|
||||||
CompensationMode=
|
CompensationMode=
|
||||||
FlowIsolationMode=
|
FlowIsolationMode=
|
||||||
|
NAT=
|
||||||
[TrafficControlQueueingDiscipline]
|
[TrafficControlQueueingDiscipline]
|
||||||
Parent=
|
Parent=
|
||||||
NetworkEmulatorDelaySec=
|
NetworkEmulatorDelaySec=
|
||||||
|
|||||||
Reference in New Issue
Block a user