@@ -5,12 +5,13 @@ skbmod - user-friendly packet editor action
.SH SYNOPSIS
.in +8
.ti -8
-.BR tc " ... " "action skbmod " "{ [ " "set "
-.IR SETTABLE " ] [ "
+.BR tc " ... " "action skbmod " "{ " "set "
+.IR SETTABLE " | "
.BI swap " SWAPPABLE"
-.RI " ] [ " CONTROL " ] [ "
+.RB " | " ecn
+.RI "} [ " CONTROL " ] [ "
.BI index " INDEX "
-] }
+]
.ti -8
.IR SETTABLE " := "
@@ -25,6 +26,7 @@ skbmod - user-friendly packet editor action
.IR SWAPPABLE " := "
.B mac
.ti -8
+
.IR CONTROL " := {"
.BR reclassify " | " pipe " | " drop " | " shot " | " continue " | " pass " }"
.SH DESCRIPTION
@@ -36,6 +38,12 @@ action. Instead of having to manually edit 8-, 16-, or 32-bit chunks of an
ethernet header,
.B skbmod
allows complete substitution of supported elements.
+Action must be one of
+.BR set ", " swap " and " ecn "."
+.BR set " and " swap
+only affect Ethernet packets, while
+.B ecn
+only affects IP packets.
.SH OPTIONS
.TP
.BI dmac " DMAC"
@@ -48,10 +56,11 @@ Change the source mac to the specified address.
Change the ethertype to the specified value.
.TP
.BI mac
-Used to swap mac addresses. The
-.B swap mac
-directive is performed
-after any outstanding D/SMAC changes.
+Used to swap mac addresses.
+.TP
+.B ecn
+Used to mark ECN Capable Transport (ECT) IP packets as Congestion Encountered (CE).
+Does not affect Non ECN-Capable Transport (Non-ECT) packets.
.TP
.I CONTROL
The following keywords allow to control how the tree of qdisc, classes,
@@ -117,7 +126,7 @@ tc filter add dev eth5 parent 1: protocol ip prio 10 \\
.EE
.RE
-Finally, swap the destination and source mac addresses in the header:
+To swap the destination and source mac addresses in the Ethernet header:
.RS
.EX
@@ -128,9 +137,22 @@ tc filter add dev eth3 parent 1: protocol ip prio 10 \\
.EE
.RE
-As mentioned above, the swap action will occur after any
-.B " smac/dmac "
-substitutions are executed, if they are present.
+Finally, to mark the CE codepoint in the IP header for ECN Capable Transport (ECT) packets:
+
+.RS
+.EX
+tc filter add dev eth0 parent 1: protocol ip prio 10 \\
+ u32 match ip protocol 1 0xff flowid 1:2 \\
+ action skbmod \\
+ ecn
+.EE
+.RE
+
+Only one of
+.BR set ", " swap " and " ecn
+shall be used in a single command.
+Trying to use more than one of them in a single command is considered undefined behavior; pipe
+multiple commands together instead.
.SH SEE ALSO
.BR tc (8),
@@ -28,10 +28,9 @@
static void skbmod_explain(void)
{
fprintf(stderr,
- "Usage:... skbmod {[set <SETTABLE>] [swap <SWAPABLE>]} [CONTROL] [index INDEX]\n"
+ "Usage:... skbmod { set <SETTABLE> | swap <SWAPPABLE> | ecn } [CONTROL] [index INDEX]\n"
"where SETTABLE is: [dmac DMAC] [smac SMAC] [etype ETYPE]\n"
- "where SWAPABLE is: \"mac\" to swap mac addresses\n"
- "note: \"swap mac\" is done after any outstanding D/SMAC change\n"
+ "where SWAPPABLE is: \"mac\" to swap mac addresses\n"
"\tDMAC := 6 byte Destination MAC address\n"
"\tSMAC := optional 6 byte Source MAC address\n"
"\tETYPE := optional 16 bit ethertype\n"
@@ -112,6 +111,9 @@ static int parse_skbmod(struct action_util *a, int *argc_p, char ***argv_p,
p.flags |= SKBMOD_F_SMAC;
fprintf(stderr, "src MAC address <%s>\n", saddr);
ok += 1;
+ } else if (matches(*argv, "ecn") == 0) {
+ p.flags |= SKBMOD_F_ECN;
+ ok += 1;
} else if (matches(*argv, "help") == 0) {
skbmod_usage();
} else {
@@ -212,6 +214,9 @@ static int print_skbmod(struct action_util *au, FILE *f, struct rtattr *arg)
if (p->flags & SKBMOD_F_SWAPMAC)
fprintf(f, "swap mac ");
+ if (p->flags & SKBMOD_F_ECN)
+ fprintf(f, "ecn ");
+
fprintf(f, "\n\t index %u ref %d bind %d", p->index, p->refcnt,
p->bindcnt);
if (show_stats) {