Wasn't expecting length in NBO, so code caters for it being either way Signed-off-by: Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx> --- utils/nfulnl_test.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/utils/nfulnl_test.c b/utils/nfulnl_test.c index 237adc3..a07c100 100644 --- a/utils/nfulnl_test.c +++ b/utils/nfulnl_test.c @@ -15,6 +15,31 @@ static int print_pkt(struct nflog_data *nfad) char *prefix = nflog_get_prefix(nfad); char *payload; int payload_len = nflog_get_payload(nfad, &payload); + struct nfulnl_msg_packet_hw *hw = nflog_get_packet_hw(nfad); + + if (!hw) + puts("No struct nfulnl_msg_packet_hw returned"); + else { + char *p = ""; + int i; + + if (hw->hw_addrlen > sizeof hw->hw_addr) { + i = htons(hw->hw_addrlen); + if (i <= sizeof hw->hw_addr) { + hw->hw_addrlen = i; + p = " (after htons)"; + } + } + printf("hw_addrlen = %d%s\n", hw->hw_addrlen, p); + if (i && i <= sizeof hw->hw_addr) { + uint8_t *u = hw->hw_addr; + + fputs("HW addr: ", stdout); + for (i--; i >=0; i--, u++) + printf("%02x%s", *u, i ? ":" : ""); + puts(""); + } + } if (ph) { printf("hw_protocol=0x%04x hook=%u ", -- 2.17.5