netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH libnetfilter_log 0/2] utils: nfulnl_test: Test nflog_get_packet_hw
@ 2021-09-21  8:53 Duncan Roe
  2021-09-21  8:53 ` [PATCH libnetfilter_log 1/2] utils: nfulnl_test: Agree with man pages Duncan Roe
  2021-09-21  8:53 ` [PATCH libnetfilter_log 2/2] utils: nfulnl_test: Add rather extensive test of nflog_get_packet_hw() Duncan Roe
  0 siblings, 2 replies; 5+ messages in thread
From: Duncan Roe @ 2021-09-21  8:53 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

Hi Pablo,

This patchset extends utils/nfulnl_test.c to fully exercise
nflog_get_packet_hw(). I made these changes while researching how the doxygen
for nflog_get_packet_hw should read.

I was rather surprised to find the hw_addrlen field in struct
nfulnl_msg_packet_hw is in Network Byte Order, seeing as how it doesn't come off
the wire.

Is this a bug? - it's been that way for at least 5 years (Linux 4.4.14).

I'll document on the basis this is correct behaviour for now.

Cheers ... Duncan.

 --------------
Sample output:

> 17:30:51# /home/dunc/tests/netfilter/nfulnl_test/nfulnl_test
> unbinding existing nf_log handler for AF_INET (if any)
> binding nfnetlink_log to AF_INET
> binding this socket to group 0
> binding this socket to group 100
> setting copy_packet mode
> registering callback for group 0
> going into main loop
> pkt received (len=184)
> hw_addrlen = 6 (after htons)
> HW addr: 00:00:00:00:00:00
> hw_protocol=0x86dd hook=1 mark=0 indev=1 prefix="Hi there Tiger" payload_len=52
> pkt received (len=136)
> No struct nfulnl_msg_packet_hw returned
> hw_protocol=0x86dd hook=3 mark=0 outdev=2 prefix="What's new Pussycat?" payload_len=52
> pkt received (len=196)
> hw_addrlen = 6 (after htons)
> HW addr: 18:60:24:bb:02:d6
> hw_protocol=0x86dd hook=1 mark=0 indev=2 prefix="Hello World" payload_len=52
> ^C
 "Hi there Tiger"       - locally generated UDP6 for interface lo
 "What's new Pussycat?" - locally generated UDP6 for interface eth1
 "Hello World"          - remotely generated UDP6 on interface eth1

Duncan Roe (2):
  utils: nfulnl_test: Agree with man pages
  utils: nfulnl_test: Add rather extensive test of nflog_get_packet_hw()

 utils/nfulnl_test.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

-- 
2.17.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-28 10:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21  8:53 [PATCH libnetfilter_log 0/2] utils: nfulnl_test: Test nflog_get_packet_hw Duncan Roe
2021-09-21  8:53 ` [PATCH libnetfilter_log 1/2] utils: nfulnl_test: Agree with man pages Duncan Roe
2021-09-28 10:50   ` Pablo Neira Ayuso
2021-09-21  8:53 ` [PATCH libnetfilter_log 2/2] utils: nfulnl_test: Add rather extensive test of nflog_get_packet_hw() Duncan Roe
2021-09-28 10:50   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).