aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBob Hockney <bhockney@ix.netcom.com>2012-12-16 13:34:11 -0500
committerPablo Neira Ayuso <pablo@netfilter.org>2012-12-16 17:41:31 -0500
commit0c36b48b36dc84d4215dc9d1cde1bda829214ba6 (patch)
treec3af745bbb3a64c645ccb789c07c462e4108b70d /net
parent97cf00e93cc24898493e7a058105e3215257ee04 (diff)
netfilter: nfnetlink_log: fix mac address for 6in4 tunnels
For tunnelled ipv6in4 packets, the LOG target (xt_LOG.c) adjusts the start of the mac field to start at the ethernet header instead of the ipv4 header for the tunnel. This patch conforms what is passed by the NFLOG target through nfnetlink to what the LOG target does. Code borrowed from xt_LOG.c. Signed-off-by: Bob Hockney <bhockney@ix.netcom.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nfnetlink_log.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 9f199f2e31f..4e210e0fd36 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -384,6 +384,7 @@ __build_packet_message(struct nfulnl_instance *inst,
384 struct nfgenmsg *nfmsg; 384 struct nfgenmsg *nfmsg;
385 sk_buff_data_t old_tail = inst->skb->tail; 385 sk_buff_data_t old_tail = inst->skb->tail;
386 struct sock *sk; 386 struct sock *sk;
387 const unsigned char *hwhdrp;
387 388
388 nlh = nlmsg_put(inst->skb, 0, 0, 389 nlh = nlmsg_put(inst->skb, 0, 0,
389 NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET, 390 NFNL_SUBSYS_ULOG << 8 | NFULNL_MSG_PACKET,
@@ -485,9 +486,17 @@ __build_packet_message(struct nfulnl_instance *inst,
485 if (indev && skb_mac_header_was_set(skb)) { 486 if (indev && skb_mac_header_was_set(skb)) {
486 if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) || 487 if (nla_put_be16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type)) ||
487 nla_put_be16(inst->skb, NFULA_HWLEN, 488 nla_put_be16(inst->skb, NFULA_HWLEN,
488 htons(skb->dev->hard_header_len)) || 489 htons(skb->dev->hard_header_len)))
489 nla_put(inst->skb, NFULA_HWHEADER, skb->dev->hard_header_len, 490 goto nla_put_failure;
490 skb_mac_header(skb))) 491
492 hwhdrp = skb_mac_header(skb);
493
494 if (skb->dev->type == ARPHRD_SIT)
495 hwhdrp -= ETH_HLEN;
496
497 if (hwhdrp >= skb->head &&
498 nla_put(inst->skb, NFULA_HWHEADER,
499 skb->dev->hard_header_len, hwhdrp))
491 goto nla_put_failure; 500 goto nla_put_failure;
492 } 501 }
493 502