diff mbox

netfilter 04/04: nfnetlink_log: fix wrong skbuff size calculation

Message ID 20090527143528.4649.15091.sendpatchset@x2.localnet
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Patrick McHardy May 27, 2009, 2:35 p.m. UTC
commit eeff9beec3d2563c42cca41e66d4169592bb5475
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Wed May 27 15:49:11 2009 +0200

    netfilter: nfnetlink_log: fix wrong skbuff size	calculation
    
    This problem was introduced in 72961ecf84d67d6359a1b30f9b2a8427f13e1e71
    since no space was reserved for the new attributes NFULA_HWTYPE,
    NFULA_HWLEN and NFULA_HWHEADER.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Patrick McHardy <kaber@trash.net>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index fd326ac..66a6dd5 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -581,6 +581,12 @@  nfulnl_log_packet(u_int8_t pf,
 		+ nla_total_size(sizeof(struct nfulnl_msg_packet_hw))
 		+ nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp));
 
+	if (in && skb_mac_header_was_set(skb)) {
+		size +=   nla_total_size(skb->dev->hard_header_len)
+			+ nla_total_size(sizeof(u_int16_t))	/* hwtype */
+			+ nla_total_size(sizeof(u_int16_t));	/* hwlen */
+	}
+
 	spin_lock_bh(&inst->lock);
 
 	if (inst->flags & NFULNL_CFG_F_SEQ)