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

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

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ 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.85 ] ~ [ 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-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 #ifndef _NF_LOG_H
  3 #define _NF_LOG_H
  4 
  5 #include <linux/netfilter.h>
  6 #include <linux/netfilter/nf_log.h>
  7 
  8 /* Log tcp sequence, tcp options, ip options and uid owning local socket */
  9 #define NF_LOG_DEFAULT_MASK     0x0f
 10 
 11 /* This flag indicates that copy_len field in nf_loginfo is set */
 12 #define NF_LOG_F_COPY_LEN       0x1
 13 
 14 enum nf_log_type {
 15         NF_LOG_TYPE_LOG         = 0,
 16         NF_LOG_TYPE_ULOG,
 17         NF_LOG_TYPE_MAX
 18 };
 19 
 20 struct nf_loginfo {
 21         u_int8_t type;
 22         union {
 23                 struct {
 24                         /* copy_len will be used iff you set
 25                          * NF_LOG_F_COPY_LEN in flags
 26                          */
 27                         u_int32_t copy_len;
 28                         u_int16_t group;
 29                         u_int16_t qthreshold;
 30                         u_int16_t flags;
 31                 } ulog;
 32                 struct {
 33                         u_int8_t level;
 34                         u_int8_t logflags;
 35                 } log;
 36         } u;
 37 };
 38 
 39 typedef void nf_logfn(struct net *net,
 40                       u_int8_t pf,
 41                       unsigned int hooknum,
 42                       const struct sk_buff *skb,
 43                       const struct net_device *in,
 44                       const struct net_device *out,
 45                       const struct nf_loginfo *li,
 46                       const char *prefix);
 47 
 48 struct nf_logger {
 49         char                    *name;
 50         enum nf_log_type        type;
 51         nf_logfn                *logfn;
 52         struct module           *me;
 53 };
 54 
 55 /* sysctl_nf_log_all_netns - allow LOG target in all network namespaces */
 56 extern int sysctl_nf_log_all_netns;
 57 
 58 /* Function to register/unregister log function. */
 59 int nf_log_register(u_int8_t pf, struct nf_logger *logger);
 60 void nf_log_unregister(struct nf_logger *logger);
 61 
 62 int nf_log_set(struct net *net, u_int8_t pf, const struct nf_logger *logger);
 63 void nf_log_unset(struct net *net, const struct nf_logger *logger);
 64 
 65 int nf_log_bind_pf(struct net *net, u_int8_t pf,
 66                    const struct nf_logger *logger);
 67 void nf_log_unbind_pf(struct net *net, u_int8_t pf);
 68 
 69 int nf_logger_find_get(int pf, enum nf_log_type type);
 70 void nf_logger_put(int pf, enum nf_log_type type);
 71 void nf_logger_request_module(int pf, enum nf_log_type type);
 72 
 73 #define MODULE_ALIAS_NF_LOGGER(family, type) \
 74         MODULE_ALIAS("nf-logger-" __stringify(family) "-" __stringify(type))
 75 
 76 /* Calls the registered backend logging function */
 77 __printf(8, 9)
 78 void nf_log_packet(struct net *net,
 79                    u_int8_t pf,
 80                    unsigned int hooknum,
 81                    const struct sk_buff *skb,
 82                    const struct net_device *in,
 83                    const struct net_device *out,
 84                    const struct nf_loginfo *li,
 85                    const char *fmt, ...);
 86 
 87 __printf(8, 9)
 88 void nf_log_trace(struct net *net,
 89                   u_int8_t pf,
 90                   unsigned int hooknum,
 91                   const struct sk_buff *skb,
 92                   const struct net_device *in,
 93                   const struct net_device *out,
 94                   const struct nf_loginfo *li,
 95                   const char *fmt, ...);
 96 
 97 struct nf_log_buf;
 98 
 99 struct nf_log_buf *nf_log_buf_open(void);
100 __printf(2, 3) int nf_log_buf_add(struct nf_log_buf *m, const char *f, ...);
101 void nf_log_buf_close(struct nf_log_buf *m);
102 
103 /* common logging functions */
104 int nf_log_dump_udp_header(struct nf_log_buf *m, const struct sk_buff *skb,
105                            u8 proto, int fragment, unsigned int offset);
106 int nf_log_dump_tcp_header(struct nf_log_buf *m, const struct sk_buff *skb,
107                            u8 proto, int fragment, unsigned int offset,
108                            unsigned int logflags);
109 void nf_log_dump_sk_uid_gid(struct nf_log_buf *m, struct sock *sk);
110 void nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf,
111                                unsigned int hooknum, const struct sk_buff *skb,
112                                const struct net_device *in,
113                                const struct net_device *out,
114                                const struct nf_loginfo *loginfo,
115                                const char *prefix);
116 void nf_log_l2packet(struct net *net, u_int8_t pf,
117                      __be16 protocol,
118                      unsigned int hooknum,
119                      const struct sk_buff *skb,
120                      const struct net_device *in,
121                      const struct net_device *out,
122                      const struct nf_loginfo *loginfo, const char *prefix);
123 
124 #endif /* _NF_LOG_H */
125 

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