netfilter: nfnetlink_log: send complete hardware header
authorEric Leblond <eric@inl.fr>
Mon, 21 Jul 2008 17:02:35 +0000 (10:02 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Jul 2008 17:11:00 +0000 (10:11 -0700)
This patch adds some fields to NFLOG to be able to send the complete
hardware header with all necessary informations.
It sends to userspace:
 * the type of hardware link
 * the lenght of hardware header
 * the hardware header

Signed-off-by: Eric Leblond <eric@inl.fr>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter/nfnetlink_log.h
net/netfilter/nfnetlink_log.c

index a85721332924e934b6f128912f70cf65e32f5911..f661731f3cb161bfb8b1f74e8e0fec4a8facf4b0 100644 (file)
@@ -48,6 +48,9 @@ enum nfulnl_attr_type {
        NFULA_SEQ,                      /* instance-local sequence number */
        NFULA_SEQ_GLOBAL,               /* global sequence number */
        NFULA_GID,                      /* group id of socket */
+       NFULA_HWTYPE,                   /* hardware type */
+       NFULA_HWHEADER,                 /* hardware header */
+       NFULA_HWLEN,                    /* hardware header length */
 
        __NFULA_MAX
 };
index b8173af8c24a7d9d1f296123b52dfc05a0063dc0..9a35b57ab76d9ea4bc43b4a37401c9c21bd50ee7 100644 (file)
@@ -453,6 +453,14 @@ __build_packet_message(struct nfulnl_instance *inst,
                }
        }
 
+       if (indev && skb_mac_header_was_set(skb)) {
+               NLA_PUT_BE16(inst->skb, NFULA_HWTYPE, htons(skb->dev->type));
+               NLA_PUT_BE16(inst->skb, NFULA_HWLEN,
+                            htons(skb->dev->hard_header_len));
+               NLA_PUT(inst->skb, NFULA_HWHEADER, skb->dev->hard_header_len,
+                       skb_mac_header(skb));
+       }
+
        if (skb->tstamp.tv64) {
                struct nfulnl_msg_packet_timestamp ts;
                struct timeval tv = ktime_to_timeval(skb->tstamp);