All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart De Schuymer <bdschuym@pandora.be>
To: netfilter-devel@vger.kernel.org
Subject: [PATCH] add hw src address, physindev and physoutdev support to nfqnl_test
Date: Tue, 20 Jan 2009 17:23:56 +0100	[thread overview]
Message-ID: <4975FA9C.8090007@pandora.be> (raw)

Hi,

This adds the hardware source address, physindev and physoutdev support
to nfqnl_test

Signed-off-by: Bart De Schuymer <bdschuym@pandora.be>

--- libnetfilter_queue-0.0.16/utils/nfqnl_test.c.old	2009-01-17 16:20:06.000000000 +0100
+++ libnetfilter_queue-0.0.16/utils/nfqnl_test.c	2009-01-17 16:22:44.000000000 +0100
@@ -13,17 +13,28 @@ static u_int32_t print_pkt (struct nfq_d
 {
 	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_d
 	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)

             reply	other threads:[~2009-01-20 16:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 16:23 Bart De Schuymer [this message]
2009-01-26 15:34 ` [PATCH] add hw src address, physindev and physoutdev support to nfqnl_test Patrick McHardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4975FA9C.8090007@pandora.be \
    --to=bdschuym@pandora.be \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.