Commit 506e65df authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: make comparision helpers stub functions in ZONES=n case

Those comparisions are useless in case of ZONES=n; all conntracks
will reside in the same zone by definition.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 5a75cdeb
...@@ -68,22 +68,34 @@ static inline bool nf_ct_zone_matches_dir(const struct nf_conntrack_zone *zone, ...@@ -68,22 +68,34 @@ static inline bool nf_ct_zone_matches_dir(const struct nf_conntrack_zone *zone,
static inline u16 nf_ct_zone_id(const struct nf_conntrack_zone *zone, static inline u16 nf_ct_zone_id(const struct nf_conntrack_zone *zone,
enum ip_conntrack_dir dir) enum ip_conntrack_dir dir)
{ {
#ifdef CONFIG_NF_CONNTRACK_ZONES
return nf_ct_zone_matches_dir(zone, dir) ? return nf_ct_zone_matches_dir(zone, dir) ?
zone->id : NF_CT_DEFAULT_ZONE_ID; zone->id : NF_CT_DEFAULT_ZONE_ID;
#else
return NF_CT_DEFAULT_ZONE_ID;
#endif
} }
static inline bool nf_ct_zone_equal(const struct nf_conn *a, static inline bool nf_ct_zone_equal(const struct nf_conn *a,
const struct nf_conntrack_zone *b, const struct nf_conntrack_zone *b,
enum ip_conntrack_dir dir) enum ip_conntrack_dir dir)
{ {
#ifdef CONFIG_NF_CONNTRACK_ZONES
return nf_ct_zone_id(nf_ct_zone(a), dir) == return nf_ct_zone_id(nf_ct_zone(a), dir) ==
nf_ct_zone_id(b, dir); nf_ct_zone_id(b, dir);
#else
return true;
#endif
} }
static inline bool nf_ct_zone_equal_any(const struct nf_conn *a, static inline bool nf_ct_zone_equal_any(const struct nf_conn *a,
const struct nf_conntrack_zone *b) const struct nf_conntrack_zone *b)
{ {
#ifdef CONFIG_NF_CONNTRACK_ZONES
return nf_ct_zone(a)->id == b->id; return nf_ct_zone(a)->id == b->id;
#else
return true;
#endif
} }
#endif /* IS_ENABLED(CONFIG_NF_CONNTRACK) */ #endif /* IS_ENABLED(CONFIG_NF_CONNTRACK) */
#endif /* _NF_CONNTRACK_ZONES_H */ #endif /* _NF_CONNTRACK_ZONES_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment