.IR CMD_SPEC " := {"
.BR clear " | " invert " | " set
.IR VAL " | "
+.BR add
+.IR VAL " | "
.BR preserve " } [ " retain
.IR RVAL " ]"
.B ex
Use extended pedit.
.I EXTENDED_LAYERED_OP
-is allowed only in this mode.
+and the add
+.I CMD_SPEC
+are allowed only in this mode.
.TP
.BI offset " OFFSET " "\fR{ \fBu32 \fR| \fBu16 \fR| \fBu8 \fR}"
Specify the offset at which to change data.
or the size of the addressed header field in
.IR LAYERED_OP .
.TP
+.BI add " VAL"
+Add the addressed data by a specific value. The size of
+.I VAL
+is defined by the size of the addressed header field in
+.IR EXTENDED_LAYERED_OP .
+This operation is supported only for extended layered op.
+.TP
.B preserve
Keep the addressed data as is.
.TP
"\t\tATC:= at <atval> offmask <maskval> shift <shiftval>\n"
"\t\tNOTE: offval is byte offset, must be multiple of 4\n"
"\t\tNOTE: maskval is a 32 bit hex number\n \t\tNOTE: shiftval is a shift value\n"
- "\t\tCMD:= clear | invert | set <setval>| retain\n"
+ "\t\tCMD:= clear | invert | set <setval>| add <addval> | retain\n"
"\t<LAYERED>:= ip <ipdata> | ip6 <ip6data>\n"
" \t\t| udp <udpdata> | tcp <tcpdata> | icmp <icmpdata>\n"
"\tCONTROL:= reclassify | pipe | drop | continue | pass\n"
if (matches(*argv, "invert") == 0) {
val = mask = o;
- } else if (matches(*argv, "set") == 0) {
+ } else if (matches(*argv, "set") == 0 ||
+ matches(*argv, "add") == 0) {
+ if (matches(*argv, "add") == 0)
+ tkey->cmd = TCA_PEDIT_KEY_EX_CMD_ADD;
+
+ if (!sel->extended && tkey->cmd) {
+ fprintf(stderr, "Non extended mode. only 'set' command is supported\n");
+ return -1;
+ }
+
NEXT_ARG();
if (parse_val(&argc, &argv, &val, type))
return -1;
for (i = 0; i < sel->nkeys; i++, key++) {
enum pedit_header_type htype =
TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK;
+ enum pedit_cmd cmd = TCA_PEDIT_KEY_EX_CMD_SET;
if (keys_ex) {
htype = key_ex->htype;
+ cmd = key_ex->cmd;
key_ex++;
}
print_pedit_location(f, htype, key->off);
- fprintf(f, ": val %08x mask %08x",
+ fprintf(f, ": %s %08x mask %08x",
+ cmd ? "add" : "val",
(unsigned int)ntohl(key->val),
(unsigned int)ntohl(key->mask));
}