cregit-Linux how code gets into the kernel

Release 4.12 include/net/netfilter/nf_conntrack_ecache.h

/*
 * connection tracking event cache.
 */

#ifndef _NF_CONNTRACK_ECACHE_H

#define _NF_CONNTRACK_ECACHE_H
#include <net/netfilter/nf_conntrack.h>

#include <net/net_namespace.h>
#include <net/netfilter/nf_conntrack_expect.h>
#include <linux/netfilter/nf_conntrack_common.h>
#include <linux/netfilter/nf_conntrack_tuple_common.h>
#include <net/netfilter/nf_conntrack_extend.h>


enum nf_ct_ecache_state {
	
NFCT_ECACHE_UNKNOWN,		/* destroy event not sent */
	
NFCT_ECACHE_DESTROY_FAIL,	/* tried but failed to send destroy event */
	
NFCT_ECACHE_DESTROY_SENT,	/* sent destroy event after failure */
};


struct nf_conntrack_ecache {
	
unsigned long cache;		/* bitops want long */
	
u16 missed;			/* missed events */
	
u16 ctmask;			/* bitmask of ct events to be delivered */
	
u16 expmask;			/* bitmask of expect events to be delivered */
	
enum nf_ct_ecache_state state:8;/* ecache state */
	
u32 portid;			/* netlink portid of destroyer */
};


static inline struct nf_conntrack_ecache * nf_ct_ecache_find(const struct nf_conn *ct) { #ifdef CONFIG_NF_CONNTRACK_EVENTS return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE); #else return NULL; #endif }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso1957.58%133.33%
Changli Gao1030.30%133.33%
Martin Josefsson412.12%133.33%
Total33100.00%3100.00%


static inline struct nf_conntrack_ecache * nf_ct_ecache_ext_add(struct nf_conn *ct, u16 ctmask, u16 expmask, gfp_t gfp) { #ifdef CONFIG_NF_CONNTRACK_EVENTS struct net *net = nf_ct_net(ct); struct nf_conntrack_ecache *e; if (!ctmask && !expmask && net->ct.sysctl_events) { ctmask = ~0; expmask = ~0; } if (!ctmask && !expmask) return NULL; e = nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp); if (e) { e->ctmask = ctmask; e->expmask = expmask; } return e; #else return NULL; #endif }

Contributors

PersonTokensPropCommitsCommitProp
Patrick McHardy5950.43%125.00%
Pablo Neira Ayuso4639.32%125.00%
Changli Gao108.55%125.00%
Martin Josefsson21.71%125.00%
Total117100.00%4100.00%

; #ifdef CONFIG_NF_CONNTRACK_EVENTS /* This structure is passed to event handler */ struct nf_ct_event { struct nf_conn *ct; u32 portid; int report; }; struct nf_ct_event_notifier { int (*fcn)(unsigned int events, struct nf_ct_event *item); }; 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); void nf_ct_deliver_cached_events(struct nf_conn *ct); int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct, u32 portid, int report);
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; if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) return; e = nf_ct_ecache_find(ct); if (e == NULL) return; set_bit(event, &e->cache); }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso3652.94%342.86%
Martin Josefsson2841.18%114.29%
Alexey Dobriyan34.41%228.57%
Patrick McHardy11.47%114.29%
Total68100.00%7100.00%


static inline int nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, u32 portid, int report) { const struct net *net = nf_ct_net(ct); if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) return 0; return nf_conntrack_eventmask_report(1 << event, ct, portid, report); }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso4064.52%562.50%
Martin Josefsson1016.13%112.50%
Florian Westphal1016.13%112.50%
Eric W. Biedermann23.23%112.50%
Total62100.00%8100.00%


static inline int nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) { const struct net *net = nf_ct_net(ct); if (!rcu_access_pointer(net->ct.nf_conntrack_event_cb)) return 0; return nf_conntrack_eventmask_report(1 << event, ct, 0, 0); }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso2748.21%360.00%
Florian Westphal2646.43%120.00%
Martin Josefsson35.36%120.00%
Total56100.00%5100.00%

struct nf_exp_event { struct nf_conntrack_expect *exp; u32 portid; int report; }; struct nf_exp_event_notifier { int (*fcn)(unsigned int events, struct nf_exp_event *item); }; int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb); void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb); void nf_ct_expect_event_report(enum ip_conntrack_expect_events event, struct nf_conntrack_expect *exp, u32 portid, int report); int nf_conntrack_ecache_pernet_init(struct net *net); void nf_conntrack_ecache_pernet_fini(struct net *net); int nf_conntrack_ecache_init(void); void nf_conntrack_ecache_fini(void);
static inline void nf_conntrack_ecache_delayed_work(struct net *net) { if (!delayed_work_pending(&net->ct.ecache_dwork)) { schedule_delayed_work(&net->ct.ecache_dwork, HZ); net->ct.ecache_dwork_pending = true; } }

Contributors

PersonTokensPropCommitsCommitProp
Florian Westphal47100.00%1100.00%
Total47100.00%1100.00%


static inline void nf_conntrack_ecache_work(struct net *net) { if (net->ct.ecache_dwork_pending) { net->ct.ecache_dwork_pending = false; mod_delayed_work(system_wq, &net->ct.ecache_dwork, 0); } }

Contributors

PersonTokensPropCommitsCommitProp
Florian Westphal44100.00%1100.00%
Total44100.00%1100.00%

#else /* CONFIG_NF_CONNTRACK_EVENTS */
static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) {}

Contributors

PersonTokensPropCommitsCommitProp
Martin Josefsson1386.67%150.00%
Linus Torvalds213.33%150.00%
Total15100.00%2100.00%


static inline int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct, u32 portid, int report) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso2496.00%266.67%
Eric W. Biedermann14.00%133.33%
Total25100.00%3100.00%


static inline int nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Martin Josefsson1368.42%150.00%
Pablo Neira Ayuso631.58%150.00%
Total19100.00%2100.00%


static inline int nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct, u32 portid, int report) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso2496.00%266.67%
Eric W. Biedermann14.00%133.33%
Total25100.00%3100.00%


static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}

Contributors

PersonTokensPropCommitsCommitProp
Martin Josefsson12100.00%1100.00%
Total12100.00%1100.00%


static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e, struct nf_conntrack_expect *exp, u32 portid, int report) {}

Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso2095.24%150.00%
Eric W. Biedermann14.76%150.00%
Total21100.00%2100.00%


static inline int nf_conntrack_ecache_pernet_init(struct net *net) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan1386.67%133.33%
Guo-Fu Tseng16.67%133.33%
Gao Feng16.67%133.33%
Total15100.00%3100.00%


static inline void nf_conntrack_ecache_pernet_fini(struct net *net) { }

Contributors

PersonTokensPropCommitsCommitProp
Alexey Dobriyan1090.91%150.00%
Gao Feng19.09%150.00%
Total11100.00%2100.00%


static inline int nf_conntrack_ecache_init(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Gao Feng12100.00%1100.00%
Total12100.00%1100.00%


static inline void nf_conntrack_ecache_fini(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Gao Feng8100.00%1100.00%
Total8100.00%1100.00%


static inline void nf_conntrack_ecache_delayed_work(struct net *net) { }

Contributors

PersonTokensPropCommitsCommitProp
Florian Westphal11100.00%1100.00%
Total11100.00%1100.00%


static inline void nf_conntrack_ecache_work(struct net *net) { }

Contributors

PersonTokensPropCommitsCommitProp
Florian Westphal11100.00%1100.00%
Total11100.00%1100.00%

#endif /* CONFIG_NF_CONNTRACK_EVENTS */ #endif /*_NF_CONNTRACK_ECACHE_H*/

Overall Contributors

PersonTokensPropCommitsCommitProp
Pablo Neira Ayuso37040.88%627.27%
Florian Westphal19521.55%522.73%
Martin Josefsson14415.91%14.55%
Patrick McHardy859.39%313.64%
Alexey Dobriyan444.86%29.09%
Gao Feng363.98%14.55%
Changli Gao202.21%14.55%
Eric W. Biedermann80.88%14.55%
Linus Torvalds20.22%14.55%
Guo-Fu Tseng10.11%14.55%
Total905100.00%22100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.