[libnetfilter_queue] nfqnl_test: add hw src address, physindev and physoutdev support

Patrick McHardy netfilter-cvslog-bounces at lists.netfilter.org
Mon Jan 26 16:37:44 CET 2009


Gitweb:		http://git.netfilter.org/cgi-bin/gitweb.cgi?p=libnetfilter_queue.git;a=commit;h=3bd2cefc0fb9685fde9d402fdbe3f4f3ec3ddd7d
commit 3bd2cefc0fb9685fde9d402fdbe3f4f3ec3ddd7d
Author:     Bart De Schuymer <bdschuym at pandora.be>
AuthorDate: Mon Jan 26 16:33:57 2009 +0100
Commit:     Patrick McHardy <kaber at trash.net>
CommitDate: Mon Jan 26 16:33:57 2009 +0100

    nfqnl_test: add hw src address, physindev and physoutdev support
    
    This adds the hardware source address, physindev and physoutdev support
    to nfqnl_test
    
    Signed-off-by: Bart De Schuymer <bdschuym at pandora.be>
    Signed-off-by: Patrick McHardy <kaber at trash.net>
       via  3bd2cefc0fb9685fde9d402fdbe3f4f3ec3ddd7d (commit)
      from  3b365b033fa35535e85ac15b16cbc5e90effd54a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3bd2cefc0fb9685fde9d402fdbe3f4f3ec3ddd7d
Author: Bart De Schuymer <bdschuym at pandora.be>
Date:   Mon Jan 26 16:33:57 2009 +0100

    nfqnl_test: add hw src address, physindev and physoutdev support
    
    This adds the hardware source address, physindev and physoutdev support
    to nfqnl_test
    
    Signed-off-by: Bart De Schuymer <bdschuym at pandora.be>
    Signed-off-by: Patrick McHardy <kaber at trash.net>

-----------------------------------------------------------------------

 utils/nfqnl_test.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)
This adds the hardware source address, physindev and physoutdev support
to nfqnl_test

Signed-off-by: Bart De Schuymer <bdschuym at pandora.be>
Signed-off-by: Patrick McHardy <kaber at trash.net>

diff --git a/utils/nfqnl_test.c b/utils/nfqnl_test.c
index 7cf27f0..036bdab 100644
--- a/utils/nfqnl_test.c
+++ b/utils/nfqnl_test.c
@@ -13,17 +13,28 @@ static u_int32_t print_pkt (struct nfq_data *tb)
 {
 	int id = 0;
 	struct nfqnl_msg_packet_hdr *ph;
+	struct nfqnl_msg_packet_hw *hwph;
 	u_int32_t mark,ifi; 
 	int ret;
 	char *data;
-	
+
 	ph = nfq_get_msg_packet_hdr(tb);
-	if (ph){
+	if (ph) {
 		id = ntohl(ph->packet_id);
 		printf("hw_protocol=0x%04x hook=%u id=%u ",
 			ntohs(ph->hw_protocol), ph->hook, id);
 	}
-	
+
+	hwph = nfq_get_packet_hw(tb);
+	if (hwph) {
+		int i, hlen = ntohs(hwph->hw_addrlen);
+
+		printf("hw_src_addr=");
+		for (i = 0; i < hlen-1; i++)
+			printf("%02x:", hwph->hw_addr[i]);
+		printf("%02x ", hwph->hw_addr[hlen-1]);
+	}
+
 	mark = nfq_get_nfmark(tb);
 	if (mark)
 		printf("mark=%u ", mark);
@@ -35,6 +46,13 @@ static u_int32_t print_pkt (struct nfq_data *tb)
 	ifi = nfq_get_outdev(tb);
 	if (ifi)
 		printf("outdev=%u ", ifi);
+	ifi = nfq_get_physindev(tb);
+	if (ifi)
+		printf("physindev=%u ", ifi);
+
+	ifi = nfq_get_physoutdev(tb);
+	if (ifi)
+		printf("physoutdev=%u ", ifi);
 
 	ret = nfq_get_payload(tb, &data);
 	if (ret >= 0)



More information about the netfilter-cvslog mailing list