Re: tcpdump: print 802.11 sequence numbers properly

2021-06-28 Thread Jeremie Courreges-Anglas
On Mon, Jun 28 2021, Stefan Sperling  wrote:
> tcpdump -e -v -y IEEE802_11_RADIO currently prints sequence number
> and fragment number as a combined decimal value.
>
> This patch makes tcpdump display these values separately which is a lot
> easier to follow along as packets scroll by.
>
> ok?

ok jca@

> diff 18a81a05d6e3098eadc4b5e23d6656377f87591a /usr/src
> blob - 7528f50e45765f83d5d719d831df2880838bc28c
> file + usr.sbin/tcpdump/print-802_11.c
> --- usr.sbin/tcpdump/print-802_11.c
> +++ usr.sbin/tcpdump/print-802_11.c
> @@ -162,7 +162,9 @@ ieee80211_hdr(struct ieee80211_frame *wh)
>   u_int16_t seq;
>   TCARR(wh->i_seq);
>   bcopy(wh->i_seq, , sizeof(u_int16_t));
> - printf(" (seq %u): ", letoh16(seq));
> + printf(" (seq %u frag %u): ",
> + letoh16(seq) >> IEEE80211_SEQ_SEQ_SHIFT,
> + letoh16(seq) & IEEE80211_SEQ_FRAG_MASK);
>   } else
>   printf(": ");
>  
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: tcpdump: print 802.11 sequence numbers properly

2021-06-28 Thread Klemens Nanni
On Mon, Jun 28, 2021 at 11:46:37AM +0200, Stefan Sperling wrote:
> tcpdump -e -v -y IEEE802_11_RADIO currently prints sequence number
> and fragment number as a combined decimal value.
> 
> This patch makes tcpdump display these values separately which is a lot
> easier to follow along as packets scroll by.

Now sequence numbers (modulo fragments) happen to increment by one in
tcpdump's output as one would usually expect.

I looked at 802.11 just yesterday trying to figure out why the wifi is crap,
the logs contain a lot and it can be daunting at first;  this is definitely
an improvement.

OK kn



tcpdump: print 802.11 sequence numbers properly

2021-06-28 Thread Stefan Sperling
tcpdump -e -v -y IEEE802_11_RADIO currently prints sequence number
and fragment number as a combined decimal value.

This patch makes tcpdump display these values separately which is a lot
easier to follow along as packets scroll by.

ok?

diff 18a81a05d6e3098eadc4b5e23d6656377f87591a /usr/src
blob - 7528f50e45765f83d5d719d831df2880838bc28c
file + usr.sbin/tcpdump/print-802_11.c
--- usr.sbin/tcpdump/print-802_11.c
+++ usr.sbin/tcpdump/print-802_11.c
@@ -162,7 +162,9 @@ ieee80211_hdr(struct ieee80211_frame *wh)
u_int16_t seq;
TCARR(wh->i_seq);
bcopy(wh->i_seq, , sizeof(u_int16_t));
-   printf(" (seq %u): ", letoh16(seq));
+   printf(" (seq %u frag %u): ",
+   letoh16(seq) >> IEEE80211_SEQ_SEQ_SHIFT,
+   letoh16(seq) & IEEE80211_SEQ_FRAG_MASK);
} else
printf(": ");