2018-05-22 10:22:30 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
#ifndef _LINUX_BPFILTER_H
|
|
|
|
#define _LINUX_BPFILTER_H
|
|
|
|
|
|
|
|
#include <uapi/linux/bpfilter.h>
|
2020-06-27 01:23:00 +08:00
|
|
|
#include <linux/usermode_driver.h>
|
2020-07-23 14:08:55 +08:00
|
|
|
#include <linux/sockptr.h>
|
2018-05-22 10:22:30 +08:00
|
|
|
|
|
|
|
struct sock;
|
2020-07-23 14:08:55 +08:00
|
|
|
int bpfilter_ip_set_sockopt(struct sock *sk, int optname, sockptr_t optval,
|
2018-05-22 10:22:30 +08:00
|
|
|
unsigned int optlen);
|
2018-07-19 15:56:59 +08:00
|
|
|
int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval,
|
|
|
|
int __user *optlen);
|
2020-06-26 06:23:22 +08:00
|
|
|
void bpfilter_umh_cleanup(struct umd_info *info);
|
|
|
|
|
2019-01-09 01:24:34 +08:00
|
|
|
struct bpfilter_umh_ops {
|
2020-06-27 00:16:06 +08:00
|
|
|
struct umd_info info;
|
2019-01-09 01:25:10 +08:00
|
|
|
/* since ip_getsockopt() can run in parallel, serialize access to umh */
|
|
|
|
struct mutex lock;
|
2020-07-23 14:08:55 +08:00
|
|
|
int (*sockopt)(struct sock *sk, int optname, sockptr_t optval,
|
2019-01-09 01:24:34 +08:00
|
|
|
unsigned int optlen, bool is_set);
|
2019-01-09 01:24:53 +08:00
|
|
|
int (*start)(void);
|
2019-01-09 01:24:34 +08:00
|
|
|
};
|
|
|
|
extern struct bpfilter_umh_ops bpfilter_ops;
|
2018-05-22 10:22:30 +08:00
|
|
|
#endif
|