This patch synchronises behaviour of ULOG and NFLOG relatively to the hardware header: * NFLOG sends MAC address to userspace (dev_parse_header content) * ULOG sends complete link header (skb_mac_header content) This patch double the size of hardware header for NFLOG and fill it with the complete hardware header. --- include/linux/netfilter/nfnetlink_log.h | 4 +++- net/netfilter/nfnetlink_log.c | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h index a857213..21b7ad5 100644 --- a/include/linux/netfilter/nfnetlink_log.h +++ b/include/linux/netfilter/nfnetlink_log.h @@ -21,10 +21,12 @@ struct nfulnl_msg_packet_hdr { u_int8_t _pad; }; +#define MAX_HWHEADER_LEN 16 + struct nfulnl_msg_packet_hw { __be16 hw_addrlen; u_int16_t _pad; - u_int8_t hw_addr[8]; + u_int8_t hw_addr[MAX_HWHEADER_LEN]; }; struct nfulnl_msg_packet_timestamp { diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 7efa40d..de4af6c 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -444,13 +444,15 @@ __build_packet_message(struct nfulnl_instance *inst, if (skb->mark) NLA_PUT_BE32(inst->skb, NFULA_MARK, htonl(skb->mark)); - if (indev && skb->dev) { + + if (indev && indev->hard_header_len > 0 + && skb->mac_header != skb->network_header + && indev->hard_header_len <= MAX_HWHEADER_LEN * sizeof(char)) { struct nfulnl_msg_packet_hw phw; - int len = dev_parse_header(skb, phw.hw_addr); - if (len > 0) { - phw.hw_addrlen = htons(len); - NLA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw); - } + memcpy(phw.hw_addr, skb_mac_header(skb), indev->hard_header_len); + + phw.hw_addrlen = htons(indev->hard_header_len); + NLA_PUT(inst->skb, NFULA_HWADDR, sizeof(phw), &phw); } if (skb->tstamp.tv64) { -- 1.5.5.3 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html