twx-linux/include/uapi/linux
Mathieu Xhonneux fe94cc290f bpf: Add IPv6 Segment Routing helpers
The BPF seg6local hook should be powerful enough to enable users to
implement most of the use-cases one could think of. After some thinking,
we figured out that the following actions should be possible on a SRv6
packet, requiring 3 specific helpers :
    - bpf_lwt_seg6_store_bytes: Modify non-sensitive fields of the SRH
    - bpf_lwt_seg6_adjust_srh: Allow to grow or shrink a SRH
                               (to add/delete TLVs)
    - bpf_lwt_seg6_action: Apply some SRv6 network programming actions
                           (specifically End.X, End.T, End.B6 and
                            End.B6.Encap)

The specifications of these helpers are provided in the patch (see
include/uapi/linux/bpf.h).

The non-sensitive fields of the SRH are the following : flags, tag and
TLVs. The other fields can not be modified, to maintain the SRH
integrity. Flags, tag and TLVs can easily be modified as their validity
can be checked afterwards via seg6_validate_srh. It is not allowed to
modify the segments directly. If one wants to add segments on the path,
he should stack a new SRH using the End.B6 action via
bpf_lwt_seg6_action.

Growing, shrinking or editing TLVs via the helpers will flag the SRH as
invalid, and it will have to be re-validated before re-entering the IPv6
layer. This flag is stored in a per-CPU buffer, along with the current
header length in bytes.

Storing the SRH len in bytes in the control block is mandatory when using
bpf_lwt_seg6_adjust_srh. The Header Ext. Length field contains the SRH
len rounded to 8 bytes (a padding TLV can be inserted to ensure the 8-bytes
boundary). When adding/deleting TLVs within the BPF program, the SRH may
temporary be in an invalid state where its length cannot be rounded to 8
bytes without remainder, hence the need to store the length in bytes
separately. The caller of the BPF program can then ensure that the SRH's
final length is valid using this value. Again, a final SRH modified by a
BPF program which doesn’t respect the 8-bytes boundary will be discarded
as it will be considered as invalid.

Finally, a fourth helper is provided, bpf_lwt_push_encap, which is
available from the LWT BPF IN hook, but not from the seg6local BPF one.
This helper allows to encapsulate a Segment Routing Header (either with
a new outer IPv6 header, or by inlining it directly in the existing IPv6
header) into a non-SRv6 packet. This helper is required if we want to
offer the possibility to dynamically encapsulate a SRH for non-SRv6 packet,
as the BPF seg6local hook only works on traffic already containing a SRH.
This is the BPF equivalent of the seg6 LWT infrastructure, which achieves
the same purpose but with a static SRH per route.

These helpers require CONFIG_IPV6=y (and not =m).

Signed-off-by: Mathieu Xhonneux <m.xhonneux@gmail.com>
Acked-by: David Lebrun <dlebrun@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-05-24 11:57:35 +02:00
..
android
byteorder
caif
can
cifs
dvb media: dvb: add continuity error indicators for memory mapped buffers 2018-02-23 05:28:41 -05:00
genwqe
hdlc
hsi
iio
isdn
mmc
netfilter netfilter: ctnetlink: export nf_conntrack_max 2018-05-07 00:04:02 +02:00
netfilter_arp
netfilter_bridge netfilter: ebtables: add ebt_get_target and ebt_get_target_c 2018-04-24 10:29:18 +02:00
netfilter_ipv4
netfilter_ipv6 netfilter: ip6t_srh: extend SRH matching for previous, next and last SID 2018-05-06 23:33:03 +02:00
nfsd
raid
sched
spi
sunrpc
tc_act
tc_ematch net: sched: add em_ipt ematch for calling xtables matches 2018-02-21 13:15:33 -05:00
usb ALSA: usb: initial USB Audio Device Class 3.0 support 2018-03-21 11:46:33 +01:00
wimax
a.out.h
acct.h
adb.h
adfs_fs.h
affs_hardblocks.h
agpgart.h
aio_abi.h
am437x-vpfe.h
apm_bios.h
arcfb.h
arm_sdei.h
aspeed-lpc-ctrl.h
atalk.h
atm_eni.h
atm_he.h
atm_idt77105.h
atm_nicstar.h
atm_tcp.h
atm_zatm.h
atm.h
atmapi.h
atmarp.h
atmbr2684.h
atmclip.h
atmdev.h
atmioc.h
atmlec.h
atmmpc.h
atmppp.h
atmsap.h
atmsvc.h
audit.h
auto_dev-ioctl.h
auto_fs4.h
auto_fs.h
auxvec.h
ax25.h
b1lli.h
batadv_packet.h batman-adv: always assume 2-byte packet alignment 2018-02-27 13:02:54 +01:00
batman_adv.h batman-adv: add multicast flags netlink support 2018-03-14 10:15:34 +01:00
baycom.h
bcache.h
bcm933xx_hcs.h
bfs_fs.h
binfmts.h
blkpg.h
blktrace_api.h blktrace: fix comment in blktrace_api.h 2018-03-30 14:16:24 -06:00
blkzoned.h
bpf_common.h
bpf_perf_event.h bpf: add support to read sample address in bpf program 2018-03-08 02:22:34 +01:00
bpf.h bpf: Add IPv6 Segment Routing helpers 2018-05-24 11:57:35 +02:00
bpqether.h
bsg.h
bt-bmc.h
btf.h bpf: btf: Remove unused bits from uapi/linux/btf.h 2018-05-23 12:03:32 +02:00
btrfs_tree.h
btrfs.h
can.h
capability.h
capi.h
cciss_defs.h
cciss_ioctl.h
cdrom.h
cec-funcs.h media: include/(uapi/)media: add SPDX license info 2018-02-14 13:23:51 -05:00
cec.h media: include/(uapi/)media: add SPDX license info 2018-02-14 13:23:51 -05:00
cgroupstats.h
chio.h
cm4000_cs.h
cn_proc.h connector: add parent pid and tgid to coredump and exit events 2018-05-01 14:25:37 -04:00
coda_psdev.h
coda.h
coff.h
connector.h
const.h linux/const.h: refactor _BITUL and _BITULL a bit 2018-04-11 10:28:38 -07:00
coresight-stm.h
cramfs_fs.h
cryptouser.h
cuda.h
cyclades.h
cycx_cfm.h
dcbnl.h
dccp.h
devlink.h
dlm_device.h
dlm_netlink.h
dlm_plock.h
dlm.h
dlmconstants.h
dm-ioctl.h dm: hold DM table for duration of ioctl rather than use blkdev_get 2018-04-04 12:12:38 -04:00
dm-log-userspace.h
dma-buf.h
dn.h
dqblk_xfs.h
edd.h
efs_fs_sb.h
elf-em.h
elf-fdpic.h
elf.h vmcore: add API to collect hardware dump in second kernel 2018-05-14 13:46:04 -04:00
elfcore.h
errno.h
errqueue.h rds: deliver zerocopy completion notification with data 2018-02-27 14:19:11 -05:00
erspan.h
ethtool.h ethtool: Add support for configuring PFC stall prevention in ethtool 2018-03-26 13:46:46 -07:00
eventpoll.h
fadvise.h
falloc.h
fanotify.h
fb.h
fcntl.h
fd.h
fdreg.h
fib_rules.h net: fib_rules: support for match on ip_proto, sport and dport 2018-02-28 22:44:43 -05:00
fiemap.h
filter.h
firewire-cdev.h
firewire-constants.h
flat.h
fou.h
fs.h
fsl_hypervisor.h
fsmap.h
fuse.h
futex.h
gameport.h
gen_stats.h
genetlink.h
gfs2_ondisk.h
gigaset_dev.h
gpio.h
gsmmux.h
gtp.h
hash_info.h
hdlc.h
hdlcdrv.h
hdreg.h
hid.h
hiddev.h
hidraw.h
hpet.h
hsr_netlink.h
hw_breakpoint.h
hyperv.h
hysdn_if.h
i2c-dev.h
i2c.h
i2o-dev.h
i8k.h
icmp.h
icmpv6.h
if_addr.h
if_addrlabel.h
if_alg.h
if_arcnet.h
if_arp.h
if_bonding.h
if_bridge.h
if_cablemodem.h
if_eql.h
if_ether.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-03-23 11:31:58 -04:00
if_fc.h
if_fddi.h
if_frad.h
if_hippi.h
if_infiniband.h uapi: Fix SPDX tags for files referring to the 'OpenIB.org' license 2018-04-23 11:10:33 -04:00
if_link.h vxlan: add ttl inherit support 2018-04-17 13:53:13 -04:00
if_ltalk.h
if_macsec.h
if_packet.h
if_phonet.h
if_plip.h
if_ppp.h
if_pppol2tp.h
if_pppox.h
if_slip.h
if_team.h
if_tun.h
if_tunnel.h
if_vlan.h
if_x25.h
if_xdp.h xsk: remove explicit ring structure from uapi 2018-05-22 10:25:06 +02:00
if.h
ife.h
igmp.h
ila.h
in6.h
in_route.h
in.h
inet_diag.h
inotify.h inotify: Extend ioctl to allow to request id of new watch descriptor 2018-02-14 11:16:28 +01:00
input-event-codes.h
input.h
ioctl.h
ip6_tunnel.h
ip_vs.h
ip.h
ipc.h
ipmi_bmc.h ipmi: kcs_bmc: coding-style fixes and use new poll type 2018-02-26 09:49:21 -06:00
ipmi_msgdefs.h ipmi: Add or fix SPDX-License-Identifier in all files 2018-02-27 07:42:51 -06:00
ipmi.h ipmi: Add or fix SPDX-License-Identifier in all files 2018-02-27 07:42:51 -06:00
ipsec.h
ipv6_route.h
ipv6.h
ipx.h
irqnr.h
isdn_divertif.h
isdn_ppp.h
isdn.h
isdnif.h
iso_fs.h
ivtv.h
ivtvfb.h
jffs2.h
joystick.h
Kbuild
kcm.h
kcmp.h
kcov.h
kd.h
kdev_t.h
kernel-page-flags.h
kernel.h
kernelcapi.h
kexec.h
keyboard.h
keyctl.h
kfd_ioctl.h drm/amdkfd: Add ioctls for GPUVM memory management 2018-03-15 17:27:51 -04:00
kvm_para.h
kvm.h x86/headers/UAPI: Move DISABLE_EXITS KVM capability bits to the UAPI 2018-04-27 18:37:17 +02:00
l2tp.h
libc-compat.h uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define 2018-02-13 11:23:24 -05:00
lightnvm.h
limits.h
lirc.h media updates for v4.17-rc1 2018-04-03 17:16:59 -07:00
llc.h
loop.h
lp.h
lwtunnel.h
magic.h
major.h
map_to_7segment.h
matroxfb.h
max2175.h
mdio.h
media-bus-format.h
media.h media: media.h: reorganize header to make it easier to understand 2018-02-26 10:14:46 -05:00
mei.h
membarrier.h
memfd.h
mempolicy.h
meye.h
mic_common.h
mic_ioctl.h
mii.h
minix_fs.h
mman.h
mmtimer.h
module.h
mpls_iptunnel.h
mpls.h
mqueue.h
mroute6.h
mroute.h
msdos_fs.h block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into <linux/blkdev.h> 2018-03-17 14:45:23 -06:00
msg.h ipc/msg: introduce msgctl(MSG_STAT_ANY) 2018-04-11 10:28:37 -07:00
mtio.h
n_r3964.h
nbd-netlink.h
nbd.h
ncp_fs.h
ncp_mount.h
ncp_no.h
ncp.h
ncsi.h net/ncsi: Add generic netlink family 2018-03-05 10:43:37 -05:00
ndctl.h
neighbour.h
net_dropmon.h
net_namespace.h
net_tstamp.h
net.h
netconf.h
netdevice.h
netfilter_arp.h
netfilter_bridge.h
netfilter_decnet.h
netfilter_ipv4.h
netfilter_ipv6.h
netfilter.h
netlink_diag.h
netlink.h
netrom.h
nfc.h
nfs2.h
nfs3.h
nfs4_mount.h
nfs4.h
nfs_fs.h
nfs_idmap.h
nfs_mount.h
nfs.h
nfsacl.h
nilfs2_api.h
nilfs2_ondisk.h
nl80211.h cfg80211: limit wiphy names to 128 bytes 2018-04-19 15:46:34 +02:00
nsfs.h
nubus.h
nvme_ioctl.h
nvram.h
omap3isp.h
omapfb.h
oom.h
openvswitch.h
packet_diag.h
param.h
parport.h
patchkey.h
pci_regs.h PCI: Add two more values for PCIe Max_Read_Request_Size 2018-04-16 18:55:04 -04:00
pci.h
pcitest.h
perf_event.h perf/core: Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE] 2018-04-17 09:47:39 -03:00
personality.h
pfkeyv2.h
pg.h
phantom.h
phonet.h
pkt_cls.h sched: cls: enable verbose logging 2018-05-14 16:18:27 -04:00
pkt_sched.h
pktcdvd.h
pmu.h
poll.h
posix_acl_xattr.h
posix_acl.h
posix_types.h
ppdev.h
ppp_defs.h
ppp-comp.h
ppp-ioctl.h
pps.h
pr.h
prctl.h
psample.h
psci.h
psp-sev.h include: psp-sev: Capitalize invalid length enum 2018-02-24 02:24:11 +01:00
ptp_clock.h
ptrace.h seccomp, ptrace: switch get_metadata types to arch independent 2018-02-21 16:56:03 -08:00
qemu_fw_cfg.h fw_cfg: write vmcoreinfo details 2018-03-20 03:17:41 +02:00
qnx4_fs.h
qnxtypes.h
qrtr.h
quota.h
radeonfb.h
random.h random: add new ioctl RNDRESEEDCRNG 2018-04-14 11:59:31 -04:00
raw.h
rds.h uapi: Fix SPDX tags for files referring to the 'OpenIB.org' license 2018-04-23 11:10:33 -04:00
reboot.h
reiserfs_fs.h
reiserfs_xattr.h
resource.h
rfkill.h
rio_cm_cdev.h
rio_mport_cdev.h
romfs_fs.h
rose.h
route.h
rpmsg.h
rtc.h
rtnetlink.h
rxrpc.h
scc.h
sched.h
scif_ioctl.h
screen_info.h
sctp.h selinux/stable-4.17 PR 20180403 2018-04-06 15:39:26 -07:00
sdla.h
seccomp.h
securebits.h
sed-opal.h
seg6_genl.h
seg6_hmac.h
seg6_iptunnel.h
seg6_local.h
seg6.h
selinux_netlink.h
sem.h ipc/sem: introduce semctl(SEM_STAT_ANY) 2018-04-11 10:28:37 -07:00
serial_core.h serial: 8250: Add Nuvoton NPCM UART 2018-03-09 11:01:19 -08:00
serial_reg.h
serial.h
serio.h
shm.h ipc/shm: introduce shmctl(SHM_STAT_ANY) 2018-04-11 10:28:37 -07:00
signal.h
signalfd.h
smc_diag.h
smc.h
smiapp.h
snmp.h tcp: export packets delivery info 2018-04-19 13:05:16 -04:00
sock_diag.h
socket.h
sockios.h
sonet.h
sonypi.h
sound.h
soundcard.h
stat.h
stddef.h
stm.h stm class: Make dummy's master/channel ranges configurable 2018-03-28 18:47:18 +03:00
string.h
suspend_ioctls.h
swab.h
switchtec_ioctl.h
sync_file.h
synclink.h
sysctl.h staging: irda: remove remaining remants of irda code removal 2018-04-16 11:26:49 +02:00
sysinfo.h
target_core_user.h
taskstats.h
tcp_metrics.h
tcp.h tcp: send in-queue bytes in cmsg upon read 2018-05-01 18:56:29 -04:00
tee.h
termios.h
thermal.h
time.h Revert: Unify CLOCK_MONOTONIC and CLOCK_BOOTTIME 2018-04-26 14:53:32 +02:00
timerfd.h
times.h
timex.h
tiocl.h
tipc_config.h tipc: set default MTU for UDP media 2018-04-20 11:04:05 -04:00
tipc_netlink.h tipc: implement configuration of UDP media MTU 2018-04-20 11:04:05 -04:00
tipc_sockets_diag.h tipc: implement socket diagnostics for AF_TIPC 2018-03-22 14:43:35 -04:00
tipc.h tipc: introduce ioctl for fetching node identity 2018-04-27 11:05:41 -04:00
tls.h uapi: Fix SPDX tags for files referring to the 'OpenIB.org' license 2018-04-23 11:10:33 -04:00
toshiba.h
tty_flags.h
tty.h
types.h
udf_fs_i.h
udp.h udp: generate gso with UDP_SEGMENT 2018-04-26 15:08:04 -04:00
uhid.h
uinput.h
uio.h
uleds.h
ultrasound.h
un.h
unistd.h
unix_diag.h
usbdevice_fs.h
usbip.h
userfaultfd.h
userio.h
utime.h
utsname.h
uuid.h
uvcvideo.h
v4l2-common.h
v4l2-controls.h media: v4l2: Add v4l2 control IDs for HEVC encoder 2018-03-22 06:32:15 -04:00
v4l2-dv-timings.h
v4l2-mediabus.h media: v4l: doc: Clarify v4l2_mbus_fmt height definition 2018-02-26 08:15:50 -05:00
v4l2-subdev.h
vbox_err.h
vbox_vmmdev_types.h
vboxguest.h
veth.h
vfio_ccw.h
vfio.h vfio/pci: Add ioeventfd support 2018-03-26 13:22:58 -06:00
vhost.h
videodev2.h media: videodev2.h: Add v4l2 definition for HEVC 2018-03-22 06:26:05 -04:00
virtio_9p.h
virtio_balloon.h virtio_balloon: add array of stat names 2018-04-24 21:44:01 +03:00
virtio_blk.h
virtio_config.h
virtio_console.h
virtio_crypto.h
virtio_gpu.h
virtio_ids.h
virtio_input.h
virtio_mmio.h
virtio_net.h
virtio_pci.h
virtio_ring.h
virtio_rng.h
virtio_scsi.h
virtio_types.h
virtio_vsock.h
vm_sockets_diag.h
vm_sockets.h
vmcore.h vmcore: add API to collect hardware dump in second kernel 2018-05-14 13:46:04 -04:00
vsockmon.h
vt.h
vtpm_proxy.h
wait.h
wanrouter.h
watchdog.h
wimax.h
wireless.h
wmi.h
x25.h
xattr.h
xfrm.h
xilinx-v4l2-controls.h
zorro_ids.h
zorro.h