1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/netfilter.h>
6 #include <linux/netfilter/nf_log.h>
8 /* Log tcp sequence, tcp options, ip options and uid owning local socket */
9 #define NF_LOG_DEFAULT_MASK 0x0f
11 /* This flag indicates that copy_len field in nf_loginfo is set */
12 #define NF_LOG_F_COPY_LEN 0x1
24 /* copy_len will be used iff you set
25 * NF_LOG_F_COPY_LEN in flags
39 typedef void nf_logfn(struct net *net,
42 const struct sk_buff *skb,
43 const struct net_device *in,
44 const struct net_device *out,
45 const struct nf_loginfo *li,
50 enum nf_log_type type;
55 /* sysctl_nf_log_all_netns - allow LOG target in all network namespaces */
56 extern int sysctl_nf_log_all_netns;
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);
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);
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);
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);
72 #define MODULE_ALIAS_NF_LOGGER(family, type) \
73 MODULE_ALIAS("nf-logger-" __stringify(family) "-" __stringify(type))
75 /* Calls the registered backend logging function */
77 void nf_log_packet(struct net *net,
80 const struct sk_buff *skb,
81 const struct net_device *in,
82 const struct net_device *out,
83 const struct nf_loginfo *li,
84 const char *fmt, ...);
87 void nf_log_trace(struct net *net,
90 const struct sk_buff *skb,
91 const struct net_device *in,
92 const struct net_device *out,
93 const struct nf_loginfo *li,
94 const char *fmt, ...);
98 struct nf_log_buf *nf_log_buf_open(void);
99 __printf(2, 3) int nf_log_buf_add(struct nf_log_buf *m, const char *f, ...);
100 void nf_log_buf_close(struct nf_log_buf *m);
101 #endif /* _NF_LOG_H */