2010-02-15 10:13:33 -07:00
|
|
|
#ifndef _NF_CONNTRACK_ZONES_H
|
|
|
|
#define _NF_CONNTRACK_ZONES_H
|
|
|
|
|
2015-08-08 13:40:01 -06:00
|
|
|
#define NF_CT_DEFAULT_ZONE_ID 0
|
2010-02-18 11:04:44 -07:00
|
|
|
|
2010-02-15 10:13:33 -07:00
|
|
|
struct nf_conntrack_zone {
|
|
|
|
u16 id;
|
|
|
|
};
|
|
|
|
|
2015-08-08 13:40:01 -06:00
|
|
|
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)
|
2010-02-15 10:13:33 -07:00
|
|
|
{
|
2015-08-08 13:40:01 -06:00
|
|
|
const struct nf_conntrack_zone *nf_ct_zone = NULL;
|
|
|
|
|
2010-02-15 10:13:33 -07:00
|
|
|
#ifdef CONFIG_NF_CONNTRACK_ZONES
|
|
|
|
nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE);
|
|
|
|
#endif
|
2015-08-08 13:40:01 -06:00
|
|
|
return nf_ct_zone ? nf_ct_zone : &nf_ct_zone_dflt;
|
2010-02-15 10:13:33 -07:00
|
|
|
}
|
|
|
|
|
2015-08-08 13:40:01 -06:00
|
|
|
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) */
|
2010-02-15 10:13:33 -07:00
|
|
|
#endif /* _NF_CONNTRACK_ZONES_H */
|