Skip to content

Commit a0ae256

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: conntrack: remove l3proto abstraction
This unifies ipv4 and ipv6 protocol trackers and removes the l3proto abstraction. This gets rid of all l3proto indirect calls and the need to do a lookup on the function to call for l3 demux. It increases module size by only a small amount (12kbyte), so this reduces size because nf_conntrack.ko is useless without either nf_conntrack_ipv4 or nf_conntrack_ipv6 module. before: text data bss dec hex filename 7357 1088 0 8445 20fd nf_conntrack_ipv4.ko 7405 1084 4 8493 212d nf_conntrack_ipv6.ko 72614 13689 236 86539 1520b nf_conntrack.ko 19K nf_conntrack_ipv4.ko 19K nf_conntrack_ipv6.ko 179K nf_conntrack.ko after: text data bss dec hex filename 79277 13937 236 93450 16d0a nf_conntrack.ko 191K nf_conntrack.ko Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent c779e84 commit a0ae256

19 files changed

+645
-1095
lines changed

include/net/netfilter/ipv4/nf_conntrack_ipv4.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
#ifndef _NF_CONNTRACK_IPV4_H
1111
#define _NF_CONNTRACK_IPV4_H
1212

13-
14-
const extern struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4;
15-
1613
extern const struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
1714
extern const struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
1815
extern const struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;

include/net/netfilter/nf_conntrack.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ union nf_conntrack_expect_proto {
4141
/* insert expect proto private data here */
4242
};
4343

44+
struct nf_conntrack_net {
45+
unsigned int users4;
46+
unsigned int users6;
47+
};
48+
4449
#include <linux/types.h>
4550
#include <linux/skbuff.h>
4651

include/net/netfilter/nf_conntrack_core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define _NF_CONNTRACK_CORE_H
1515

1616
#include <linux/netfilter.h>
17-
#include <net/netfilter/nf_conntrack_l3proto.h>
1817
#include <net/netfilter/nf_conntrack_l4proto.h>
1918
#include <net/netfilter/nf_conntrack_ecache.h>
2019

include/net/netfilter/nf_conntrack_l3proto.h

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

include/net/netfilter/nf_conntrack_l4proto.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ void nf_ct_l4proto_pernet_unregister(struct net *net,
130130
/* Protocol global registration. */
131131
int nf_ct_l4proto_register_one(const struct nf_conntrack_l4proto *proto);
132132
void nf_ct_l4proto_unregister_one(const struct nf_conntrack_l4proto *proto);
133-
int nf_ct_l4proto_register(const struct nf_conntrack_l4proto * const proto[],
134-
unsigned int num_proto);
135-
void nf_ct_l4proto_unregister(const struct nf_conntrack_l4proto * const proto[],
136-
unsigned int num_proto);
137133

138134
/* Generic netlink helpers */
139135
int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,

net/ipv4/netfilter/Kconfig

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,6 @@ config NF_DEFRAG_IPV4
99
tristate
1010
default n
1111

12-
config NF_CONNTRACK_IPV4
13-
tristate "IPv4 connection tracking support (required for NAT)"
14-
depends on NF_CONNTRACK
15-
default m if NETFILTER_ADVANCED=n
16-
select NF_DEFRAG_IPV4
17-
---help---
18-
Connection tracking keeps a record of what packets have passed
19-
through your machine, in order to figure out how they are related
20-
into connections.
21-
22-
This is IPv4 support on Layer 3 independent connection tracking.
23-
Layer 3 independent connection tracking is experimental scheme
24-
which generalize ip_conntrack to support other layer 3 protocols.
25-
26-
To compile it as a module, choose M here. If unsure, say N.
27-
2812
config NF_SOCKET_IPV4
2913
tristate "IPv4 socket lookup support"
3014
help
@@ -112,7 +96,7 @@ config NF_REJECT_IPV4
11296

11397
config NF_NAT_IPV4
11498
tristate "IPv4 NAT"
115-
depends on NF_CONNTRACK_IPV4
99+
depends on NF_CONNTRACK
116100
default m if NETFILTER_ADVANCED=n
117101
select NF_NAT
118102
help
@@ -279,7 +263,7 @@ config IP_NF_TARGET_SYNPROXY
279263
# NAT + specific targets: nf_conntrack
280264
config IP_NF_NAT
281265
tristate "iptables NAT support"
282-
depends on NF_CONNTRACK_IPV4
266+
depends on NF_CONNTRACK
283267
default m if NETFILTER_ADVANCED=n
284268
select NF_NAT
285269
select NF_NAT_IPV4
@@ -340,7 +324,7 @@ config IP_NF_MANGLE
340324
config IP_NF_TARGET_CLUSTERIP
341325
tristate "CLUSTERIP target support"
342326
depends on IP_NF_MANGLE
343-
depends on NF_CONNTRACK_IPV4
327+
depends on NF_CONNTRACK
344328
depends on NETFILTER_ADVANCED
345329
select NF_CONNTRACK_MARK
346330
select NETFILTER_FAMILY_ARP

net/ipv4/netfilter/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
# Makefile for the netfilter modules on top of IPv4.
44
#
55

6-
# objects for l3 independent conntrack
7-
nf_conntrack_ipv4-y := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o
8-
9-
# connection tracking
10-
obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o
11-
126
nf_nat_ipv4-y := nf_nat_l3proto_ipv4.o nf_nat_proto_icmp.o
137
nf_nat_ipv4-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o
148
obj-$(CONFIG_NF_NAT_IPV4) += nf_nat_ipv4.o

0 commit comments

Comments
 (0)