aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/uapi/asm/socket.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-12-06 00:47:48 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-06 00:47:48 -0500
commit8d0c4697534a739725e429ff062dea393d8860d1 (patch)
treeee28163a6c53e0131fd2d3d626d02b0610eaed2b /arch/sparc/include/uapi/asm/socket.h
parentf51a5e82ea9aaf05106c00d976e772ca384a9199 (diff)
parentfbe3310840c65f3cf97dd90d23e177d061c376f2 (diff)
Merge branch 'ebpf-next'
Alexei Starovoitov says: ==================== allow eBPF programs to be attached to sockets V1->V2: fixed comments in sample code to state clearly that packet data is accessed with LD_ABS instructions and not internal skb fields. Also replaced constants in: BPF_LD_ABS(BPF_B, 14 + 9 /* R0 = ip->proto */), with: BPF_LD_ABS(BPF_B, ETH_HLEN + offsetof(struct iphdr, protocol) /* R0 = ip->proto */), V1 cover: Introduce BPF_PROG_TYPE_SOCKET_FILTER type of eBPF programs that can be attached to sockets with setsockopt(). Allow such programs to access maps via lookup/update/delete helpers. This feature was previewed by bpf manpage in commit b4fc1a460f30("Merge branch 'bpf-next'") Now it can actually run. 1st patch adds LD_ABS/LD_IND instruction verification and 2nd patch adds new setsockopt() flag. Patches 3-6 are examples in assembler and in C. Though native eBPF programs are way more powerful than classic filters (attachable through similar setsockopt() call), they don't have skb field accessors yet. Like skb->pkt_type, skb->dev->ifindex are not accessible. There are sevaral ways to achieve that. That will be in the next set of patches. So in this set native eBPF programs can only read data from packet and access maps. The most powerful example is sockex2_kern.c from patch 6 where ~200 lines of C are compiled into ~300 of eBPF instructions. It shows how quite complex packet parsing can be done. LLVM used to build examples is at https://github.com/iovisor/llvm which is fork of llvm trunk that I'm cleaning up for upstreaming. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/include/uapi/asm/socket.h')
-rw-r--r--arch/sparc/include/uapi/asm/socket.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index 4a8003a94163..e6a16c40be5f 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -78,6 +78,9 @@
78 78
79#define SO_INCOMING_CPU 0x0033 79#define SO_INCOMING_CPU 0x0033
80 80
81#define SO_ATTACH_BPF 0x0034
82#define SO_DETACH_BPF SO_DETACH_FILTER
83
81/* Security levels - as per NRL IPv6 - don't actually do anything */ 84/* Security levels - as per NRL IPv6 - don't actually do anything */
82#define SO_SECURITY_AUTHENTICATION 0x5001 85#define SO_SECURITY_AUTHENTICATION 0x5001
83#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002 86#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002