@@ -194,6 +194,7 @@ enum bpf_arg_type {
194194 ARG_ANYTHING , /* any (initialized) argument is ok */
195195 ARG_PTR_TO_SOCKET , /* pointer to bpf_sock */
196196 ARG_PTR_TO_SPIN_LOCK , /* pointer to bpf_spin_lock */
197+ ARG_PTR_TO_SOCK_COMMON , /* pointer to sock_common */
197198};
198199
199200/* type of values returned from helper functions */
@@ -203,6 +204,7 @@ enum bpf_return_type {
203204 RET_PTR_TO_MAP_VALUE , /* returns a pointer to map elem value */
204205 RET_PTR_TO_MAP_VALUE_OR_NULL , /* returns a pointer to map elem value or NULL */
205206 RET_PTR_TO_SOCKET_OR_NULL , /* returns a pointer to a socket or NULL */
207+ RET_PTR_TO_TCP_SOCK_OR_NULL , /* returns a pointer to a tcp_sock or NULL */
206208};
207209
208210/* eBPF function prototype used by verifier to allow BPF_CALLs from eBPF programs
@@ -256,6 +258,10 @@ enum bpf_reg_type {
256258 PTR_TO_FLOW_KEYS , /* reg points to bpf_flow_keys */
257259 PTR_TO_SOCKET , /* reg points to struct bpf_sock */
258260 PTR_TO_SOCKET_OR_NULL , /* reg points to struct bpf_sock or NULL */
261+ PTR_TO_SOCK_COMMON , /* reg points to sock_common */
262+ PTR_TO_SOCK_COMMON_OR_NULL , /* reg points to sock_common or NULL */
263+ PTR_TO_TCP_SOCK , /* reg points to struct tcp_sock */
264+ PTR_TO_TCP_SOCK_OR_NULL , /* reg points to struct tcp_sock or NULL */
259265};
260266
261267/* The information passed from prog-specific *_is_valid_access
@@ -767,8 +773,9 @@ int bpf_map_offload_get_next_key(struct bpf_map *map,
767773bool bpf_offload_prog_map_match (struct bpf_prog * prog , struct bpf_map * map );
768774
769775struct bpf_offload_dev *
770- bpf_offload_dev_create (const struct bpf_prog_offload_ops * ops );
776+ bpf_offload_dev_create (const struct bpf_prog_offload_ops * ops , void * priv );
771777void bpf_offload_dev_destroy (struct bpf_offload_dev * offdev );
778+ void * bpf_offload_dev_priv (struct bpf_offload_dev * offdev );
772779int bpf_offload_dev_netdev_register (struct bpf_offload_dev * offdev ,
773780 struct net_device * netdev );
774781void bpf_offload_dev_netdev_unregister (struct bpf_offload_dev * offdev ,
@@ -920,6 +927,9 @@ void bpf_user_rnd_init_once(void);
920927u64 bpf_user_rnd_u32 (u64 r1 , u64 r2 , u64 r3 , u64 r4 , u64 r5 );
921928
922929#if defined(CONFIG_NET )
930+ bool bpf_sock_common_is_valid_access (int off , int size ,
931+ enum bpf_access_type type ,
932+ struct bpf_insn_access_aux * info );
923933bool bpf_sock_is_valid_access (int off , int size , enum bpf_access_type type ,
924934 struct bpf_insn_access_aux * info );
925935u32 bpf_sock_convert_ctx_access (enum bpf_access_type type ,
@@ -928,6 +938,12 @@ u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
928938 struct bpf_prog * prog ,
929939 u32 * target_size );
930940#else
941+ static inline bool bpf_sock_common_is_valid_access (int off , int size ,
942+ enum bpf_access_type type ,
943+ struct bpf_insn_access_aux * info )
944+ {
945+ return false;
946+ }
931947static inline bool bpf_sock_is_valid_access (int off , int size ,
932948 enum bpf_access_type type ,
933949 struct bpf_insn_access_aux * info )
@@ -944,4 +960,31 @@ static inline u32 bpf_sock_convert_ctx_access(enum bpf_access_type type,
944960}
945961#endif
946962
963+ #ifdef CONFIG_INET
964+ bool bpf_tcp_sock_is_valid_access (int off , int size , enum bpf_access_type type ,
965+ struct bpf_insn_access_aux * info );
966+
967+ u32 bpf_tcp_sock_convert_ctx_access (enum bpf_access_type type ,
968+ const struct bpf_insn * si ,
969+ struct bpf_insn * insn_buf ,
970+ struct bpf_prog * prog ,
971+ u32 * target_size );
972+ #else
973+ static inline bool bpf_tcp_sock_is_valid_access (int off , int size ,
974+ enum bpf_access_type type ,
975+ struct bpf_insn_access_aux * info )
976+ {
977+ return false;
978+ }
979+
980+ static inline u32 bpf_tcp_sock_convert_ctx_access (enum bpf_access_type type ,
981+ const struct bpf_insn * si ,
982+ struct bpf_insn * insn_buf ,
983+ struct bpf_prog * prog ,
984+ u32 * target_size )
985+ {
986+ return 0 ;
987+ }
988+ #endif /* CONFIG_INET */
989+
947990#endif /* _LINUX_BPF_H */
0 commit comments