netfilter/IPVS updates for net-next
Subsystems (8)
Pablo Neira Ayuso
maintainercover netfilter/IPVS updates for net-next
Hi David,
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.
You can pull these changes from:
Daniel Borkmann (4):
netfilter: nf_nat: add full port randomization support
net: net_cls: move cgroupfs classid handling into core
net: netprio: rename config to be more consistent with cgroup configs
netfilter: x_tables: lightweight process control group matching
Eric Leblond (1):
netfilter: xt_CT: fix error value in xt_ct_tg_check()
Florian Westphal (2):
netfilter: avoid get_random_bytes calls
netfilter: ctnetlink: honor CTA_MARK_MASK when setting ctmark
Geert Uytterhoeven (1):
ipvs: Remove unused variable ret from sync_thread_master()
Valentina Giusti (1):
netfilter: nfnetlink_queue: enable UID/GID socket info retrieval
fan.du (1):
netfilter: add IPv4/6 IPComp extension match support
stephen hemminger (2):
netfilter: ipset: remove unused code
netfilter: nf_conntrack: remove dead code
Documentation/cgroups/net_cls.txt | 5 + include/linux/cgroup_subsys.h | 4 +- include/linux/netdevice.h | 2 +- include/linux/netfilter/ipset/ip_set.h | 1 - include/net/cls_cgroup.h | 40 +++----- include/net/netfilter/ipv4/nf_conntrack_ipv4.h | 2 - include/net/netfilter/nf_conntrack_l3proto.h | 1 - include/net/netprio_cgroup.h | 18 ++-- include/net/sock.h | 2 +- include/uapi/linux/netfilter/Kbuild | 2 + include/uapi/linux/netfilter/nf_nat.h | 12 ++- include/uapi/linux/netfilter/nfnetlink_queue.h | 5 +- include/uapi/linux/netfilter/xt_cgroup.h | 11 +++ include/uapi/linux/netfilter/xt_ipcomp.h | 16 ++++ net/Kconfig | 11 ++- net/core/Makefile | 3 +- net/core/dev.c | 2 +- net/core/netclassid_cgroup.c | 120 ++++++++++++++++++++++++ net/core/sock.c | 14 +-- net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 6 -- net/netfilter/Kconfig | 19 ++++ net/netfilter/Makefile | 2 + net/netfilter/ipset/ip_set_core.c | 28 ------ net/netfilter/ipvs/ip_vs_sync.c | 5 +- net/netfilter/nf_conntrack_core.c | 15 --- net/netfilter/nf_conntrack_netlink.c | 12 ++- net/netfilter/nf_conntrack_proto.c | 6 -- net/netfilter/nf_nat_core.c | 4 +- net/netfilter/nf_nat_proto_common.c | 10 +- net/netfilter/nfnetlink_log.c | 8 -- net/netfilter/nfnetlink_queue_core.c | 34 +++++++ net/netfilter/nft_hash.c | 2 +- net/netfilter/xt_CT.c | 4 +- net/netfilter/xt_RATEEST.c | 2 +- net/netfilter/xt_cgroup.c | 71 ++++++++++++++ net/netfilter/xt_connlimit.c | 2 +- net/netfilter/xt_hashlimit.c | 2 +- net/netfilter/xt_ipcomp.c | 111 ++++++++++++++++++++++ net/netfilter/xt_recent.c | 2 +- net/sched/Kconfig | 1 + net/sched/cls_cgroup.c | 111 +--------------------- 41 files changed, 470 insertions(+), 258 deletions(-) create mode 100644 include/uapi/linux/netfilter/xt_cgroup.h create mode 100644 include/uapi/linux/netfilter/xt_ipcomp.h create mode 100644 net/core/netclassid_cgroup.c create mode 100644 net/netfilter/xt_cgroup.c create mode 100644 net/netfilter/xt_ipcomp.c
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 1/12 netfilter: avoid get_random_bytes calls
From: Florian Westphal <[email protected]>
All these users need an initial seed value for jhash, prandom is perfectly fine. This avoids draining the entropy pool where its not strictly required.
nfnetlink_log did not use the random value at all.
--- net/netfilter/nfnetlink_log.c | 8 -------- net/netfilter/nft_hash.c | 2 +- net/netfilter/xt_RATEEST.c | 2 +- net/netfilter/xt_connlimit.c | 2 +- net/netfilter/xt_hashlimit.c | 2 +- net/netfilter/xt_recent.c | 2 +- 6 files changed, 5 insertions(+), 13 deletions(-)
net/netfilter/nfnetlink_log.c +0 -8
@@ -28,8 +28,6 @@#include <linux/proc_fs.h> #include <linux/security.h> #include <linux/list.h> -#include <linux/jhash.h> -#include <linux/random.h> #include <linux/slab.h> #include <net/sock.h> #include <net/netfilter/nf_log.h>
@@ -75,7 +73,6 @@ struct nfulnl_instance { };#define INSTANCE_BUCKETS 16 -static unsigned int hash_init;static int nfnl_log_net_id__read_mostly ;
@@ -1066,11 +1063,6 @@ static int __init nfnetlink_log_init(void) {int status = -ENOMEM ; -/* it's not really all that important to have a random value, so -* we can do this from the init function, even if there hasn't -* been that much entropy yet */ -get_random_bytes (&hash_init,sizeof (hash_init)); -netlink_register_notifier (&nfulnl_rtnl_notifier); status =nfnetlink_subsys_register (&nfulnl_subsys);if (status <0 ) {
net/netfilter/nft_hash.c +1 -1
@@ -164,7 +164,7 @@ static int nft_hash_init(const struct nft_set *set,unsigned int cnt, i;if (unlikely (!nft_hash_rnd_initted)) { -get_random_bytes (&nft_hash_rnd,4 ); + nft_hash_rnd =prandom_u32 (); nft_hash_rnd_initted = true; }
net/netfilter/xt_RATEEST.c +1 -1
@@ -100,7 +100,7 @@ static int xt_rateest_tg_checkentry(const struct xt_tgchk_param *par)int ret;if (unlikely (!rnd_inited)) { -get_random_bytes (&jhash_rnd,sizeof (jhash_rnd)); + jhash_rnd =prandom_u32 (); rnd_inited = true; }
net/netfilter/xt_connlimit.c +1 -1
@@ -229,7 +229,7 @@ static int connlimit_mt_check(const struct xt_mtchk_param *par)u_int32_t rand;do { -get_random_bytes (&rand,sizeof (rand)); + rand =prandom_u32 (); }while (!rand);cmpxchg (&connlimit_rnd,0 , rand); }
net/netfilter/xt_hashlimit.c +1 -1
@@ -177,7 +177,7 @@ dsthash_alloc_init(struct xt_hashlimit_htable *ht,/* initialize hash with random val at the time we allocate * the first hashtable entry */ if (unlikely (!ht->rnd_initialized)) { -get_random_bytes (&ht->rnd,sizeof (ht->rnd)); + ht->rnd =prandom_u32 (); ht->rnd_initialized = true; }
net/netfilter/xt_recent.c +1 -1
@@ -334,7 +334,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,size_t sz;if (unlikely (!hash_rnd_inited)) { -get_random_bytes (&hash_rnd,sizeof (hash_rnd)); + hash_rnd =prandom_u32 (); hash_rnd_inited = true; }if (info->check_set & ~XT_RECENT_VALID_FLAGS ) {
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 2/12 netfilter: ctnetlink: honor CTA_MARK_MASK when setting ctmark
In reply to Pablo Neira AyusoFrom: Florian Westphal <[email protected]>
Useful to only set a particular range of the conntrack mark while leaving exisiting parts of the value alone, e.g. when setting conntrack marks via NFQUEUE.
Follows same scheme as MARK/CONNMARK targets, i.e. the mask defines those bits that should be altered. No mask is equal to '~0', ie. the old value is replaced by new one.
--- net/netfilter/nf_conntrack_netlink.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_netlink.c +10 -2
@@ -2118,8 +2118,16 @@ ctnetlink_nfqueue_parse_ct(const struct nlattr *cda[], struct nf_conn *ct)return err; }#if defined(CONFIG_NF_CONNTRACK_MARK ) -if (cda[CTA_MARK ]) - ct->mark =ntohl (nla_get_be32 (cda[CTA_MARK ])); +if (cda[CTA_MARK ]) { +u32 mask =0 , mark, newmark; +if (cda[CTA_MARK_MASK ]) + mask = ~ntohl (nla_get_be32 (cda[CTA_MARK_MASK ])); + + mark =ntohl (nla_get_be32 (cda[CTA_MARK ])); + newmark = (ct->mark & mask) ^ mark; +if (newmark != ct->mark) + ct->mark = newmark; + }#endif return 0 ; }
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 3/12 netfilter: nfnetlink_queue: enable UID/GID socket info retrieval
In reply to Pablo Neira AyusoFrom: Valentina Giusti <[email protected]>
Thanks to commits 41063e9 (ipv4: Early TCP socket demux) and 421b388 (udp: ipv4: Add udp early demux) it is now possible to parse UID and GID socket info also for incoming TCP and UDP connections. Having this info available, it is convenient to let NFQUEUE parse it in order to improve and refine the traffic analysis in userspace.
--- include/uapi/linux/netfilter/nfnetlink_queue.h | 5 +++- net/netfilter/nfnetlink_queue_core.c | 34 ++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-)
include/uapi/linux/netfilter/nfnetlink_queue.h +4 -1
@@ -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 */
net/netfilter/nfnetlink_queue_core.c +34 -0
@@ -297,6 +297,31 @@ nfqnl_put_packet_info(struct sk_buff *nlskb, struct sk_buff *packet,return flags ?nla_put_be32 (nlskb,NFQA_SKB_INFO ,htonl (flags)) :0 ; } +static int nfqnl_put_sk_uidgid (struct sk_buff *skb,struct sock *sk) +{ +const struct cred *cred; + +if (sk->sk_state ==TCP_TIME_WAIT ) +return 0 ; + +read_lock_bh (&sk->sk_callback_lock); +if (sk->sk_socket && sk->sk_socket->file) { + cred = sk->sk_socket->file->f_cred; +if (nla_put_be32 (skb,NFQA_UID , +htonl (from_kuid_munged (&init_user_ns, cred->fsuid)))) + goto nla_put_failure; +if (nla_put_be32 (skb,NFQA_GID , +htonl (from_kgid_munged (&init_user_ns, cred->fsgid)))) + goto nla_put_failure; + } +read_unlock_bh (&sk->sk_callback_lock); +return 0 ; + +nla_put_failure: +read_unlock_bh (&sk->sk_callback_lock); +return -1 ; +} +static struct sk_buff * nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, struct nf_queue_entry *entry,
@@ -372,6 +397,11 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue,if (queue->flags &NFQA_CFG_F_CONNTRACK ) ct =nfqnl_ct_get (entskb, &size, &ctinfo); +if (queue->flags &NFQA_CFG_F_UID_GID ) { + size += (nla_total_size (sizeof (u_int32_t))/* uid */ + +nla_total_size (sizeof (u_int32_t)));/* gid */ + } + skb =nfnetlink_alloc_skb (net, size, queue->peer_portid,GFP_ATOMIC );if (!skb)
@@ -484,6 +514,10 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, goto nla_put_failure; } +if ((queue->flags &NFQA_CFG_F_UID_GID ) && entskb->sk && +nfqnl_put_sk_uidgid (skb, entskb->sk) <0 ) + goto nla_put_failure; +if (ct &&nfqnl_ct_put (skb, ct, ctinfo) <0 ) goto nla_put_failure;
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 4/12 netfilter: add IPv4/6 IPComp extension match support
In reply to Pablo Neira AyusoFrom: "fan.du" <[email protected]>
With this plugin, user could specify IPComp tagged with certain CPI that host not interested will be DROPped or any other action.
For example:
iptables -A INPUT -p 108 -m ipcomp --ipcompspi 0x87 -j DROP ip6tables -A INPUT -p 108 -m ipcomp --ipcompspi 0x87 -j DROP
Then input IPComp packet with CPI equates 0x87 will not reach upper layer anymore.
--- include/uapi/linux/netfilter/Kbuild | 1 + include/uapi/linux/netfilter/xt_ipcomp.h | 16 +++++ net/netfilter/Kconfig | 9 +++ net/netfilter/Makefile | 1 + net/netfilter/xt_ipcomp.c | 111 ++++++++++++++++++++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 include/uapi/linux/netfilter/xt_ipcomp.h create mode 100644 net/netfilter/xt_ipcomp.c
include/uapi/linux/netfilter/Kbuild +1 -0
@@ -54,6 +54,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
include/uapi/linux/netfilter/xt_ipcomp.h new file +16 -0
@@ -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*/
net/netfilter/Kconfig +9 -0
@@ -1035,6 +1035,15 @@ config NETFILTER_XT_MATCH_HL in the IPv6 header, or the time-to-live field in the IPv4 header of the packet. +config NETFILTER_XT_MATCH_IPCOMP + tristate '"ipcomp" match support' + depends on NETFILTER_ADVANCED + help + This match extension allows you to match a range of CPIs(16 bits) + inside IPComp header of IPSec packets. + + To compile it as a module, choose M here. If unsure, say N. + config NETFILTER_XT_MATCH_IPRANGE tristate '"iprange" address range match support' depends on NETFILTER_ADVANCED
net/netfilter/Makefile +1 -0
@@ -133,6 +133,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += xt_esp.o obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o obj-$(CONFIG_NETFILTER_XT_MATCH_HL) += xt_hl.o +obj-$(CONFIG_NETFILTER_XT_MATCH_IPCOMP) += xt_ipcomp.o obj-$(CONFIG_NETFILTER_XT_MATCH_IPRANGE) += xt_iprange.o obj-$(CONFIG_NETFILTER_XT_MATCH_IPVS) += xt_ipvs.o obj-$(CONFIG_NETFILTER_XT_MATCH_LENGTH) += xt_length.o
net/netfilter/xt_ipcomp.c new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 5/12 ipvs: Remove unused variable ret from sync_thread_master()
In reply to Pablo Neira AyusoFrom: Geert Uytterhoeven <[email protected]>
net/netfilter/ipvs/ip_vs_sync.c: In function 'sync_thread_master':net/netfilter/ipvs/ip_vs_sync.c:1640:8: warning: unused variable 'ret' [-Wunused-variable]
Commit 35a2af94c7ce7130ca292c68b1d27fcfdb648f6b ("sched/wait: Make the __wait_event*() interface more friendly") changed how the interruption state is returned. However, sync_thread_master() ignores this state, now causing a compile warning.
According to Julian Anastasov <[email protected]>, this behavior is OK:
"Yes, your patch looks ok to me. In the past we used ssleep() but IPVS
users were confused why IPVS threads increase the load average. So, we switched to _interruptible calls and later the socket polling was added."
Document this, as requested by Peter Zijlstra, to avoid precious developers disappearing in this pitfall in the future.
--- net/netfilter/ipvs/ip_vs_sync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/netfilter/ipvs/ip_vs_sync.c +4 -1
@@ -1637,7 +1637,10 @@ static int sync_thread_master(void *data)continue ; }while (ip_vs_send_sync_msg (tinfo->sock, sb->mesg) <0 ) { -int ret =__wait_event_interruptible (*sk_sleep (sk), +/* (Ab)use interruptible sleep to avoid increasing +* the load avg. +*/ +__wait_event_interruptible (*sk_sleep (sk),sock_writeable (sk) ||kthread_should_stop ());if (unlikely (kthread_should_stop ()))
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 6/12 netfilter: nf_nat: add full port randomization support
In reply to Pablo Neira AyusoFrom: Daniel Borkmann <[email protected]>
We currently use prandom_u32() for allocation of ports in tcp bind(0) and udp code. In case of plain SNAT we try to keep the ports as is or increment on collision.
SNAT --random mode does use per-destination incrementing port allocation. As a recent paper pointed out in [1] that this mode of port allocation makes it possible to an attacker to find the randomly allocated ports through a timing side-channel in a socket overloading attack conducted through an off-path attacker.
So, NF_NAT_RANGE_PROTO_RANDOM actually weakens the port randomization in regard to the attack described in this paper. As we need to keep compatibility, add another flag called NF_NAT_RANGE_PROTO_RANDOM_FULLY that would replace the NF_NAT_RANGE_PROTO_RANDOM hash-based port selection algorithm with a simple prandom_u32() in order to mitigate this attack vector. Note that the lfsr113's internal state is periodically reseeded by the kernel through a local secure entropy source.
More details can be found in [1], the basic idea is to send bursts of packets to a socket to overflow its receive queue and measure the latency to detect a possible retransmit when the port is found. Because of increasing ports to given destination and port, further allocations can be predicted. This information could then be used by an attacker for e.g. for cache-poisoning, NS pinning, and degradation of service attacks against DNS servers [1]:
The best defense against the poisoning attacks is to properly deploy and validate DNSSEC; DNSSEC provides security not only against off-path attacker but even against MitM attacker. We hope that our results will help motivate administrators to adopt DNSSEC. However, full DNSSEC deployment make take significant time, and until that happens, we recommend short-term, non-cryptographic defenses. We recommend to support full port randomisation, according to practices recommended in [2], and to avoid per-destination sequential port allocation, which we show may be vulnerable to derandomisation attacks.
Joint work between Hannes Frederic Sowa and Daniel Borkmann.
[1] https://sites.google.com/site/hayashulman/files/NIC-derandomisation.pdf
[2] http://arxiv.org/pdf/1205.5190v1.pdf
--- include/uapi/linux/netfilter/nf_nat.h | 12 ++++++++---- net/netfilter/nf_nat_core.c | 4 ++-- net/netfilter/nf_nat_proto_common.c | 10 ++++++---- 3 files changed, 16 insertions(+), 10 deletions(-)
include/uapi/linux/netfilter/nf_nat.h +8 -4
@@ -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;
net/netfilter/nf_nat_core.c +2 -2
@@ -315,7 +315,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple,* manips not an issue. */ if (maniptype ==NF_NAT_MANIP_SRC && - !(range->flags &NF_NAT_RANGE_PROTO_RANDOM )) { + !(range->flags &NF_NAT_RANGE_PROTO_RANDOM_ALL )) {/* try the original tuple first */ if (in_range (l3proto, l4proto, orig_tuple, range)) {if (!nf_nat_used_tuple (orig_tuple, ct)) {
@@ -339,7 +339,7 @@ get_unique_tuple(struct nf_conntrack_tuple *tuple,*/ /* Only bother mapping if it's not already in range and unique */ -if (!(range->flags &NF_NAT_RANGE_PROTO_RANDOM )) { +if (!(range->flags &NF_NAT_RANGE_PROTO_RANDOM_ALL )) {if (range->flags &NF_NAT_RANGE_PROTO_SPECIFIED ) { if (l4proto->in_range(tuple, maniptype, &range->min_proto,
net/netfilter/nf_nat_proto_common.c +6 -4
@@ -74,22 +74,24 @@ void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto, range_size =ntohs (range->max_proto.all) - min +1 ; } -if (range->flags &NF_NAT_RANGE_PROTO_RANDOM ) +if (range->flags &NF_NAT_RANGE_PROTO_RANDOM ) { off = l3proto->secure_port (tuple, maniptype ==NF_NAT_MANIP_SRC ? tuple->dst.u.all : tuple->src.u.all); -else + }else if (range->flags &NF_NAT_RANGE_PROTO_RANDOM_FULLY ) { + off =prandom_u32 (); + }else { off = *rover; + }for (i =0 ; ; ++off) { *portptr =htons (min + off % range_size);if (++i != range_size &&nf_nat_used_tuple (tuple, ct))continue ; -if (!(range->flags &NF_NAT_RANGE_PROTO_RANDOM )) +if (!(range->flags &NF_NAT_RANGE_PROTO_RANDOM_ALL )) *rover = off;return ; } -return ; }EXPORT_SYMBOL_GPL (nf_nat_l4proto_unique_tuple);
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 7/12 netfilter: ipset: remove unused code
In reply to Pablo Neira AyusoFrom: stephen hemminger <[email protected]>
Function never used in current upstream code.
--- include/linux/netfilter/ipset/ip_set.h | 1 - net/netfilter/ipset/ip_set_core.c | 28 ---------------------------- 2 files changed, 29 deletions(-)
include/linux/netfilter/ipset/ip_set.h +0 -1
@@ -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);
net/netfilter/ipset/ip_set_core.c +0 -28
@@ -625,34 +625,6 @@ EXPORT_SYMBOL_GPL(ip_set_name_byindex);*/ /* -* Find set by name, reference it once. The reference makes sure the -* thing pointed to, does not go away under our feet. -* -* The nfnl mutex is used in the function. -*/ -ip_set_id_t -ip_set_nfnl_get (struct net *net,const char *name) -{ -ip_set_id_t i, index =IPSET_INVALID_ID ; -struct ip_set *s; -struct ip_set_net *inst =ip_set_pernet (net); - -nfnl_lock (NFNL_SUBSYS_IPSET ); -for (i =0 ; i < inst->ip_set_max; i++) { - s =nfnl_set (inst, i); -if (s !=NULL &&STREQ (s->name, name)) { -__ip_set_get (s); - index = i; -break ; - } - } -nfnl_unlock (NFNL_SUBSYS_IPSET ); - -return index; -} -EXPORT_SYMBOL_GPL (ip_set_nfnl_get); - -/* * Find set by index, reference it once. The reference makes sure the * thing pointed to, does not go away under our feet. *
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 8/12 netfilter: nf_conntrack: remove dead code
In reply to Pablo Neira AyusoFrom: stephen hemminger <[email protected]>
The following code is not used in current upstream code. Some of this seems to be old hooks, other might be used by some out of tree module (which I don't care about breaking), and the need_ipv4_conntrack was used by old NAT code but no longer called.
--- include/net/netfilter/ipv4/nf_conntrack_ipv4.h | 2 -- include/net/netfilter/nf_conntrack_l3proto.h | 1 - net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c | 6 ------ net/netfilter/nf_conntrack_core.c | 15 --------------- net/netfilter/nf_conntrack_proto.c | 6 ------ 5 files changed, 30 deletions(-)
include/net/netfilter/ipv4/nf_conntrack_ipv4.h +0 -2
@@ -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*/
include/net/netfilter/nf_conntrack_l3proto.h +0 -1
@@ -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;
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c +0 -6
@@ -548,9 +548,3 @@ static void __exit nf_conntrack_l3proto_ipv4_fini(void)module_init (nf_conntrack_l3proto_ipv4_init);module_exit (nf_conntrack_l3proto_ipv4_fini); - -void need_ipv4_conntrack (void ) -{ -return ; -} -EXPORT_SYMBOL_GPL (need_ipv4_conntrack);
net/netfilter/nf_conntrack_core.c +0 -15
@@ -60,12 +60,6 @@ int (*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct, const struct nlattr *attr) __read_mostly;EXPORT_SYMBOL_GPL (nfnetlink_parse_nat_setup_hook); -int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb, -struct nf_conn *ct, -enum ip_conntrack_info ctinfo, -unsigned int protoff); -EXPORT_SYMBOL_GPL (nf_nat_seq_adjust_hook); -DEFINE_SPINLOCK (nf_conntrack_lock);EXPORT_SYMBOL_GPL (nf_conntrack_lock);
@@ -361,15 +355,6 @@ begin:return NULL ; } -struct nf_conntrack_tuple_hash * -__nf_conntrack_find (struct net *net,u16 zone, -const struct nf_conntrack_tuple *tuple) -{ -return ____nf_conntrack_find (net, zone, tuple, -hash_conntrack_raw (tuple, zone)); -} -EXPORT_SYMBOL_GPL (__nf_conntrack_find); -/* Find a connection corresponding to a tuple. */ static struct nf_conntrack_tuple_hash * __nf_conntrack_find_get(struct net *net, u16 zone,
net/netfilter/nf_conntrack_proto.c +0 -6
@@ -92,12 +92,6 @@ nf_ct_l3proto_find_get(u_int16_t l3proto) }EXPORT_SYMBOL_GPL (nf_ct_l3proto_find_get); -void nf_ct_l3proto_put (struct nf_conntrack_l3proto *p) -{ -module_put (p->me); -} -EXPORT_SYMBOL_GPL (nf_ct_l3proto_put); -int nf_ct_l3proto_try_module_get (unsigned short l3proto) {
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 9/12 netfilter: xt_CT: fix error value in xt_ct_tg_check()
In reply to Pablo Neira AyusoFrom: Eric Leblond <[email protected]>
If setting event mask fails then we were returning 0 for success. This patch updates return code to -EINVAL in case of problem.
--- net/netfilter/xt_CT.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/xt_CT.c +3 -1
@@ -211,8 +211,10 @@ static int xt_ct_tg_check(const struct xt_tgchk_param *par, ret =0 ;if ((info->ct_events || info->exp_events) && !nf_ct_ecache_ext_add (ct, info->ct_events, info->exp_events, -GFP_KERNEL )) +GFP_KERNEL )) { + ret = -EINVAL ; goto err3; + }if (info->helper[0 ]) { ret =xt_ct_set_helper (ct, info->helper, par);
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 10/12 net: net_cls: move cgroupfs classid handling into core
In reply to Pablo Neira AyusoFrom: Daniel Borkmann <[email protected]>
Zefan Li requested [1] to perform the following cleanup/refactoring:
- Split cgroupfs classid handling into net core to better express a possible more generic use.
- Disable module support for cgroupfs bits as the majority of other cgroupfs subsystems do not have that, and seems to be not wished from cgroup side. Zefan probably might want to follow-up for netprio later on.
- By this, code can be further reduced which previously took care of functionality built when compiled as module.
cgroupfs bits are being placed under net/core/netclassid_cgroup.c, so that we are consistent with {netclassid,netprio}_cgroup naming that is under net/core/ as suggested by Zefan.
No change in functionality, but only code refactoring that is being done here.
[1] http://patchwork.ozlabs.org/patch/304825/
--- include/linux/cgroup_subsys.h | 2 +- include/net/cls_cgroup.h | 40 +++++--------- net/Kconfig | 7 +++ net/core/Makefile | 1 + net/core/netclassid_cgroup.c | 120 +++++++++++++++++++++++++++++++++++++++++ net/core/sock.c | 12 ----- net/sched/Kconfig | 1 + net/sched/cls_cgroup.c | 111 +------------------------------------- 8 files changed, 143 insertions(+), 151 deletions(-) create mode 100644 net/core/netclassid_cgroup.c
include/linux/cgroup_subsys.h +1 -1
@@ -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
include/net/cls_cgroup.h +12 -28
@@ -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) -{ -struct cgroup_subsys_state *css; -u32 classid =0 ; - -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; -} -#endif -#else /* !CGROUP_NET_CLS_CGROUP */ static inline void sock_update_classid (struct sock *sk) { -} +u32 classid; -static inline u32 task_cls_classid (struct task_struct *p) + classid =task_cls_classid (current); +if (classid != sk->sk_classid) + sk->sk_classid = classid; +} +#else /* !CONFIG_CGROUP_NET_CLASSID */ +static inline void sock_update_classid (struct sock *sk) { -return 0 ; } -#endif /* CGROUP_NET_CLS_CGROUP */ +#endif /* CONFIG_CGROUP_NET_CLASSID */ #endif /* _NET_CLS_CGROUP_H */
net/Kconfig +7 -0
@@ -245,6 +245,13 @@ config NETPRIO_CGROUP Cgroup subsystem for use in assigning processes to network priorities on a per-interface basis +config CGROUP_NET_CLASSID + boolean "Network classid cgroup" + depends on CGROUPS + ---help--- + Cgroup subsystem for use as general purpose socket classid marker that is + being used in cls_cgroup and for netfilter matching. + config NET_RX_BUSY_POLL boolean default y
net/core/Makefile +1 -0
@@ -22,3 +22,4 @@ obj-$(CONFIG_TRACEPOINTS) += net-traces.o obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o obj-$(CONFIG_NETPRIO_CGROUP) += netprio_cgroup.o +obj-$(CONFIG_CGROUP_NET_CLASSID) += netclassid_cgroup.o
net/core/netclassid_cgroup.c new file +120 -0
120 lines not on this page · raw message
net/core/sock.c +0 -12
@@ -1308,18 +1308,6 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)module_put (owner); } -#if IS_ENABLED (CONFIG_NET_CLS_CGROUP ) -void sock_update_classid (struct sock *sk) -{ -u32 classid; - - classid =task_cls_classid (current); -if (classid != sk->sk_classid) - sk->sk_classid = classid; -} -EXPORT_SYMBOL (sock_update_classid); -#endif -#if IS_ENABLED (CONFIG_NETPRIO_CGROUP )void sock_update_netprioidx (struct sock *sk) {
net/sched/Kconfig +1 -0
@@ -435,6 +435,7 @@ config NET_CLS_FLOW config NET_CLS_CGROUP tristate "Control Group Classifier" select NET_CLS + select CGROUP_NET_CLASSID depends on CGROUPS ---help--- Say Y here if you want to classify packets based on the control
net/sched/cls_cgroup.c +1 -110
135 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 11/12 net: netprio: rename config to be more consistent with cgroup configs
In reply to Pablo Neira AyusoFrom: Daniel Borkmann <[email protected]>
While we're at it and introduced CGROUP_NET_CLASSID, lets also make NETPRIO_CGROUP more consistent with the rest of cgroups and rename it into CONFIG_CGROUP_NET_PRIO so that for networking, we now have CONFIG_CGROUP_NET_{PRIO,CLASSID}. This not only makes the CONFIG option consistent among networking cgroups, but also among cgroups CONFIG conventions in general as the vast majority has a prefix of CONFIG_CGROUP_<SUBSYS>.
--- include/linux/cgroup_subsys.h | 2 +- include/linux/netdevice.h | 2 +- include/net/netprio_cgroup.h | 18 ++++++------------ include/net/sock.h | 2 +- net/Kconfig | 4 ++-- net/core/Makefile | 2 +- net/core/dev.c | 2 +- net/core/sock.c | 2 +- 8 files changed, 14 insertions(+), 20 deletions(-)
include/linux/cgroup_subsys.h +1 -1
@@ -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
include/linux/netdevice.h +1 -1
@@ -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 */
include/net/netprio_cgroup.h +6 -12
@@ -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 */
include/net/sock.h +1 -1
@@ -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;
net/Kconfig +2 -2
@@ -238,12 +238,12 @@ config XPS depends on SMP default y -config NETPRIO_CGROUP +config CGROUP_NET_PRIO tristate "Network priority cgroup" depends on CGROUPS ---help--- Cgroup subsystem for use in assigning processes to network priorities on - a per-interface basis + a per-interface basis. config CGROUP_NET_CLASSID boolean "Network classid cgroup"
net/core/Makefile +1 -1
@@ -21,5 +21,5 @@ obj-$(CONFIG_FIB_RULES) += fib_rules.o obj-$(CONFIG_TRACEPOINTS) += net-traces.o obj-$(CONFIG_NET_DROP_MONITOR) += drop_monitor.o obj-$(CONFIG_NETWORK_PHY_TIMESTAMPING) += timestamping.o -obj-$(CONFIG_NETPRIO_CGROUP) += netprio_cgroup.o +obj-$(CONFIG_CGROUP_NET_PRIO) += netprio_cgroup.o obj-$(CONFIG_CGROUP_NET_CLASSID) += netclassid_cgroup.o
net/core/dev.c +1 -1
@@ -2747,7 +2747,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,return rc; } -#if IS_ENABLED (CONFIG_NETPRIO_CGROUP ) +#if IS_ENABLED (CONFIG_CGROUP_NET_PRIO )static void skb_update_prio (struct sk_buff *skb) {struct netprio_map *map =rcu_dereference_bh (skb->dev->priomap);
net/core/sock.c +1 -1
@@ -1308,7 +1308,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)module_put (owner); } -#if IS_ENABLED (CONFIG_NETPRIO_CGROUP ) +#if IS_ENABLED (CONFIG_CGROUP_NET_PRIO )void sock_update_netprioidx (struct sock *sk) {if (in_interrupt ())
Signature · 1 line
1.7.10.4
Pablo Neira Ayuso
maintainerPATCH 12/12 netfilter: x_tables: lightweight process control group matching
In reply to Pablo Neira AyusoFrom: Daniel Borkmann <[email protected]>
It would be useful e.g. in a server or desktop environment to have a facility in the notion of fine-grained "per application" or "per application group" firewall policies. Probably, users in the mobile, embedded area (e.g. Android based) with different security policy requirements for application groups could have great benefit from that as well. For example, with a little bit of configuration effort, an admin could whitelist well-known applications, and thus block otherwise unwanted "hard-to-track" applications like [1] from a user's machine. Blocking is just one example, but it is not limited to that, meaning we can have much different scenarios/policies that netfilter allows us than just blocking, e.g. fine grained settings where applications are allowed to connect/send traffic to, application traffic marking/conntracking, application-specific packet mangling, and so on.
Implementation of PID-based matching would not be appropriate as they frequently change, and child tracking would make that even more complex and ugly. Cgroups would be a perfect candidate for accomplishing that as they associate a set of tasks with a set of parameters for one or more subsystems, in our case the netfilter subsystem, which, of course, can be combined with other cgroup subsystems into something more complex if needed.
As mentioned, to overcome this constraint, such processes could be placed into one or multiple cgroups where different fine-grained rules can be defined depending on the application scenario, while e.g. everything else that is not part of that could be dropped (or vice versa), thus making life harder for unwanted processes to communicate to the outside world. So, we make use of cgroups here to track jobs and limit their resources in terms of iptables policies; in other words, limiting, tracking, etc what they are allowed to communicate.
In our case we're working on outgoing traffic based on which local socket that originated from. Also, one doesn't even need to have an a-prio knowledge of the application internals regarding their particular use of ports or protocols. Matching is *extremly* lightweight as we just test for the sk_classid marker of sockets, originating from net_cls. net_cls and netfilter do not contradict each other; in fact, each construct can live as standalone or they can be used in combination with each other, which is perfectly fine, plus it serves Tejun's requirement to not introduce a new cgroups subsystem. Through this, we result in a very minimal and efficient module, and don't add anything except netfilter code.
One possible, minimal usage example (many other iptables options can be applied obviously):
1) Configuring cgroups if not already done, e.g.:
mkdir /sys/fs/cgroup/net_cls
mount -t cgroup -o net_cls net_cls /sys/fs/cgroup/net_cls mkdir /sys/fs/cgroup/net_cls/0
echo 1 > /sys/fs/cgroup/net_cls/0/net_cls.classid (resp. a real flow handle id for tc)
2) Configuring netfilter (iptables-nftables), e.g.:
iptables -A OUTPUT -m cgroup ! --cgroup 1 -j DROP
3) Running applications, e.g.:
ping 208.67.222.222 <pid:1799>
echo 1799 > /sys/fs/cgroup/net_cls/0/tasks
64 bytes from 208.67.222.222: icmp_seq=44 ttl=49 time=11.9 ms [...]
ping 208.67.220.220 <pid:1804>
ping: sendmsg: Operation not permitted
[...]
echo 1804 > /sys/fs/cgroup/net_cls/0/tasks
64 bytes from 208.67.220.220: icmp_seq=89 ttl=56 time=19.0 ms [...]
Of course, real-world deployments would make use of cgroups user space toolsuite, or own custom policy daemons dynamically moving applications from/to various cgroups.
[1] http://www.blackhat.com/presentations/bh-europe-06/bh-eu-06-biondi/bh-eu-06-biondi-up.pdf
--- Documentation/cgroups/net_cls.txt | 5 +++ include/uapi/linux/netfilter/Kbuild | 1 + include/uapi/linux/netfilter/xt_cgroup.h | 11 +++++ net/netfilter/Kconfig | 10 +++++ net/netfilter/Makefile | 1 + net/netfilter/xt_cgroup.c | 71 ++++++++++++++++++++++++++++++ 6 files changed, 99 insertions(+) create mode 100644 include/uapi/linux/netfilter/xt_cgroup.h create mode 100644 net/netfilter/xt_cgroup.c
Documentation/cgroups/net_cls.txt +5 -0
@@ -6,6 +6,8 @@ tag network packets with a class identifier (classid). The Traffic Controller (tc) can be used to assign different priorities to packets from different cgroups. +Also, Netfilter (iptables) can use this tag to perform +actions on such packets. Creating a net_cls cgroups instance creates a net_cls.classid file. This net_cls.classid value is initialized to 0.
@@ -32,3 +34,6 @@ tc class add dev eth0 parent 10: classid 10:1 htb rate 40mbit - creating traffic class 10:1 tc filter add dev eth0 parent 10: protocol ip prio 10 handle 1: cgroup + +configuring iptables, basic example: +iptables -A OUTPUT -m cgroup ! --cgroup 0x100001 -j DROP
include/uapi/linux/netfilter/Kbuild +1 -0
@@ -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
include/uapi/linux/netfilter/xt_cgroup.h new file +11 -0
@@ -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 */
net/netfilter/Kconfig +10 -0
@@ -858,6 +858,16 @@ config NETFILTER_XT_MATCH_BPF To compile it as a module, choose M here. If unsure, say N. +config NETFILTER_XT_MATCH_CGROUP + tristate '"control group" match support' + depends on NETFILTER_ADVANCED + depends on CGROUPS + select CGROUP_NET_CLASSID + ---help--- + Socket/process control group matching allows you to match locally + generated packets based on which net_cls control group processes + belong to. + config NETFILTER_XT_MATCH_CLUSTER tristate '"cluster" match support' depends on NF_CONNTRACK
net/netfilter/Makefile +1 -0
@@ -143,6 +143,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o obj-$(CONFIG_NETFILTER_XT_MATCH_NFACCT) += xt_nfacct.o obj-$(CONFIG_NETFILTER_XT_MATCH_OSF) += xt_osf.o obj-$(CONFIG_NETFILTER_XT_MATCH_OWNER) += xt_owner.o +obj-$(CONFIG_NETFILTER_XT_MATCH_CGROUP) += xt_cgroup.o obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o
net/netfilter/xt_cgroup.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
1.7.10.4
David Miller
maintainerFrom: Pablo Neira Ayuso <[email protected]>
Date: Mon, 6 Jan 2014 00:09:26 +0100
Quoted 3 lines
You can pull these changes from:
Daniel Borkmann (4):
...
I assume you meant to say:
git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git
as the URL rather than just a blank line :-)
Pulled, thanks a lot. But please address the feedback you received wrt. secrets protecting hashes.
Thanks.