-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
netfilter: nf_conntrack: push zone object into functions
This patch replaces the zone id which is pushed down into functions with the actual zone object. It's a bigger one-time change, but needed for later on extending zones with a direction parameter, and thus decoupling this additional information from all call-sites. No functional changes in this patch. The default zone becomes a global const object, namely nf_ct_zone_dflt and will be returned directly in various cases, one being, when there's f.e. no zoning support. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
- Loading branch information
Daniel Borkmann
authored and
Pablo Neira Ayuso
committed
Aug 11, 2015
1 parent
3499abb
commit 308ac91
Showing
21 changed files
with
203 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,38 @@ | ||
#ifndef _NF_CONNTRACK_ZONES_H | ||
#define _NF_CONNTRACK_ZONES_H | ||
|
||
#define NF_CT_DEFAULT_ZONE 0 | ||
|
||
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
#include <net/netfilter/nf_conntrack_extend.h> | ||
#define NF_CT_DEFAULT_ZONE_ID 0 | ||
|
||
struct nf_conntrack_zone { | ||
u16 id; | ||
}; | ||
|
||
static inline u16 nf_ct_zone(const struct nf_conn *ct) | ||
extern const struct nf_conntrack_zone nf_ct_zone_dflt; | ||
|
||
#if IS_ENABLED(CONFIG_NF_CONNTRACK) | ||
#include <net/netfilter/nf_conntrack_extend.h> | ||
|
||
static inline const struct nf_conntrack_zone * | ||
nf_ct_zone(const struct nf_conn *ct) | ||
{ | ||
const struct nf_conntrack_zone *nf_ct_zone = NULL; | ||
|
||
#ifdef CONFIG_NF_CONNTRACK_ZONES | ||
struct nf_conntrack_zone *nf_ct_zone; | ||
nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE); | ||
if (nf_ct_zone) | ||
return nf_ct_zone->id; | ||
#endif | ||
return NF_CT_DEFAULT_ZONE; | ||
return nf_ct_zone ? nf_ct_zone : &nf_ct_zone_dflt; | ||
} | ||
|
||
#endif /* CONFIG_NF_CONNTRACK || CONFIG_NF_CONNTRACK_MODULE */ | ||
static inline const struct nf_conntrack_zone * | ||
nf_ct_zone_tmpl(const struct nf_conn *tmpl) | ||
{ | ||
return tmpl ? nf_ct_zone(tmpl) : &nf_ct_zone_dflt; | ||
} | ||
|
||
static inline bool nf_ct_zone_equal(const struct nf_conn *a, | ||
const struct nf_conntrack_zone *b) | ||
{ | ||
return nf_ct_zone(a)->id == b->id; | ||
} | ||
#endif /* IS_ENABLED(CONFIG_NF_CONNTRACK) */ | ||
#endif /* _NF_CONNTRACK_ZONES_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.