Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Pablo Neira Ayuso says: ==================== netfilter/IPVS updates for net-next The following patchset contains Netfilter updates for your net-next tree, they are: * Add full port randomization support. Some crazy researchers found a way to reconstruct the secure ephemeral ports that are allocated in random mode by sending off-path bursts of UDP packets to overrun the socket buffer of the DNS resolver to trigger retransmissions, then if the timing for the DNS resolution done by a client is larger than usual, then they conclude that the port that received the burst of UDP packets is the one that was opened. It seems a bit aggressive method to me but it seems to work for them. As a result, Daniel Borkmann and Hannes Frederic Sowa came up with a new NAT mode to fully randomize ports using prandom. * Add a new classifier to x_tables based on the socket net_cls set via cgroups. These includes two patches to prepare the field as requested by Zefan Li. Also from Daniel Borkmann. * Use prandom instead of get_random_bytes in several locations of the netfilter code, from Florian Westphal. * Allow to use the CTA_MARK_MASK in ctnetlink when mangling the conntrack mark, also from Florian Westphal. * Fix compilation warning due to unused variable in IPVS, from Geert Uytterhoeven. * Add support for UID/GID via nfnetlink_queue, from Valentina Giusti. * Add IPComp extension to x_tables, from Fan Du. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -31,7 +31,7 @@ SUBSYS(devices)
|
||||
SUBSYS(freezer)
|
||||
#endif
|
||||
|
||||
#if IS_SUBSYS_ENABLED(CONFIG_NET_CLS_CGROUP)
|
||||
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_NET_CLASSID)
|
||||
SUBSYS(net_cls)
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ SUBSYS(blkio)
|
||||
SUBSYS(perf)
|
||||
#endif
|
||||
|
||||
#if IS_SUBSYS_ENABLED(CONFIG_NETPRIO_CGROUP)
|
||||
#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_NET_PRIO)
|
||||
SUBSYS(net_prio)
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1444,7 +1444,7 @@ struct net_device {
|
||||
/* max exchange id for FCoE LRO by ddp */
|
||||
unsigned int fcoe_ddp_xid;
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
|
||||
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
|
||||
struct netprio_map __rcu *priomap;
|
||||
#endif
|
||||
/* phy device may attach itself for hardware timestamping */
|
||||
|
||||
@@ -331,7 +331,6 @@ extern ip_set_id_t ip_set_get_byname(struct net *net,
|
||||
const char *name, struct ip_set **set);
|
||||
extern void ip_set_put_byindex(struct net *net, ip_set_id_t index);
|
||||
extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index);
|
||||
extern ip_set_id_t ip_set_nfnl_get(struct net *net, const char *name);
|
||||
extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index);
|
||||
extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index);
|
||||
|
||||
|
||||
@@ -16,17 +16,16 @@
|
||||
#include <linux/cgroup.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <net/sock.h>
|
||||
|
||||
#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
|
||||
struct cgroup_cls_state
|
||||
{
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
struct cgroup_cls_state {
|
||||
struct cgroup_subsys_state css;
|
||||
u32 classid;
|
||||
};
|
||||
|
||||
void sock_update_classid(struct sock *sk);
|
||||
struct cgroup_cls_state *task_cls_state(struct task_struct *p);
|
||||
|
||||
#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
|
||||
static inline u32 task_cls_classid(struct task_struct *p)
|
||||
{
|
||||
u32 classid;
|
||||
@@ -41,33 +40,18 @@ static inline u32 task_cls_classid(struct task_struct *p)
|
||||
|
||||
return classid;
|
||||
}
|
||||
#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
|
||||
static inline u32 task_cls_classid(struct task_struct *p)
|
||||
|
||||
static inline void sock_update_classid(struct sock *sk)
|
||||
{
|
||||
struct cgroup_subsys_state *css;
|
||||
u32 classid = 0;
|
||||
u32 classid;
|
||||
|
||||
if (in_interrupt())
|
||||
return 0;
|
||||
|
||||
rcu_read_lock();
|
||||
css = task_css(p, net_cls_subsys_id);
|
||||
if (css)
|
||||
classid = container_of(css,
|
||||
struct cgroup_cls_state, css)->classid;
|
||||
rcu_read_unlock();
|
||||
|
||||
return classid;
|
||||
classid = task_cls_classid(current);
|
||||
if (classid != sk->sk_classid)
|
||||
sk->sk_classid = classid;
|
||||
}
|
||||
#endif
|
||||
#else /* !CGROUP_NET_CLS_CGROUP */
|
||||
#else /* !CONFIG_CGROUP_NET_CLASSID */
|
||||
static inline void sock_update_classid(struct sock *sk)
|
||||
{
|
||||
}
|
||||
|
||||
static inline u32 task_cls_classid(struct task_struct *p)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif /* CGROUP_NET_CLS_CGROUP */
|
||||
#endif /* CONFIG_CGROUP_NET_CLASSID */
|
||||
#endif /* _NET_CLS_CGROUP_H */
|
||||
|
||||
@@ -19,6 +19,4 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
|
||||
int nf_conntrack_ipv4_compat_init(void);
|
||||
void nf_conntrack_ipv4_compat_fini(void);
|
||||
|
||||
void need_ipv4_conntrack(void);
|
||||
|
||||
#endif /*_NF_CONNTRACK_IPV4_H*/
|
||||
|
||||
@@ -87,7 +87,6 @@ int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto);
|
||||
void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto);
|
||||
|
||||
struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
|
||||
void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
|
||||
|
||||
/* Existing built-in protocols */
|
||||
extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
|
||||
|
||||
@@ -65,6 +65,23 @@ struct nf_ip_net {
|
||||
struct netns_ct {
|
||||
atomic_t count;
|
||||
unsigned int expect_count;
|
||||
#ifdef CONFIG_SYSCTL
|
||||
struct ctl_table_header *sysctl_header;
|
||||
struct ctl_table_header *acct_sysctl_header;
|
||||
struct ctl_table_header *tstamp_sysctl_header;
|
||||
struct ctl_table_header *event_sysctl_header;
|
||||
struct ctl_table_header *helper_sysctl_header;
|
||||
#endif
|
||||
char *slabname;
|
||||
unsigned int sysctl_log_invalid; /* Log invalid packets */
|
||||
unsigned int sysctl_events_retry_timeout;
|
||||
int sysctl_events;
|
||||
int sysctl_acct;
|
||||
int sysctl_auto_assign_helper;
|
||||
bool auto_assign_helper_warned;
|
||||
int sysctl_tstamp;
|
||||
int sysctl_checksum;
|
||||
|
||||
unsigned int htable_size;
|
||||
struct kmem_cache *nf_conntrack_cachep;
|
||||
struct hlist_nulls_head *hash;
|
||||
@@ -75,14 +92,6 @@ struct netns_ct {
|
||||
struct ip_conntrack_stat __percpu *stat;
|
||||
struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
|
||||
struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
|
||||
int sysctl_events;
|
||||
unsigned int sysctl_events_retry_timeout;
|
||||
int sysctl_acct;
|
||||
int sysctl_tstamp;
|
||||
int sysctl_checksum;
|
||||
unsigned int sysctl_log_invalid; /* Log invalid packets */
|
||||
int sysctl_auto_assign_helper;
|
||||
bool auto_assign_helper_warned;
|
||||
struct nf_ip_net nf_ct_proto;
|
||||
#if defined(CONFIG_NF_CONNTRACK_LABELS)
|
||||
unsigned int labels_used;
|
||||
@@ -92,13 +101,5 @@ struct netns_ct {
|
||||
struct hlist_head *nat_bysource;
|
||||
unsigned int nat_htable_size;
|
||||
#endif
|
||||
#ifdef CONFIG_SYSCTL
|
||||
struct ctl_table_header *sysctl_header;
|
||||
struct ctl_table_header *acct_sysctl_header;
|
||||
struct ctl_table_header *tstamp_sysctl_header;
|
||||
struct ctl_table_header *event_sysctl_header;
|
||||
struct ctl_table_header *helper_sysctl_header;
|
||||
#endif
|
||||
char *slabname;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
#ifndef _NETPRIO_CGROUP_H
|
||||
#define _NETPRIO_CGROUP_H
|
||||
|
||||
#include <linux/cgroup.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
|
||||
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
|
||||
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
|
||||
struct netprio_map {
|
||||
struct rcu_head rcu;
|
||||
u32 priomap_len;
|
||||
@@ -27,8 +27,7 @@ struct netprio_map {
|
||||
|
||||
void sock_update_netprioidx(struct sock *sk);
|
||||
|
||||
#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
|
||||
|
||||
#if IS_BUILTIN(CONFIG_CGROUP_NET_PRIO)
|
||||
static inline u32 task_netprioidx(struct task_struct *p)
|
||||
{
|
||||
struct cgroup_subsys_state *css;
|
||||
@@ -40,9 +39,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
|
||||
rcu_read_unlock();
|
||||
return idx;
|
||||
}
|
||||
|
||||
#elif IS_MODULE(CONFIG_NETPRIO_CGROUP)
|
||||
|
||||
#elif IS_MODULE(CONFIG_CGROUP_NET_PRIO)
|
||||
static inline u32 task_netprioidx(struct task_struct *p)
|
||||
{
|
||||
struct cgroup_subsys_state *css;
|
||||
@@ -56,9 +53,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
|
||||
return idx;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* !CONFIG_NETPRIO_CGROUP */
|
||||
|
||||
#else /* !CONFIG_CGROUP_NET_PRIO */
|
||||
static inline u32 task_netprioidx(struct task_struct *p)
|
||||
{
|
||||
return 0;
|
||||
@@ -66,6 +61,5 @@ static inline u32 task_netprioidx(struct task_struct *p)
|
||||
|
||||
#define sock_update_netprioidx(sk)
|
||||
|
||||
#endif /* CONFIG_NETPRIO_CGROUP */
|
||||
|
||||
#endif /* CONFIG_CGROUP_NET_PRIO */
|
||||
#endif /* _NET_CLS_CGROUP_H */
|
||||
|
||||
@@ -395,7 +395,7 @@ struct sock {
|
||||
unsigned short sk_ack_backlog;
|
||||
unsigned short sk_max_ack_backlog;
|
||||
__u32 sk_priority;
|
||||
#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
|
||||
#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
|
||||
__u32 sk_cgrp_prioidx;
|
||||
#endif
|
||||
struct pid *sk_peer_pid;
|
||||
|
||||
@@ -39,6 +39,7 @@ header-y += xt_TEE.h
|
||||
header-y += xt_TPROXY.h
|
||||
header-y += xt_addrtype.h
|
||||
header-y += xt_bpf.h
|
||||
header-y += xt_cgroup.h
|
||||
header-y += xt_cluster.h
|
||||
header-y += xt_comment.h
|
||||
header-y += xt_connbytes.h
|
||||
@@ -54,6 +55,7 @@ header-y += xt_ecn.h
|
||||
header-y += xt_esp.h
|
||||
header-y += xt_hashlimit.h
|
||||
header-y += xt_helper.h
|
||||
header-y += xt_ipcomp.h
|
||||
header-y += xt_iprange.h
|
||||
header-y += xt_ipvs.h
|
||||
header-y += xt_length.h
|
||||
|
||||
@@ -4,10 +4,14 @@
|
||||
#include <linux/netfilter.h>
|
||||
#include <linux/netfilter/nf_conntrack_tuple_common.h>
|
||||
|
||||
#define NF_NAT_RANGE_MAP_IPS 1
|
||||
#define NF_NAT_RANGE_PROTO_SPECIFIED 2
|
||||
#define NF_NAT_RANGE_PROTO_RANDOM 4
|
||||
#define NF_NAT_RANGE_PERSISTENT 8
|
||||
#define NF_NAT_RANGE_MAP_IPS (1 << 0)
|
||||
#define NF_NAT_RANGE_PROTO_SPECIFIED (1 << 1)
|
||||
#define NF_NAT_RANGE_PROTO_RANDOM (1 << 2)
|
||||
#define NF_NAT_RANGE_PERSISTENT (1 << 3)
|
||||
#define NF_NAT_RANGE_PROTO_RANDOM_FULLY (1 << 4)
|
||||
|
||||
#define NF_NAT_RANGE_PROTO_RANDOM_ALL \
|
||||
(NF_NAT_RANGE_PROTO_RANDOM | NF_NAT_RANGE_PROTO_RANDOM_FULLY)
|
||||
|
||||
struct nf_nat_ipv4_range {
|
||||
unsigned int flags;
|
||||
|
||||
@@ -47,6 +47,8 @@ enum nfqnl_attr_type {
|
||||
NFQA_CAP_LEN, /* __u32 length of captured packet */
|
||||
NFQA_SKB_INFO, /* __u32 skb meta information */
|
||||
NFQA_EXP, /* nf_conntrack_netlink.h */
|
||||
NFQA_UID, /* __u32 sk uid */
|
||||
NFQA_GID, /* __u32 sk gid */
|
||||
|
||||
__NFQA_MAX
|
||||
};
|
||||
@@ -99,7 +101,8 @@ enum nfqnl_attr_config {
|
||||
#define NFQA_CFG_F_FAIL_OPEN (1 << 0)
|
||||
#define NFQA_CFG_F_CONNTRACK (1 << 1)
|
||||
#define NFQA_CFG_F_GSO (1 << 2)
|
||||
#define NFQA_CFG_F_MAX (1 << 3)
|
||||
#define NFQA_CFG_F_UID_GID (1 << 3)
|
||||
#define NFQA_CFG_F_MAX (1 << 4)
|
||||
|
||||
/* flags for NFQA_SKB_INFO */
|
||||
/* packet appears to have wrong checksums, but they are ok */
|
||||
|
||||
11
include/uapi/linux/netfilter/xt_cgroup.h
Normal file
11
include/uapi/linux/netfilter/xt_cgroup.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef _UAPI_XT_CGROUP_H
|
||||
#define _UAPI_XT_CGROUP_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct xt_cgroup_info {
|
||||
__u32 id;
|
||||
__u32 invert;
|
||||
};
|
||||
|
||||
#endif /* _UAPI_XT_CGROUP_H */
|
||||
16
include/uapi/linux/netfilter/xt_ipcomp.h
Normal file
16
include/uapi/linux/netfilter/xt_ipcomp.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef _XT_IPCOMP_H
|
||||
#define _XT_IPCOMP_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct xt_ipcomp {
|
||||
__u32 spis[2]; /* Security Parameter Index */
|
||||
__u8 invflags; /* Inverse flags */
|
||||
__u8 hdrres; /* Test of the Reserved Filed */
|
||||
};
|
||||
|
||||
/* Values for "invflags" field in struct xt_ipcomp. */
|
||||
#define XT_IPCOMP_INV_SPI 0x01 /* Invert the sense of spi. */
|
||||
#define XT_IPCOMP_INV_MASK 0x01 /* All possible flags. */
|
||||
|
||||
#endif /*_XT_IPCOMP_H*/
|
||||
Reference in New Issue
Block a user