Skip to content

Commit 0265ab4

Browse files
Jan Engelhardtdavem330
authored andcommitted
[NETFILTER]: merge ipt_owner/ip6t_owner in xt_owner
xt_owner merges ipt_owner and ip6t_owner, and adds a flag to match on socket (non-)existence. Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9e67d5a commit 0265ab4

File tree

11 files changed

+237
-194
lines changed

11 files changed

+237
-194
lines changed

include/linux/netfilter/Kbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ header-y += xt_limit.h
2626
header-y += xt_mac.h
2727
header-y += xt_mark.h
2828
header-y += xt_multiport.h
29+
header-y += xt_owner.h
2930
header-y += xt_pkttype.h
3031
header-y += xt_policy.h
3132
header-y += xt_realm.h

include/linux/netfilter/xt_owner.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef _XT_OWNER_MATCH_H
2+
#define _XT_OWNER_MATCH_H
3+
4+
enum {
5+
XT_OWNER_UID = 1 << 0,
6+
XT_OWNER_GID = 1 << 1,
7+
XT_OWNER_SOCKET = 1 << 2,
8+
};
9+
10+
struct xt_owner_match_info {
11+
u_int32_t uid;
12+
u_int32_t gid;
13+
u_int8_t match, invert;
14+
};
15+
16+
#endif /* _XT_OWNER_MATCH_H */

net/ipv4/netfilter/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,6 @@ config IP_NF_MATCH_TTL
111111

112112
To compile it as a module, choose M here. If unsure, say N.
113113

114-
config IP_NF_MATCH_OWNER
115-
tristate "Owner match support"
116-
depends on IP_NF_IPTABLES
117-
help
118-
Packet owner matching allows you to match locally-generated packets
119-
based on who created them: the user, group, process or session.
120-
121-
To compile it as a module, choose M here. If unsure, say N.
122-
123114
config IP_NF_MATCH_ADDRTYPE
124115
tristate 'address type match support'
125116
depends on IP_NF_IPTABLES

net/ipv4/netfilter/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ obj-$(CONFIG_IP_NF_MATCH_ADDRTYPE) += ipt_addrtype.o
4545
obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o
4646
obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o
4747
obj-$(CONFIG_IP_NF_MATCH_IPRANGE) += ipt_iprange.o
48-
obj-$(CONFIG_IP_NF_MATCH_OWNER) += ipt_owner.o
4948
obj-$(CONFIG_IP_NF_MATCH_RECENT) += ipt_recent.o
5049
obj-$(CONFIG_IP_NF_MATCH_TOS) += ipt_tos.o
5150
obj-$(CONFIG_IP_NF_MATCH_TTL) += ipt_ttl.o

net/ipv4/netfilter/ipt_owner.c

Lines changed: 0 additions & 87 deletions
This file was deleted.

net/ipv6/netfilter/Kconfig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,6 @@ config IP6_NF_MATCH_HL
8989

9090
To compile it as a module, choose M here. If unsure, say N.
9191

92-
config IP6_NF_MATCH_OWNER
93-
tristate "Owner match support"
94-
depends on IP6_NF_IPTABLES
95-
help
96-
Packet owner matching allows you to match locally-generated packets
97-
based on who created them: the user, group, process or session.
98-
99-
To compile it as a module, choose M here. If unsure, say N.
100-
10192
config IP6_NF_MATCH_IPV6HEADER
10293
tristate "IPv6 Extension Headers Match"
10394
depends on IP6_NF_IPTABLES

net/ipv6/netfilter/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o
2323
obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) += ip6t_ipv6header.o
2424
obj-$(CONFIG_IP6_NF_MATCH_MH) += ip6t_mh.o
2525
obj-$(CONFIG_IP6_NF_MATCH_OPTS) += ip6t_hbh.o
26-
obj-$(CONFIG_IP6_NF_MATCH_OWNER) += ip6t_owner.o
2726
obj-$(CONFIG_IP6_NF_MATCH_RT) += ip6t_rt.o
2827

2928
# targets

net/ipv6/netfilter/ip6t_owner.c

Lines changed: 0 additions & 87 deletions
This file was deleted.

net/netfilter/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,14 @@ config NETFILTER_XT_MATCH_MARK
554554

555555
To compile it as a module, choose M here. If unsure, say N.
556556

557+
config NETFILTER_XT_MATCH_OWNER
558+
tristate '"owner" match support'
559+
depends on NETFILTER_XTABLES
560+
---help---
561+
Socket owner matching allows you to match locally-generated packets
562+
based on who created the socket: the user or group. It is also
563+
possible to check whether a socket actually exists.
564+
557565
config NETFILTER_XT_MATCH_POLICY
558566
tristate 'IPsec "policy" match support'
559567
depends on NETFILTER_XTABLES && XFRM

net/netfilter/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_LIMIT) += xt_limit.o
6767
obj-$(CONFIG_NETFILTER_XT_MATCH_MAC) += xt_mac.o
6868
obj-$(CONFIG_NETFILTER_XT_MATCH_MARK) += xt_mark.o
6969
obj-$(CONFIG_NETFILTER_XT_MATCH_MULTIPORT) += xt_multiport.o
70+
obj-$(CONFIG_NETFILTER_XT_MATCH_OWNER) += xt_owner.o
7071
obj-$(CONFIG_NETFILTER_XT_MATCH_PHYSDEV) += xt_physdev.o
7172
obj-$(CONFIG_NETFILTER_XT_MATCH_PKTTYPE) += xt_pkttype.o
7273
obj-$(CONFIG_NETFILTER_XT_MATCH_POLICY) += xt_policy.o

0 commit comments

Comments
 (0)