netfilter: conntrack: add and use nf_ct_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. Add a wrapper for the previous patch that extracs the information from nf_conn and passes it to nf_l4proto_log_invalid(). 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
c4f3db1595
commit
3d0b527bc9
@@ -149,21 +149,23 @@ int nf_ct_port_nlattr_tuple_size(void);
|
||||
extern const struct nla_policy nf_ct_port_nla_policy[];
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
#define LOG_INVALID(net, proto) \
|
||||
((net)->ct.sysctl_log_invalid == (proto) || \
|
||||
(net)->ct.sysctl_log_invalid == IPPROTO_RAW)
|
||||
|
||||
__printf(3, 4) __cold
|
||||
void nf_ct_l4proto_log_invalid(const struct sk_buff *skb,
|
||||
const struct nf_conn *ct,
|
||||
const char *fmt, ...);
|
||||
__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, ...) {}
|
||||
static inline __printf(3, 4) __cold
|
||||
void nf_ct_l4proto_log_invalid(const struct sk_buff *skb,
|
||||
const struct nf_conn *ct,
|
||||
const char *fmt, ...) { }
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
#endif /*_NF_CONNTRACK_PROTOCOL_H*/
|
||||
|
||||
Reference in New Issue
Block a user