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

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

Version: ~ [ linux-5.16-rc1 ] ~ [ linux-5.15.2 ] ~ [ linux-5.14.18 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.79 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.159 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.217 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.255 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.290 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.292 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ 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 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright (C)2003,2004 USAGI/WIDE Project
  4  *
  5  * Header for use in defining a given L3 protocol for connection tracking.
  6  *
  7  * Author:
  8  *      Yasuyuki Kozakai @USAGI <yasuyuki.kozakai@toshiba.co.jp>
  9  *
 10  * Derived from include/netfilter_ipv4/ip_conntrack_protocol.h
 11  */
 12 
 13 #ifndef _NF_CONNTRACK_L3PROTO_H
 14 #define _NF_CONNTRACK_L3PROTO_H
 15 #include <linux/netlink.h>
 16 #include <net/netlink.h>
 17 #include <linux/seq_file.h>
 18 #include <net/netfilter/nf_conntrack.h>
 19 
 20 struct nf_conntrack_l3proto {
 21         /* L3 Protocol Family number. ex) PF_INET */
 22         u_int16_t l3proto;
 23 
 24         /* size of tuple nlattr, fills a hole */
 25         u16 nla_size;
 26 
 27         /*
 28          * Try to fill in the third arg: nhoff is offset of l3 proto
 29          * hdr.  Return true if possible.
 30          */
 31         bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff,
 32                              struct nf_conntrack_tuple *tuple);
 33 
 34         /*
 35          * Invert the per-proto part of the tuple: ie. turn xmit into reply.
 36          * Some packets can't be inverted: return 0 in that case.
 37          */
 38         bool (*invert_tuple)(struct nf_conntrack_tuple *inverse,
 39                              const struct nf_conntrack_tuple *orig);
 40 
 41         /*
 42          * Called before tracking. 
 43          *      *dataoff: offset of protocol header (TCP, UDP,...) in skb
 44          *      *protonum: protocol number
 45          */
 46         int (*get_l4proto)(const struct sk_buff *skb, unsigned int nhoff,
 47                            unsigned int *dataoff, u_int8_t *protonum);
 48 
 49 #if IS_ENABLED(CONFIG_NF_CT_NETLINK)
 50         int (*tuple_to_nlattr)(struct sk_buff *skb,
 51                                const struct nf_conntrack_tuple *t);
 52         int (*nlattr_to_tuple)(struct nlattr *tb[],
 53                                struct nf_conntrack_tuple *t);
 54         const struct nla_policy *nla_policy;
 55 #endif
 56 
 57         /* Called when netns wants to use connection tracking */
 58         int (*net_ns_get)(struct net *);
 59         void (*net_ns_put)(struct net *);
 60 
 61         /* Module (if any) which this is connected to. */
 62         struct module *me;
 63 };
 64 
 65 extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[NFPROTO_NUMPROTO];
 66 
 67 /* Protocol global registration. */
 68 int nf_ct_l3proto_register(const struct nf_conntrack_l3proto *proto);
 69 void nf_ct_l3proto_unregister(const struct nf_conntrack_l3proto *proto);
 70 
 71 const struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
 72 
 73 /* Existing built-in protocols */
 74 extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
 75 
 76 static inline struct nf_conntrack_l3proto *
 77 __nf_ct_l3proto_find(u_int16_t l3proto)
 78 {
 79         if (unlikely(l3proto >= NFPROTO_NUMPROTO))
 80                 return &nf_conntrack_l3proto_generic;
 81         return rcu_dereference(nf_ct_l3protos[l3proto]);
 82 }
 83 
 84 #endif /*_NF_CONNTRACK_L3PROTO_H*/
 85 

~ [ 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