mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-24 00:20:54 +07:00
86da71b573
This action is intended to be an upgrade from a usability perspective from pedit (as well as operational debugability). Compare this: sudo tc filter add dev $ETH parent 1: protocol ip prio 10 \ u32 match ip protocol 1 0xff flowid 1:2 \ action pedit munge offset -14 u8 set 0x02 \ munge offset -13 u8 set 0x15 \ munge offset -12 u8 set 0x15 \ munge offset -11 u8 set 0x15 \ munge offset -10 u16 set 0x1515 \ pipe to: sudo tc filter add dev $ETH parent 1: protocol ip prio 10 \ u32 match ip protocol 1 0xff flowid 1:2 \ action skbmod dmac 02:15:15:15:15:15 Also try to do a MAC address swap with pedit or worse try to debug a policy with destination mac, source mac and etherype. Then make few rules out of those and you'll get my point. In the future common use cases on pedit can be migrated to this action (as an example different fields in ip v4/6, transports like tcp/udp/sctp etc). For this first cut, this allows modifying basic ethernet header. The most important ethernet use case at the moment is when redirecting or mirroring packets to a remote machine. The dst mac address needs a re-write so that it doesnt get dropped or confuse an interconnecting (learning) switch or dropped by a target machine (which looks at the dst mac). And at times when flipping back the packet a swap of the MAC addresses is needed. Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
40 lines
778 B
C
40 lines
778 B
C
/*
|
|
* Copyright (c) 2016, Jamal Hadi Salim
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
#ifndef __LINUX_TC_SKBMOD_H
|
|
#define __LINUX_TC_SKBMOD_H
|
|
|
|
#include <linux/pkt_cls.h>
|
|
|
|
#define TCA_ACT_SKBMOD 15
|
|
|
|
#define SKBMOD_F_DMAC 0x1
|
|
#define SKBMOD_F_SMAC 0x2
|
|
#define SKBMOD_F_ETYPE 0x4
|
|
#define SKBMOD_F_SWAPMAC 0x8
|
|
|
|
struct tc_skbmod {
|
|
tc_gen;
|
|
__u64 flags;
|
|
};
|
|
|
|
enum {
|
|
TCA_SKBMOD_UNSPEC,
|
|
TCA_SKBMOD_TM,
|
|
TCA_SKBMOD_PARMS,
|
|
TCA_SKBMOD_DMAC,
|
|
TCA_SKBMOD_SMAC,
|
|
TCA_SKBMOD_ETYPE,
|
|
TCA_SKBMOD_PAD,
|
|
__TCA_SKBMOD_MAX
|
|
};
|
|
#define TCA_SKBMOD_MAX (__TCA_SKBMOD_MAX - 1)
|
|
|
|
#endif
|