~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/net/netfilter/nf_conntrack_labels.h

Version: ~ [ linux-5.4 ] ~ [ linux-5.3.13 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.86 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.156 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.203 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.202 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.78 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #include <linux/types.h>
  2 #include <net/net_namespace.h>
  3 #include <linux/netfilter/nf_conntrack_common.h>
  4 #include <linux/netfilter/nf_conntrack_tuple_common.h>
  5 #include <net/netfilter/nf_conntrack.h>
  6 #include <net/netfilter/nf_conntrack_extend.h>
  7 
  8 #include <uapi/linux/netfilter/xt_connlabel.h>
  9 
 10 struct nf_conn_labels {
 11         u8 words;
 12         unsigned long bits[];
 13 };
 14 
 15 static inline struct nf_conn_labels *nf_ct_labels_find(const struct nf_conn *ct)
 16 {
 17 #ifdef CONFIG_NF_CONNTRACK_LABELS
 18         return nf_ct_ext_find(ct, NF_CT_EXT_LABELS);
 19 #else
 20         return NULL;
 21 #endif
 22 }
 23 
 24 static inline struct nf_conn_labels *nf_ct_labels_ext_add(struct nf_conn *ct)
 25 {
 26 #ifdef CONFIG_NF_CONNTRACK_LABELS
 27         struct nf_conn_labels *cl_ext;
 28         struct net *net = nf_ct_net(ct);
 29         u8 words;
 30 
 31         words = ACCESS_ONCE(net->ct.label_words);
 32         if (words == 0 || WARN_ON_ONCE(words > 8))
 33                 return NULL;
 34 
 35         cl_ext = nf_ct_ext_add_length(ct, NF_CT_EXT_LABELS,
 36                                       words * sizeof(long), GFP_ATOMIC);
 37         if (cl_ext != NULL)
 38                 cl_ext->words = words;
 39 
 40         return cl_ext;
 41 #else
 42         return NULL;
 43 #endif
 44 }
 45 
 46 bool nf_connlabel_match(const struct nf_conn *ct, u16 bit);
 47 int nf_connlabel_set(struct nf_conn *ct, u16 bit);
 48 
 49 int nf_connlabels_replace(struct nf_conn *ct,
 50                           const u32 *data, const u32 *mask, unsigned int words);
 51 
 52 #ifdef CONFIG_NF_CONNTRACK_LABELS
 53 int nf_conntrack_labels_init(void);
 54 void nf_conntrack_labels_fini(void);
 55 #else
 56 static inline int nf_conntrack_labels_init(void) { return 0; }
 57 static inline void nf_conntrack_labels_fini(void) {}
 58 #endif
 59 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp