{"id":3059,"date":"2022-12-20T16:43:23","date_gmt":"2022-12-20T19:43:23","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/skbmod-action-in-tc-man8\/"},"modified":"2022-12-20T16:43:23","modified_gmt":"2022-12-20T19:43:23","slug":"skbmod-action-in-tc-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/skbmod-action-in-tc-man8\/","title":{"rendered":"skbmod action in tc (man8)"},"content":{"rendered":"<h1 align=\"center\">skbmod action in tc<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">skbmod &#8211; user-friendly packet editor action<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:23%; margin-top: 1em\"><b>tc<\/b> &#8230; <b>action skbmod<\/b> { <b>set<\/b> <i>SETTABLE<\/i> | <b>swap<\/b> <i>SWAPPABLE<\/i> | <b>ecn<\/b> } [ <i>CONTROL<\/i> ] [ <b>index<\/b> <i>INDEX<\/i> ]<\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><i>SETTABLE<\/i> := [ <b>dmac<\/b> <i>DMAC<\/i> ] [ <b>smac<\/b> <i>SMAC<\/i> ] [ <b>etype<\/b> <i>ETYPE<\/i> ]<\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><i>SWAPPABLE<\/i> := <b>mac<\/b><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><i>CONTROL<\/i> := { <b>reclassify<\/b> | <b>pipe<\/b> | <b>drop<\/b> | <b>shot<\/b> | <b>continue<\/b> | <b>pass<\/b> }<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>skbmod<\/b> action is intended as a usability upgrade to the existing <b>pedit<\/b> action. Instead of having to manually edit 8-, 16-, or 32-bit chunks of an ethernet header, <b>skbmod<\/b> allows complete substitution of supported elements. Action must be one of <b>set<\/b>, <b>swap<\/b> and <b>ecn<\/b>. <b>set<\/b> and <b>swap<\/b> only affect Ethernet packets, while <b>ecn<\/b> only affects IP packets.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>dmac<\/b> <i>DMAC<\/i><\/p>\n<p style=\"margin-left:22%;\">Change the destination mac to the specified address.<\/p>\n<p style=\"margin-left:11%;\"><b>smac<\/b> <i>SMAC<\/i><\/p>\n<p style=\"margin-left:22%;\">Change the source mac to the specified address.<\/p>\n<p style=\"margin-left:11%;\"><b>etype<\/b> <i>ETYPE<\/i><\/p>\n<p style=\"margin-left:22%;\">Change the ethertype to the specified value.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p><b>mac<\/b><\/p>\n<\/td>\n<td width=\"7%\"><\/td>\n<td width=\"78%\">\n<p>Used to swap mac addresses.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"4%\">\n<p><b>ecn<\/b><\/p>\n<\/td>\n<td width=\"7%\"><\/td>\n<td width=\"78%\">\n<p>Used to mark ECN Capable Transport (ECT) IP packets as Congestion Encountered (CE). Does not affect Non ECN-Capable Transport (Non-ECT) packets.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%;\"><i>CONTROL<\/i><\/p>\n<p style=\"margin-left:22%;\">The following keywords allow to control how the tree of qdisc, classes, filters and actions is further traversed after this action. <b><br \/> reclassify<\/b><\/p>\n<p style=\"margin-left:32%;\">Restart with the first filter in the current list.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>pipe<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>Continue with the next action attached to the same filter.<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>drop<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>shot<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>Drop the packet.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:22%;\"><b>continue<\/b><\/p>\n<p style=\"margin-left:32%;\">Continue classification with the next filter in line.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"22%\"><\/td>\n<td width=\"6%\">\n<p><b>pass<\/b><\/p>\n<\/td>\n<td width=\"4%\"><\/td>\n<td width=\"68%\">\n<p>Finish classification process and return to calling qdisc for further packet processing. This is the default.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">To start, observe the following filter with a pedit action:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">tc filter add dev eth1 parent 1: protocol ip prio 10 <\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>u32 match ip protocol 1 0xff flowid 1:2 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>action pedit munge offset -14 u8 set 0x02 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>munge offset -13 u8 set 0x15 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>munge offset -12 u8 set 0x15 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>munge offset -11 u8 set 0x15 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>munge offset -10 u16 set 0x1515 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>pipe<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">Using the skbmod action, this command can be simplified to:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">tc filter add dev eth1 parent 1: protocol ip prio 10 <\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>u32 match ip protocol 1 0xff flowid 1:2 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>action skbmod set dmac 02:15:15:15:15:15 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>pipe<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">Complexity will increase if source mac and ethertype are also being edited as part of the action. If all three fields are to be changed with skbmod:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">tc filter add dev eth5 parent 1: protocol ip prio 10 <\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>u32 match ip protocol 1 0xff flowid 1:2 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>action skbmod <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>set etype 0xBEEF <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>set dmac 02:12:13:14:15:16 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>set smac 02:22:23:24:25:26<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">To swap the destination and source mac addresses in the Ethernet header:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">tc filter add dev eth3 parent 1: protocol ip prio 10 <\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>u32 match ip protocol 1 0xff flowid 1:2 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>action skbmod <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>swap mac<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">Finally, to mark the CE codepoint in the IP header for ECN Capable Transport (ECT) packets:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">tc filter add dev eth0 parent 1: protocol ip prio 10 <\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>u32 match ip protocol 1 0xff flowid 1:2 <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>action skbmod <\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"92%\">\n<p>ecn<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">Only one of <b>set<\/b>, <b>swap<\/b> and <b>ecn<\/b> 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.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>tc<\/b>(8), <b>tc-u32<\/b>(8), <b>tc-pedit<\/b>(8)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  skbmod &#8211; user-friendly packet editor action <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,209],"class_list":["post-3059","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-tc-skbmod"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3059"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3059\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3059"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}