Skip to content

Commit d446a82

Browse files
Jan Engelhardtummakynes
authored andcommitted
netfilter: xtables: move ipt_ecn to xt_ecn
Prepare the ECN match for augmentation by an IPv6 counterpart. Since no symbol dependencies to ipv6.ko are added, having a single ecn match module is the more so welcome. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent c0d2b83 commit d446a82

8 files changed

Lines changed: 53 additions & 36 deletions

File tree

‎include/linux/netfilter/Kbuild‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ header-y += xt_cpu.h
4343
header-y += xt_dccp.h
4444
header-y += xt_devgroup.h
4545
header-y += xt_dscp.h
46+
header-y += xt_ecn.h
4647
header-y += xt_esp.h
4748
header-y += xt_hashlimit.h
4849
header-y += xt_helper.h

‎include/linux/netfilter/xt_ecn.h‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* iptables module for matching the ECN header in IPv4 and TCP header
2+
*
3+
* (C) 2002 Harald Welte <laforge@gnumonks.org>
4+
*
5+
* This software is distributed under GNU GPL v2, 1991
6+
*
7+
* ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8+
*/
9+
#ifndef _XT_ECN_H
10+
#define _XT_ECN_H
11+
12+
#include <linux/types.h>
13+
#include <linux/netfilter/xt_dscp.h>
14+
15+
#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
16+
17+
#define IPT_ECN_OP_MATCH_IP 0x01
18+
#define IPT_ECN_OP_MATCH_ECE 0x10
19+
#define IPT_ECN_OP_MATCH_CWR 0x20
20+
21+
#define IPT_ECN_OP_MATCH_MASK 0xce
22+
23+
/* match info */
24+
struct ipt_ecn_info {
25+
__u8 operation;
26+
__u8 invert;
27+
__u8 ip_ect;
28+
union {
29+
struct {
30+
__u8 ect;
31+
} tcp;
32+
} proto;
33+
};
34+
35+
#endif /* _XT_ECN_H */
Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,6 @@
1-
/* iptables module for matching the ECN header in IPv4 and TCP header
2-
*
3-
* (C) 2002 Harald Welte <laforge@gnumonks.org>
4-
*
5-
* This software is distributed under GNU GPL v2, 1991
6-
*
7-
* ipt_ecn.h,v 1.4 2002/08/05 19:39:00 laforge Exp
8-
*/
91
#ifndef _IPT_ECN_H
102
#define _IPT_ECN_H
113

12-
#include <linux/types.h>
13-
#include <linux/netfilter/xt_dscp.h>
14-
15-
#define IPT_ECN_IP_MASK (~XT_DSCP_MASK)
16-
17-
#define IPT_ECN_OP_MATCH_IP 0x01
18-
#define IPT_ECN_OP_MATCH_ECE 0x10
19-
#define IPT_ECN_OP_MATCH_CWR 0x20
20-
21-
#define IPT_ECN_OP_MATCH_MASK 0xce
22-
23-
/* match info */
24-
struct ipt_ecn_info {
25-
__u8 operation;
26-
__u8 invert;
27-
__u8 ip_ect;
28-
union {
29-
struct {
30-
__u8 ect;
31-
} tcp;
32-
} proto;
33-
};
4+
#include <linux/netfilter/xt_ecn.h>
345

356
#endif /* _IPT_ECN_H */

‎net/ipv4/netfilter/Kconfig‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ config IP_NF_MATCH_AH
7676
config IP_NF_MATCH_ECN
7777
tristate '"ecn" match support'
7878
depends on NETFILTER_ADVANCED
79-
help
80-
This option adds a `ECN' match, which allows you to match against
81-
the IPv4 and TCP header ECN fields.
82-
83-
To compile it as a module, choose M here. If unsure, say N.
79+
select NETFILTER_XT_MATCH_ECN
80+
---help---
81+
This is a backwards-compat option for the user's convenience
82+
(e.g. when running oldconfig). It selects
83+
CONFIG_NETFILTER_XT_MATCH_ECN.
8484

8585
config IP_NF_MATCH_RPFILTER
8686
tristate '"rpfilter" reverse path filter match support'

‎net/ipv4/netfilter/Makefile‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ obj-$(CONFIG_IP_NF_SECURITY) += iptable_security.o
4949

5050
# matches
5151
obj-$(CONFIG_IP_NF_MATCH_AH) += ipt_ah.o
52-
obj-$(CONFIG_IP_NF_MATCH_ECN) += ipt_ecn.o
5352
obj-$(CONFIG_IP_NF_MATCH_RPFILTER) += ipt_rpfilter.o
5453

5554
# targets

‎net/netfilter/Kconfig‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,15 @@ config NETFILTER_XT_MATCH_DSCP
778778

779779
To compile it as a module, choose M here. If unsure, say N.
780780

781+
config NETFILTER_XT_MATCH_ECN
782+
tristate '"ecn" match support'
783+
depends on NETFILTER_ADVANCED
784+
---help---
785+
This option adds an "ECN" match, which allows you to match against
786+
the IPv4 and TCP header ECN fields.
787+
788+
To compile it as a module, choose M here. If unsure, say N.
789+
781790
config NETFILTER_XT_MATCH_ESP
782791
tristate '"esp" match support'
783792
depends on NETFILTER_ADVANCED

‎net/netfilter/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_CPU) += xt_cpu.o
8181
obj-$(CONFIG_NETFILTER_XT_MATCH_DCCP) += xt_dccp.o
8282
obj-$(CONFIG_NETFILTER_XT_MATCH_DEVGROUP) += xt_devgroup.o
8383
obj-$(CONFIG_NETFILTER_XT_MATCH_DSCP) += xt_dscp.o
84+
obj-$(CONFIG_NETFILTER_XT_MATCH_ECN) += xt_ecn.o
8485
obj-$(CONFIG_NETFILTER_XT_MATCH_ESP) += xt_esp.o
8586
obj-$(CONFIG_NETFILTER_XT_MATCH_HASHLIMIT) += xt_hashlimit.o
8687
obj-$(CONFIG_NETFILTER_XT_MATCH_HELPER) += xt_helper.o
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
2222
MODULE_DESCRIPTION("Xtables: Explicit Congestion Notification (ECN) flag match for IPv4");
2323
MODULE_LICENSE("GPL");
24+
MODULE_ALIAS("ipt_ecn");
2425

2526
static inline bool match_ip(const struct sk_buff *skb,
2627
const struct ipt_ecn_info *einfo)

0 commit comments

Comments
 (0)