Skip to content

Commit ea02f94

Browse files
msekletardavem330
authored andcommitted
net: introduce SO_BPF_EXTENSIONS
For user space packet capturing libraries such as libpcap, there's currently only one way to check which BPF extensions are supported by the kernel, that is, commit aa1113d ("net: filter: return -EINVAL if BPF_S_ANC* operation is not supported"). For querying all extensions at once this might be rather inconvenient. Therefore, this patch introduces a new option which can be used as an argument for getsockopt(), and allows one to obtain information about which BPF extensions are supported by the current kernel. As David Miller suggests, we do not need to define any bits right now and status quo can just return 0 in order to state that this versions supports SKF_AD_PROTOCOL up to SKF_AD_PAY_OFFSET. Later additions to BPF extensions need to add their bits to the bpf_tell_extensions() function, as documented in the comment. Signed-off-by: Michal Sekletar <msekleta@redhat.com> Cc: David Miller <davem@davemloft.net> Reviewed-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4180442 commit ea02f94

16 files changed

Lines changed: 43 additions & 0 deletions

File tree

‎arch/alpha/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@
8585

8686
#define SO_MAX_PACING_RATE 47
8787

88+
#define SO_BPF_EXTENSIONS 48
89+
8890
#endif /* _UAPI_ASM_SOCKET_H */

‎arch/avr32/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,6 @@
7878

7979
#define SO_MAX_PACING_RATE 47
8080

81+
#define SO_BPF_EXTENSIONS 48
82+
8183
#endif /* _UAPI__ASM_AVR32_SOCKET_H */

‎arch/cris/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080

8181
#define SO_MAX_PACING_RATE 47
8282

83+
#define SO_BPF_EXTENSIONS 48
84+
8385
#endif /* _ASM_SOCKET_H */
8486

8587

‎arch/frv/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,7 @@
7878

7979
#define SO_MAX_PACING_RATE 47
8080

81+
#define SO_BPF_EXTENSIONS 48
82+
8183
#endif /* _ASM_SOCKET_H */
8284

‎arch/ia64/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,6 @@
8787

8888
#define SO_MAX_PACING_RATE 47
8989

90+
#define SO_BPF_EXTENSIONS 48
91+
9092
#endif /* _ASM_IA64_SOCKET_H */

‎arch/m32r/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,6 @@
7878

7979
#define SO_MAX_PACING_RATE 47
8080

81+
#define SO_BPF_EXTENSIONS 48
82+
8183
#endif /* _ASM_M32R_SOCKET_H */

‎arch/mips/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,6 @@
9696

9797
#define SO_MAX_PACING_RATE 47
9898

99+
#define SO_BPF_EXTENSIONS 48
100+
99101
#endif /* _UAPI_ASM_SOCKET_H */

‎arch/mn10300/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,6 @@
7878

7979
#define SO_MAX_PACING_RATE 47
8080

81+
#define SO_BPF_EXTENSIONS 48
82+
8183
#endif /* _ASM_SOCKET_H */

‎arch/parisc/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,6 @@
7777

7878
#define SO_MAX_PACING_RATE 0x4028
7979

80+
#define SO_BPF_EXTENSIONS 0x4029
81+
8082
#endif /* _UAPI_ASM_SOCKET_H */

‎arch/powerpc/include/uapi/asm/socket.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,6 @@
8585

8686
#define SO_MAX_PACING_RATE 47
8787

88+
#define SO_BPF_EXTENSIONS 48
89+
8890
#endif /* _ASM_POWERPC_SOCKET_H */

0 commit comments

Comments
 (0)