You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/target/linux
Kevin Darbyshire-Bryant b8a72dfd28 kernel: backport act_ctinfo
ctinfo is a new tc filter action module.  It is designed to restore
information contained in firewall conntrack marks to other packet fields
and is typically used on packet ingress paths.  At present it has two
independent sub-functions or operating modes, DSCP restoration mode &
skb mark restoration mode.

The DSCP restore mode:

This mode copies DSCP values that have been placed in the firewall
conntrack mark back into the IPv4/v6 diffserv fields of relevant
packets.

The DSCP restoration is intended for use and has been found useful for
restoring ingress classifications based on egress classifications across
links that bleach or otherwise change DSCP, typically home ISP Internet
links.  Restoring DSCP on ingress on the WAN link allows qdiscs such as
but by no means limited to CAKE to shape inbound packets according to
policies that are easier to set & mark on egress.

Ingress classification is traditionally a challenging task since
iptables rules haven't yet run and tc filter/eBPF programs are pre-NAT
lookups, hence are unable to see internal IPv4 addresses as used on the
typical home masquerading gateway.  Thus marking the connection in some
manner on egress for later restoration of classification on ingress is
easier to implement.

Parameters related to DSCP restore mode:

dscpmask - a 32 bit mask of 6 contiguous bits and indicate bits of the
conntrack mark field contain the DSCP value to be restored.

statemask - a 32 bit mask of (usually) 1 bit length, outside the area
specified by dscpmask.  This represents a conditional operation flag
whereby the DSCP is only restored if the flag is set.  This is useful to
implement a 'one shot' iptables based classification where the
'complicated' iptables rules are only run once to classify the
connection on initial (egress) packet and subsequent packets are all
marked/restored with the same DSCP.  A mask of zero disables the
conditional behaviour ie. the conntrack mark DSCP bits are always
restored to the ip diffserv field (assuming the conntrack entry is found
& the skb is an ipv4/ipv6 type)

e.g. dscpmask 0xfc000000 statemask 0x01000000

|----0xFC----conntrack mark----000000---|
| Bits 31-26 | bit 25 | bit24 |~~~ Bit 0|
| DSCP       | unused | flag  |unused   |
|-----------------------0x01---000000---|
      |                   |
      |                   |
      ---|             Conditional flag
         v             only restore if set
|-ip diffserv-|
| 6 bits      |
|-------------|

The skb mark restore mode (cpmark):

This mode copies the firewall conntrack mark to the skb's mark field.
It is completely the functional equivalent of the existing act_connmark
action with the additional feature of being able to apply a mask to the
restored value.

Parameters related to skb mark restore mode:

mask - a 32 bit mask applied to the firewall conntrack mark to mask out
bits unwanted for restoration.  This can be useful where the conntrack
mark is being used for different purposes by different applications.  If
not specified and by default the whole mark field is copied (i.e.
default mask of 0xffffffff)

e.g. mask 0x00ffffff to mask out the top 8 bits being used by the
aforementioned DSCP restore mode.

|----0x00----conntrack mark----ffffff---|
| Bits 31-24 |                          |
| DSCP & flag|      some value here     |
|---------------------------------------|
			|
			|
			v
|------------skb mark-------------------|
|            |                          |
|  zeroed    |                          |
|---------------------------------------|

Overall parameters:

zone - conntrack zone

control - action related control (reclassify | pipe | drop | continue |
ok | goto chain <CHAIN_INDEX>)

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Make suitable adjustments for backporting to 4.14 & 4.19
and add to SCHED_MODULES_FILTER

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
5 years ago
..
apm821xx apm821xx: backport accepted linux-crypto patches to 4.19 5 years ago
ar7 kernel: bump 4.9 to 4.9.153 5 years ago
ar71xx ar71xx: ag71xx: update ethtool support 5 years ago
arc770 treewide: use wpad-basic for not small flash targets 6 years ago
archs38 treewide: use wpad-basic for not small flash targets 6 years ago
armvirt kernel: Remove CONFIG_COMPAT 5 years ago
at91 at91:renaming subtraget legacy to sam9x 5 years ago
ath25 kernel: bump 4.14 to 4.14.79 6 years ago
ath79 ath79: add support for 8devices Carambola2 development board 5 years ago
bcm53xx build: add a config option for enabling a testing version of the target kernel 5 years ago
brcm47xx build: add a config option for enabling a testing version of the target kernel 5 years ago
brcm63xx brcm63xx: DVA-G3810BN/TL: Fix the WAN ethernet port 5 years ago
brcm2708 kernel: bump 4.14 to 4.14.123 5 years ago
cns3xxx kernel: bump 4.19 to 4.19.47 5 years ago
gemini gemini: Activate Realtek and vitesse DSA driver again 5 years ago
generic kernel: backport act_ctinfo 5 years ago
imx6 imx6: apalis: fix config survival after sysupgrade -n 5 years ago
ipq40xx ipq40xx: Add support for Linksys EA8300 (Dallas) 5 years ago
ipq806x kernel: bump 4.14 to 4.14.120 5 years ago
ixp4xx kernel: bump 4.9 to 4.9.160 5 years ago
kirkwood mtd: base-files: Unify dual-firmware devices (Linksys) 5 years ago
lantiq kernel: bump 4.14 to 4.14.122 5 years ago
layerscape layerscape: update patches-4.14 to LSDK 19.03 5 years ago
malta malta: Deactivate MIPS O32 and N32 support 5 years ago
mediatek kernel: Remove CONFIG_COMPAT 5 years ago
mpc85xx build: add a config option for enabling a testing version of the target kernel 5 years ago
mvebu kernel: bump 4.14 to 4.14.120 5 years ago
mxs mxs: disable unused serial drivers 5 years ago
octeon octeon: Deactivate MIPS O32 and N32 support 5 years ago
octeontx kernel: Remove CONFIG_COMPAT 5 years ago
omap kernel: Deactivate CONFIG_BINFMT_MISC 5 years ago
orion treewide: use wpad-basic for not small flash targets 6 years ago
oxnas kernel: bump 4.14 to 4.14.120 5 years ago
pistachio kernel: bump 4.14 to 4.14.91 6 years ago
ramips ramips: add support for TOTOLINK LR1200 5 years ago
rb532 kernel: bump 4.14 to 4.14.86 6 years ago
samsung kernel: Do not set CONFIG_DEVMEM or CONFIG_DEVKMEM 5 years ago
sunxi kernel: bump 4.14 to 4.14.120 5 years ago
tegra tegra: add vendor string to device name 5 years ago
uml kernel: Deactivate CONFIG_BINFMT_MISC 5 years ago
x86 Revert "base-files: add console to inittab" 5 years ago
zynq zynq: make title consistent for all devices 5 years ago
Makefile