Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.18-rc4 43 lines 1.1 kB view raw
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/uaccess.h> 3#include <linux/bpfilter.h> 4#include <uapi/linux/bpf.h> 5#include <linux/wait.h> 6#include <linux/kmod.h> 7 8int (*bpfilter_process_sockopt)(struct sock *sk, int optname, 9 char __user *optval, 10 unsigned int optlen, bool is_set); 11EXPORT_SYMBOL_GPL(bpfilter_process_sockopt); 12 13static int bpfilter_mbox_request(struct sock *sk, int optname, 14 char __user *optval, 15 unsigned int optlen, bool is_set) 16{ 17 if (!bpfilter_process_sockopt) { 18 int err = request_module("bpfilter"); 19 20 if (err) 21 return err; 22 if (!bpfilter_process_sockopt) 23 return -ECHILD; 24 } 25 return bpfilter_process_sockopt(sk, optname, optval, optlen, is_set); 26} 27 28int bpfilter_ip_set_sockopt(struct sock *sk, int optname, char __user *optval, 29 unsigned int optlen) 30{ 31 return bpfilter_mbox_request(sk, optname, optval, optlen, true); 32} 33 34int bpfilter_ip_get_sockopt(struct sock *sk, int optname, char __user *optval, 35 int __user *optlen) 36{ 37 int len; 38 39 if (get_user(len, optlen)) 40 return -EFAULT; 41 42 return bpfilter_mbox_request(sk, optname, optval, len, false); 43}