Skip to contentSkip to conversation

add hw src address, physindev and physoutdev support to nfqnl_test

PATCH Applied Bart De Schuymer 2 participants 2 messages Jan 20, 2009 – Jan 26, 2009 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add hw src address, physindev and physoutdev support to nfqnl_test

Hi,

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

utils/nfqnl_test.c renamed from utils/nfqnl_test.c.old +0 -0
@@ -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)
#1 lore raw
Quoted 2 lines · Bart De Schuymer

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

Applied, thanks.