diff options
author | Liping Zhang <zlpnobody@gmail.com> | 2016-11-14 17:39:25 +0300 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-12-04 22:45:33 +0300 |
commit | 673ab46f345557e9d741e97ca0301280360d1af1 (patch) | |
tree | 7274e919256ae409a0657306e823df780dff6282 /net/netfilter/nf_log_common.c | |
parent | b8ad652f9779976d0300ae199961e413859d5378 (diff) | |
download | linux-673ab46f345557e9d741e97ca0301280360d1af1.tar.xz |
netfilter: nf_log: do not assume ethernet header in netdev family
In netdev family, we will handle non ethernet packets, so using
eth_hdr(skb)->h_proto is incorrect.
Meanwhile, we can use socket(AF_PACKET...) to sending packets, so
skb->protocol is not always set in bridge family.
Add an extra parameter into nf_log_l2packet to solve this issue.
Fixes: 1fddf4bad0ac ("netfilter: nf_log: add packet logging for netdev family")
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nf_log_common.c')
-rw-r--r-- | net/netfilter/nf_log_common.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netfilter/nf_log_common.c b/net/netfilter/nf_log_common.c index ed9b80815fa0..dc61399e30be 100644 --- a/net/netfilter/nf_log_common.c +++ b/net/netfilter/nf_log_common.c @@ -177,6 +177,7 @@ EXPORT_SYMBOL_GPL(nf_log_dump_packet_common); /* bridge and netdev logging families share this code. */ void nf_log_l2packet(struct net *net, u_int8_t pf, + __be16 protocol, unsigned int hooknum, const struct sk_buff *skb, const struct net_device *in, @@ -184,7 +185,7 @@ void nf_log_l2packet(struct net *net, u_int8_t pf, const struct nf_loginfo *loginfo, const char *prefix) { - switch (eth_hdr(skb)->h_proto) { + switch (protocol) { case htons(ETH_P_IP): nf_log_packet(net, NFPROTO_IPV4, hooknum, skb, in, out, loginfo, "%s", prefix); |