Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
Browse files Browse the repository at this point in the history
Pablo Neira Ayuso says:

====================
Netfilter updates for net-next

The following patchset contains the first batch of Netfilter updates for
the upcoming 4.5 kernel. This batch contains userspace netfilter header
compilation fixes, support for packet mangling in nf_tables, the new
tracing infrastructure for nf_tables and cgroup2 support for iptables.
More specifically, they are:

1) Two patches to include dependencies in our netfilter userspace
   headers to resolve compilation problems, from Mikko Rapeli.

2) Four comestic cleanup patches for the ebtables codebase, from Ian Morris.

3) Remove duplicate include in the netfilter reject infrastructure,
   from Stephen Hemminger.

4) Two patches to simplify the netfilter defragmentation code for IPv6,
   patch from Florian Westphal.

5) Fix root ownership of /proc/net netfilter for unpriviledged net
   namespaces, from Philip Whineray.

6) Get rid of unused fields in struct nft_pktinfo, from Florian Westphal.

7) Add mangling support to our nf_tables payload expression, from
   Patrick McHardy.

8) Introduce a new netlink-based tracing infrastructure for nf_tables,
   from Florian Westphal.

9) Change setter functions in nfnetlink_log to be void, from
    Rami Rosen.

10) Add netns support to the cttimeout infrastructure.

11) Add cgroup2 support to iptables, from Tejun Heo.

12) Introduce nfnl_dereference_protected() in nfnetlink, from Florian.

13) Add support for mangling pkttype in the nf_tables meta expression,
    also from Florian.

BTW, I need that you pull net into net-next, I have another batch that
requires changes that I don't yet see in net.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Dec 18, 2015
2 parents 4b402d7 + b4aae75 commit 59ce967
Show file tree
Hide file tree
Showing 66 changed files with 1,062 additions and 342 deletions.
13 changes: 13 additions & 0 deletions include/linux/netfilter/nf_conntrack_sctp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef _NF_CONNTRACK_SCTP_H
#define _NF_CONNTRACK_SCTP_H
/* SCTP tracking. */

#include <uapi/linux/netfilter/nf_conntrack_sctp.h>

struct ip_ct_sctp {
enum sctp_conntrack state;

__be32 vtag[IP_CT_DIR_MAX];
};

#endif /* _NF_CONNTRACK_SCTP_H */
3 changes: 3 additions & 0 deletions include/net/net_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ struct net {
#if IS_ENABLED(CONFIG_NETFILTER_NETLINK_ACCT)
struct list_head nfnl_acct_list;
#endif
#if IS_ENABLED(CONFIG_NF_CT_NETLINK_TIMEOUT)
struct list_head nfct_timeout_list;
#endif
#endif
#ifdef CONFIG_WEXT_CORE
struct sk_buff_head wext_nlevents;
Expand Down
3 changes: 1 addition & 2 deletions include/net/netfilter/ipv6/nf_defrag_ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ void nf_defrag_ipv6_enable(void);

int nf_ct_frag6_init(void);
void nf_ct_frag6_cleanup(void);
struct sk_buff *nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user);
void nf_ct_frag6_consume_orig(struct sk_buff *skb);
int nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user);

struct inet_frags_ctl;

Expand Down
2 changes: 1 addition & 1 deletion include/net/netfilter/nf_conntrack_timeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ static inline void nf_conntrack_timeout_fini(void)
#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */

#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(const char *name);
extern struct ctnl_timeout *(*nf_ct_timeout_find_get_hook)(struct net *net, const char *name);
extern void (*nf_ct_timeout_put_hook)(struct ctnl_timeout *timeout);
#endif

Expand Down
34 changes: 32 additions & 2 deletions include/net/netfilter/nf_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ struct nft_pktinfo {
const struct net_device *out;
u8 pf;
u8 hook;
u8 nhoff;
u8 thoff;
u8 tprot;
/* for x_tables compatibility */
struct xt_action_param xt;
Expand Down Expand Up @@ -890,6 +888,38 @@ void nft_unregister_chain_type(const struct nf_chain_type *);
int nft_register_expr(struct nft_expr_type *);
void nft_unregister_expr(struct nft_expr_type *);

int nft_verdict_dump(struct sk_buff *skb, int type,
const struct nft_verdict *v);

/**
* struct nft_traceinfo - nft tracing information and state
*
* @pkt: pktinfo currently processed
* @basechain: base chain currently processed
* @chain: chain currently processed
* @rule: rule that was evaluated
* @verdict: verdict given by rule
* @type: event type (enum nft_trace_types)
* @packet_dumped: packet headers sent in a previous traceinfo message
* @trace: other struct members are initialised
*/
struct nft_traceinfo {
const struct nft_pktinfo *pkt;
const struct nft_base_chain *basechain;
const struct nft_chain *chain;
const struct nft_rule *rule;
const struct nft_verdict *verdict;
enum nft_trace_types type;
bool packet_dumped;
bool trace;
};

void nft_trace_init(struct nft_traceinfo *info, const struct nft_pktinfo *pkt,
const struct nft_verdict *verdict,
const struct nft_chain *basechain);

void nft_trace_notify(struct nft_traceinfo *info);

#define nft_dereference(p) \
nfnl_dereference(p, NFNL_SUBSYS_NFTABLES)

Expand Down
10 changes: 10 additions & 0 deletions include/net/netfilter/nf_tables_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,17 @@ struct nft_payload {
enum nft_registers dreg:8;
};

struct nft_payload_set {
enum nft_payload_bases base:8;
u8 offset;
u8 len;
enum nft_registers sreg:8;
u8 csum_type;
u8 csum_offset;
};

extern const struct nft_expr_ops nft_payload_fast_ops;
extern struct static_key_false nft_trace_enabled;

int nft_payload_module_init(void);
void nft_payload_module_exit(void);
Expand Down
3 changes: 3 additions & 0 deletions include/net/netfilter/nft_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ void nft_meta_set_eval(const struct nft_expr *expr,
struct nft_regs *regs,
const struct nft_pktinfo *pkt);

void nft_meta_set_destroy(const struct nft_ctx *ctx,
const struct nft_expr *expr);

#endif
2 changes: 2 additions & 0 deletions include/uapi/linux/netfilter/ipset/ip_set_bitmap.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _UAPI__IP_SET_BITMAP_H
#define _UAPI__IP_SET_BITMAP_H

#include <linux/netfilter/ipset/ip_set.h>

/* Bitmap type specific error codes */
enum {
/* The element is out of the range of the set */
Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/netfilter/ipset/ip_set_hash.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _UAPI__IP_SET_HASH_H
#define _UAPI__IP_SET_HASH_H

#include <linux/netfilter/ipset/ip_set.h>

/* Hash type specific error codes */
enum {
/* Hash is full */
Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/netfilter/ipset/ip_set_list.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _UAPI__IP_SET_LIST_H
#define _UAPI__IP_SET_LIST_H

#include <linux/netfilter/ipset/ip_set.h>

/* List type specific error codes */
enum {
/* Set name to be added/deleted/tested does not exist. */
Expand Down
12 changes: 3 additions & 9 deletions include/uapi/linux/netfilter/nf_conntrack_sctp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef _NF_CONNTRACK_SCTP_H
#define _NF_CONNTRACK_SCTP_H
#ifndef _UAPI_NF_CONNTRACK_SCTP_H
#define _UAPI_NF_CONNTRACK_SCTP_H
/* SCTP tracking. */

#include <linux/netfilter/nf_conntrack_tuple_common.h>
Expand All @@ -18,10 +18,4 @@ enum sctp_conntrack {
SCTP_CONNTRACK_MAX
};

struct ip_ct_sctp {
enum sctp_conntrack state;

__be32 vtag[IP_CT_DIR_MAX];
};

#endif /* _NF_CONNTRACK_SCTP_H */
#endif /* _UAPI_NF_CONNTRACK_SCTP_H */
3 changes: 3 additions & 0 deletions include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef _NF_CONNTRACK_TUPLE_COMMON_H
#define _NF_CONNTRACK_TUPLE_COMMON_H

#include <linux/types.h>
#include <linux/netfilter.h>

enum ip_conntrack_dir {
IP_CT_DIR_ORIGINAL,
IP_CT_DIR_REPLY,
Expand Down
69 changes: 69 additions & 0 deletions include/uapi/linux/netfilter/nf_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ enum nft_verdicts {
* @NFT_MSG_DELSETELEM: delete a set element (enum nft_set_elem_attributes)
* @NFT_MSG_NEWGEN: announce a new generation, only for events (enum nft_gen_attributes)
* @NFT_MSG_GETGEN: get the rule-set generation (enum nft_gen_attributes)
* @NFT_MSG_TRACE: trace event (enum nft_trace_attributes)
*/
enum nf_tables_msg_types {
NFT_MSG_NEWTABLE,
Expand All @@ -102,6 +103,7 @@ enum nf_tables_msg_types {
NFT_MSG_DELSETELEM,
NFT_MSG_NEWGEN,
NFT_MSG_GETGEN,
NFT_MSG_TRACE,
NFT_MSG_MAX,
};

Expand Down Expand Up @@ -597,20 +599,37 @@ enum nft_payload_bases {
NFT_PAYLOAD_TRANSPORT_HEADER,
};

/**
* enum nft_payload_csum_types - nf_tables payload expression checksum types
*
* @NFT_PAYLOAD_CSUM_NONE: no checksumming
* @NFT_PAYLOAD_CSUM_INET: internet checksum (RFC 791)
*/
enum nft_payload_csum_types {
NFT_PAYLOAD_CSUM_NONE,
NFT_PAYLOAD_CSUM_INET,
};

/**
* enum nft_payload_attributes - nf_tables payload expression netlink attributes
*
* @NFTA_PAYLOAD_DREG: destination register to load data into (NLA_U32: nft_registers)
* @NFTA_PAYLOAD_BASE: payload base (NLA_U32: nft_payload_bases)
* @NFTA_PAYLOAD_OFFSET: payload offset relative to base (NLA_U32)
* @NFTA_PAYLOAD_LEN: payload length (NLA_U32)
* @NFTA_PAYLOAD_SREG: source register to load data from (NLA_U32: nft_registers)
* @NFTA_PAYLOAD_CSUM_TYPE: checksum type (NLA_U32)
* @NFTA_PAYLOAD_CSUM_OFFSET: checksum offset relative to base (NLA_U32)
*/
enum nft_payload_attributes {
NFTA_PAYLOAD_UNSPEC,
NFTA_PAYLOAD_DREG,
NFTA_PAYLOAD_BASE,
NFTA_PAYLOAD_OFFSET,
NFTA_PAYLOAD_LEN,
NFTA_PAYLOAD_SREG,
NFTA_PAYLOAD_CSUM_TYPE,
NFTA_PAYLOAD_CSUM_OFFSET,
__NFTA_PAYLOAD_MAX
};
#define NFTA_PAYLOAD_MAX (__NFTA_PAYLOAD_MAX - 1)
Expand Down Expand Up @@ -970,4 +989,54 @@ enum nft_gen_attributes {
};
#define NFTA_GEN_MAX (__NFTA_GEN_MAX - 1)

/**
* enum nft_trace_attributes - nf_tables trace netlink attributes
*
* @NFTA_TRACE_TABLE: name of the table (NLA_STRING)
* @NFTA_TRACE_CHAIN: name of the chain (NLA_STRING)
* @NFTA_TRACE_RULE_HANDLE: numeric handle of the rule (NLA_U64)
* @NFTA_TRACE_TYPE: type of the event (NLA_U32: nft_trace_types)
* @NFTA_TRACE_VERDICT: verdict returned by hook (NLA_NESTED: nft_verdicts)
* @NFTA_TRACE_ID: pseudo-id, same for each skb traced (NLA_U32)
* @NFTA_TRACE_LL_HEADER: linklayer header (NLA_BINARY)
* @NFTA_TRACE_NETWORK_HEADER: network header (NLA_BINARY)
* @NFTA_TRACE_TRANSPORT_HEADER: transport header (NLA_BINARY)
* @NFTA_TRACE_IIF: indev ifindex (NLA_U32)
* @NFTA_TRACE_IIFTYPE: netdev->type of indev (NLA_U16)
* @NFTA_TRACE_OIF: outdev ifindex (NLA_U32)
* @NFTA_TRACE_OIFTYPE: netdev->type of outdev (NLA_U16)
* @NFTA_TRACE_MARK: nfmark (NLA_U32)
* @NFTA_TRACE_NFPROTO: nf protocol processed (NLA_U32)
* @NFTA_TRACE_POLICY: policy that decided fate of packet (NLA_U32)
*/
enum nft_trace_attibutes {
NFTA_TRACE_UNSPEC,
NFTA_TRACE_TABLE,
NFTA_TRACE_CHAIN,
NFTA_TRACE_RULE_HANDLE,
NFTA_TRACE_TYPE,
NFTA_TRACE_VERDICT,
NFTA_TRACE_ID,
NFTA_TRACE_LL_HEADER,
NFTA_TRACE_NETWORK_HEADER,
NFTA_TRACE_TRANSPORT_HEADER,
NFTA_TRACE_IIF,
NFTA_TRACE_IIFTYPE,
NFTA_TRACE_OIF,
NFTA_TRACE_OIFTYPE,
NFTA_TRACE_MARK,
NFTA_TRACE_NFPROTO,
NFTA_TRACE_POLICY,
__NFTA_TRACE_MAX
};
#define NFTA_TRACE_MAX (__NFTA_TRACE_MAX - 1)

enum nft_trace_types {
NFT_TRACETYPE_UNSPEC,
NFT_TRACETYPE_POLICY,
NFT_TRACETYPE_RETURN,
NFT_TRACETYPE_RULE,
__NFT_TRACETYPE_MAX
};
#define NFT_TRACETYPE_MAX (__NFT_TRACETYPE_MAX - 1)
#endif /* _LINUX_NF_TABLES_H */
2 changes: 2 additions & 0 deletions include/uapi/linux/netfilter/nfnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ enum nfnetlink_groups {
#define NFNLGRP_NFTABLES NFNLGRP_NFTABLES
NFNLGRP_ACCT_QUOTA,
#define NFNLGRP_ACCT_QUOTA NFNLGRP_ACCT_QUOTA
NFNLGRP_NFTRACE,
#define NFNLGRP_NFTRACE NFNLGRP_NFTRACE
__NFNLGRP_MAX,
};
#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/netfilter/xt_HMARK.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define XT_HMARK_H_

#include <linux/types.h>
#include <linux/netfilter.h>

enum {
XT_HMARK_SADDR_MASK,
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/netfilter/xt_RATEEST.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _XT_RATEEST_TARGET_H

#include <linux/types.h>
#include <linux/if.h>

struct xt_rateest_target_info {
char name[IFNAMSIZ];
Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/netfilter/xt_TEE.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _XT_TEE_TARGET_H
#define _XT_TEE_TARGET_H

#include <linux/netfilter.h>

struct xt_tee_tginfo {
union nf_inet_addr gw;
char oif[16];
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/netfilter/xt_TPROXY.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _XT_TPROXY_H

#include <linux/types.h>
#include <linux/netfilter.h>

/* TPROXY target is capable of marking the packet to perform
* redirection. We can get rid of that whenever we get support for
Expand Down
15 changes: 14 additions & 1 deletion include/uapi/linux/netfilter/xt_cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@
#define _UAPI_XT_CGROUP_H

#include <linux/types.h>
#include <linux/limits.h>

struct xt_cgroup_info {
struct xt_cgroup_info_v0 {
__u32 id;
__u32 invert;
};

struct xt_cgroup_info_v1 {
__u8 has_path;
__u8 has_classid;
__u8 invert_path;
__u8 invert_classid;
char path[PATH_MAX];
__u32 classid;

/* kernel internal data */
void *priv __attribute__((aligned(8)));
};

#endif /* _UAPI_XT_CGROUP_H */
1 change: 1 addition & 0 deletions include/uapi/linux/netfilter/xt_hashlimit.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _UAPI_XT_HASHLIMIT_H

#include <linux/types.h>
#include <linux/if.h>

/* timings are in milliseconds. */
#define XT_HASHLIMIT_SCALE 10000
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/netfilter/xt_ipvs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define _XT_IPVS_H

#include <linux/types.h>
#include <linux/netfilter.h>

enum {
XT_IPVS_IPVS_PROPERTY = 1 << 0, /* all other options imply this one */
Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/netfilter/xt_mac.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _XT_MAC_H
#define _XT_MAC_H

#include <linux/if_ether.h>

struct xt_mac_info {
unsigned char srcaddr[ETH_ALEN];
int invert;
Expand Down
2 changes: 2 additions & 0 deletions include/uapi/linux/netfilter/xt_osf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define _XT_OSF_H

#include <linux/types.h>
#include <linux/ip.h>
#include <linux/tcp.h>

#define MAXGENRELEN 32

Expand Down
2 changes: 1 addition & 1 deletion include/uapi/linux/netfilter/xt_physdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _UAPI_XT_PHYSDEV_H

#include <linux/types.h>

#include <linux/if.h>

#define XT_PHYSDEV_OP_IN 0x01
#define XT_PHYSDEV_OP_OUT 0x02
Expand Down
Loading

0 comments on commit 59ce967

Please sign in to comment.