|
@@ -47,6 +47,8 @@
|
|
#include <linux/errqueue.h>
|
|
#include <linux/errqueue.h>
|
|
#include <linux/uaccess.h>
|
|
#include <linux/uaccess.h>
|
|
|
|
|
|
|
|
+#include <linux/bpfilter.h>
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* SOL_IP control messages.
|
|
* SOL_IP control messages.
|
|
*/
|
|
*/
|
|
@@ -1244,6 +1246,11 @@ int ip_setsockopt(struct sock *sk, int level,
|
|
return -ENOPROTOOPT;
|
|
return -ENOPROTOOPT;
|
|
|
|
|
|
err = do_ip_setsockopt(sk, level, optname, optval, optlen);
|
|
err = do_ip_setsockopt(sk, level, optname, optval, optlen);
|
|
|
|
+#ifdef CONFIG_BPFILTER
|
|
|
|
+ if (optname >= BPFILTER_IPT_SO_SET_REPLACE &&
|
|
|
|
+ optname < BPFILTER_IPT_SET_MAX)
|
|
|
|
+ err = bpfilter_ip_set_sockopt(sk, optname, optval, optlen);
|
|
|
|
+#endif
|
|
#ifdef CONFIG_NETFILTER
|
|
#ifdef CONFIG_NETFILTER
|
|
/* we need to exclude all possible ENOPROTOOPTs except default case */
|
|
/* we need to exclude all possible ENOPROTOOPTs except default case */
|
|
if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
|
|
if (err == -ENOPROTOOPT && optname != IP_HDRINCL &&
|
|
@@ -1552,6 +1559,11 @@ int ip_getsockopt(struct sock *sk, int level,
|
|
int err;
|
|
int err;
|
|
|
|
|
|
err = do_ip_getsockopt(sk, level, optname, optval, optlen, 0);
|
|
err = do_ip_getsockopt(sk, level, optname, optval, optlen, 0);
|
|
|
|
+#ifdef CONFIG_BPFILTER
|
|
|
|
+ if (optname >= BPFILTER_IPT_SO_GET_INFO &&
|
|
|
|
+ optname < BPFILTER_IPT_GET_MAX)
|
|
|
|
+ err = bpfilter_ip_get_sockopt(sk, optname, optval, optlen);
|
|
|
|
+#endif
|
|
#ifdef CONFIG_NETFILTER
|
|
#ifdef CONFIG_NETFILTER
|
|
/* we need to exclude all possible ENOPROTOOPTs except default case */
|
|
/* we need to exclude all possible ENOPROTOOPTs except default case */
|
|
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
|
|
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
|
|
@@ -1584,6 +1596,11 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname,
|
|
err = do_ip_getsockopt(sk, level, optname, optval, optlen,
|
|
err = do_ip_getsockopt(sk, level, optname, optval, optlen,
|
|
MSG_CMSG_COMPAT);
|
|
MSG_CMSG_COMPAT);
|
|
|
|
|
|
|
|
+#ifdef CONFIG_BPFILTER
|
|
|
|
+ if (optname >= BPFILTER_IPT_SO_GET_INFO &&
|
|
|
|
+ optname < BPFILTER_IPT_GET_MAX)
|
|
|
|
+ err = bpfilter_ip_get_sockopt(sk, optname, optval, optlen);
|
|
|
|
+#endif
|
|
#ifdef CONFIG_NETFILTER
|
|
#ifdef CONFIG_NETFILTER
|
|
/* we need to exclude all possible ENOPROTOOPTs except default case */
|
|
/* we need to exclude all possible ENOPROTOOPTs except default case */
|
|
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
|
|
if (err == -ENOPROTOOPT && optname != IP_PKTOPTIONS &&
|