mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 10:38:44 -04:00
netfilter: conntrack: add and use nf_l4proto_log_invalid
We currently pass down the l4 protocol to the conntrack ->packet() function, but the only user of this is the debug info decision. Same information can be derived from struct nf_conn. As a first step, add and use a new log function for this, similar to nf_ct_helper_log(). Add __cold annotation -- invalid packets should be infrequent so gcc can consider all call paths that lead to such a function as unlikely. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
committed by
Pablo Neira Ayuso
parent
2420770b3f
commit
c4f3db1595
@@ -152,8 +152,18 @@ extern const struct nla_policy nf_ct_port_nla_policy[];
|
||||
#define LOG_INVALID(net, proto) \
|
||||
((net)->ct.sysctl_log_invalid == (proto) || \
|
||||
(net)->ct.sysctl_log_invalid == IPPROTO_RAW)
|
||||
|
||||
__printf(5, 6) __cold
|
||||
void nf_l4proto_log_invalid(const struct sk_buff *skb,
|
||||
struct net *net,
|
||||
u16 pf, u8 protonum,
|
||||
const char *fmt, ...);
|
||||
#else
|
||||
static inline int LOG_INVALID(struct net *net, int proto) { return 0; }
|
||||
|
||||
static inline __printf(5, 6) __cold
|
||||
void nf_l4proto_log_invalid(const struct sk_buff *skb, struct net *net,
|
||||
u16 pf, u8 protonum, const char *fmt, ...) {}
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
#endif /*_NF_CONNTRACK_PROTOCOL_H*/
|
||||
|
||||
Reference in New Issue
Block a user