fix compiling errors in conntrack modules

This commit is contained in:
云幕
2022-12-02 08:27:47 +00:00
parent 2315dc51ad
commit 331179c7f2
2 changed files with 23 additions and 1 deletions

View File

@ -71,6 +71,11 @@ struct nf_ct_event {
int report;
};
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
extern int nf_conntrack_register_notifier(struct net *net, struct notifier_block *nb);
extern int nf_conntrack_unregister_notifier(struct net *net, struct notifier_block *nb);
#else
struct nf_ct_event_notifier {
int (*fcn)(unsigned int events, struct nf_ct_event *item);
};
@ -79,6 +84,12 @@ int nf_conntrack_register_notifier(struct net *net,
struct nf_ct_event_notifier *nb);
void nf_conntrack_unregister_notifier(struct net *net,
struct nf_ct_event_notifier *nb);
#endif
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
int nf_conntrack_register_chain_notifier(struct net *net, struct notifier_block *nb);
int nf_conntrack_unregister_chain_notifier(struct net *net, struct notifier_block *nb);
#endif
void nf_ct_deliver_cached_events(struct nf_conn *ct);
int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
@ -87,11 +98,14 @@ int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
static inline void
nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
{
struct net *net = nf_ct_net(ct);
struct nf_conntrack_ecache *e;
#ifndef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
struct net *net = nf_ct_net(ct);
if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb))
return;
#endif
e = nf_ct_ecache_find(ct);
if (e == NULL)
@ -104,10 +118,12 @@ static inline int
nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
u32 portid, int report)
{
#ifndef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
const struct net *net = nf_ct_net(ct);
if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb))
return 0;
#endif
return nf_conntrack_eventmask_report(1 << event, ct, portid, report);
}
@ -115,10 +131,12 @@ nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
static inline int
nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
{
#ifndef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
const struct net *net = nf_ct_net(ct);
if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb))
return 0;
#endif
return nf_conntrack_eventmask_report(1 << event, ct, 0, 0);
}

View File

@ -114,7 +114,11 @@ struct netns_ct {
struct ct_pcpu __percpu *pcpu_lists;
struct ip_conntrack_stat __percpu *stat;
#ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS
struct atomic_notifier_head nf_conntrack_chain;
#else
struct nf_ct_event_notifier __rcu *nf_conntrack_event_cb;
#endif
struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
struct nf_ip_net nf_ct_proto;
#if defined(CONFIG_NF_CONNTRACK_LABELS)