Blame man/man8/tc-skbmod.8

Packit Service 3880ab
.TH "skbmod action in tc" 8 "21 Sep 2016" "iproute2" "Linux"
Packit Service 3880ab
Packit Service 3880ab
.SH NAME
Packit Service 3880ab
skbmod - user-friendly packet editor action
Packit Service 3880ab
.SH SYNOPSIS
Packit Service 3880ab
.in +8
Packit Service 3880ab
.ti -8
Packit Service 3880ab
.BR tc " ... " "action skbmod " "{ [ " "set "
Packit Service 3880ab
.IR SETTABLE " ] [ "
Packit Service 3880ab
.BI swap " SWAPPABLE"
Packit Service 3880ab
.RI " ] [ " CONTROL " ] [ "
Packit Service 3880ab
.BI index " INDEX "
Packit Service 3880ab
] }
Packit Service 3880ab
Packit Service 3880ab
.ti -8
Packit Service 3880ab
.IR SETTABLE " := "
Packit Service 3880ab
.RB " [ " dmac
Packit Service 3880ab
.IR DMAC " ] "
Packit Service 3880ab
.RB " [ " smac
Packit Service 3880ab
.IR SMAC " ] "
Packit Service 3880ab
.RB " [ " etype
Packit Service 3880ab
.IR ETYPE " ] "
Packit Service 3880ab
Packit Service 3880ab
.ti -8
Packit Service 3880ab
.IR SWAPPABLE " := "
Packit Service 3880ab
.B mac
Packit Service 3880ab
.ti -8
Packit Service 3880ab
.IR CONTROL " := {"
Packit Service 3880ab
.BR reclassify " | " pipe " | " drop " | " shot " | " continue " | " pass " }"
Packit Service 3880ab
.SH DESCRIPTION
Packit Service 3880ab
The
Packit Service 3880ab
.B skbmod
Packit Service 3880ab
action is intended as a usability upgrade to the existing
Packit Service 3880ab
.B pedit
Packit Service 3880ab
action. Instead of having to manually edit 8-, 16-, or 32-bit chunks of an
Packit Service 3880ab
ethernet header,
Packit Service 3880ab
.B skbmod
Packit Service 3880ab
allows complete substitution of supported elements.
Packit Service 3880ab
.SH OPTIONS
Packit Service 3880ab
.TP
Packit Service 3880ab
.BI dmac " DMAC"
Packit Service 3880ab
Change the destination mac to the specified address.
Packit Service 3880ab
.TP
Packit Service 3880ab
.BI smac " SMAC"
Packit Service 3880ab
Change the source mac to the specified address.
Packit Service 3880ab
.TP
Packit Service 3880ab
.BI etype " ETYPE"
Packit Service 3880ab
Change the ethertype to the specified value.
Packit Service 3880ab
.TP
Packit Service 3880ab
.BI mac
Packit Service 3880ab
Used to swap mac addresses. The
Packit Service 3880ab
.B swap mac
Packit Service 3880ab
directive is performed
Packit Service 3880ab
after any outstanding D/SMAC changes.
Packit Service 3880ab
.TP
Packit Service 3880ab
.I CONTROL
Packit Service 3880ab
The following keywords allow to control how the tree of qdisc, classes,
Packit Service 3880ab
filters and actions is further traversed after this action.
Packit Service 3880ab
.RS
Packit Service 3880ab
.TP
Packit Service 3880ab
.B reclassify
Packit Service 3880ab
Restart with the first filter in the current list.
Packit Service 3880ab
.TP
Packit Service 3880ab
.B pipe
Packit Service 3880ab
Continue with the next action attached to the same filter.
Packit Service 3880ab
.TP
Packit Service 3880ab
.B drop
Packit Service 3880ab
.TQ
Packit Service 3880ab
.B shot
Packit Service 3880ab
Drop the packet.
Packit Service 3880ab
.TP
Packit Service 3880ab
.B continue
Packit Service 3880ab
Continue classification with the next filter in line.
Packit Service 3880ab
.TP
Packit Service 3880ab
.B pass
Packit Service 3880ab
Finish classification process and return to calling qdisc for further packet
Packit Service 3880ab
processing. This is the default.
Packit Service 3880ab
.RE
Packit Service 3880ab
.SH EXAMPLES
Packit Service 3880ab
To start, observe the following filter with a pedit action:
Packit Service 3880ab
Packit Service 3880ab
.RS
Packit Service 3880ab
.EX
Packit Service 3880ab
tc filter add dev eth1 parent 1: protocol ip prio 10 \\
Packit Service 3880ab
	u32 match ip protocol 1 0xff flowid 1:2 \\
Packit Service 3880ab
	action pedit munge offset -14 u8 set 0x02 \\
Packit Service 3880ab
	munge offset -13 u8 set 0x15 \\
Packit Service 3880ab
	munge offset -12 u8 set 0x15 \\
Packit Service 3880ab
	munge offset -11 u8 set 0x15 \\
Packit Service 3880ab
	munge offset -10 u16 set 0x1515 \\
Packit Service 3880ab
	pipe
Packit Service 3880ab
.EE
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
Using the skbmod action, this command can be simplified to:
Packit Service 3880ab
Packit Service 3880ab
.RS
Packit Service 3880ab
.EX
Packit Service 3880ab
tc filter add dev eth1 parent 1: protocol ip prio 10 \\
Packit Service 3880ab
	u32 match ip protocol 1 0xff flowid 1:2 \\
Packit Service 3880ab
	action skbmod set dmac 02:15:15:15:15:15 \\
Packit Service 3880ab
	pipe
Packit Service 3880ab
.EE
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
Complexity will increase if source mac and ethertype are also being edited
Packit Service 3880ab
as part of the action. If all three fields are to be changed with skbmod:
Packit Service 3880ab
Packit Service 3880ab
.RS
Packit Service 3880ab
.EX
Packit Service 3880ab
tc filter add dev eth5 parent 1: protocol ip prio 10 \\
Packit Service 3880ab
	u32 match ip protocol 1 0xff flowid 1:2 \\
Packit Service 3880ab
	action skbmod \\
Packit Service 3880ab
	set etype 0xBEEF \\
Packit Service 3880ab
	set dmac 02:12:13:14:15:16 \\
Packit Service 3880ab
	set smac 02:22:23:24:25:26
Packit Service 3880ab
.EE
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
Finally, swap the destination and source mac addresses in the header:
Packit Service 3880ab
Packit Service 3880ab
.RS
Packit Service 3880ab
.EX
Packit Service 3880ab
tc filter add dev eth3 parent 1: protocol ip prio 10 \\
Packit Service 3880ab
	u32 match ip protocol 1 0xff flowid 1:2 \\
Packit Service 3880ab
	action skbmod \\
Packit Service 3880ab
	swap mac
Packit Service 3880ab
.EE
Packit Service 3880ab
.RE
Packit Service 3880ab
Packit Service 3880ab
As mentioned above, the swap action will occur after any
Packit Service 3880ab
.B " smac/dmac "
Packit Service 3880ab
substitutions are executed, if they are present.
Packit Service 3880ab
Packit Service 3880ab
.SH SEE ALSO
Packit Service 3880ab
.BR tc (8),
Packit Service 3880ab
.BR tc-u32 (8),
Packit Service 3880ab
.BR tc-pedit (8)