Community discussions

MikroTik App
 
User avatar
hike
just joined
Topic Author
Posts: 12
Joined: Mon May 18, 2020 1:44 pm

packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 1:17 pm

/tool sniffer seems to miss hundreds of UDP encapsulated ESP datagrams that are about to leave the device:

ros-sniffer-missing-esp.png

(80. is the RouterOS device, 85. is the Windows client)

each of the lines above is Wireshark reporting that a different ESP sequence number was expected, implying one or several hundred missing ESP datagrams.

Sniffer setup:
[admin@ros] /tool sniffer> print
                     only-headers: no
                     memory-limit: 100KiB
                    memory-scroll: yes
                        file-name: flash/dump.pcap
                       file-limit: 1048576KiB
                streaming-enabled: no
                 streaming-server: 0.0.0.0
                    filter-stream: no
                 filter-interface: vrrp1
               filter-mac-address: 
              filter-mac-protocol: 
                filter-ip-address: 85.X.X.X/32
              filter-ipv6-address: 
               filter-ip-protocol: udp
                      filter-port: 4500
                       filter-cpu: 
                 filter-direction: any
  filter-operator-between-entries: or
                          running: no

I did the same packet dump on the other side and the RouterOS sniffer dump does *not* represent, what the receiver got.

Any ideas?
You do not have the required permissions to view the files attached to this post.
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 1:56 pm

You filter on UDP and port number, but if IP packets are fragmented (which is likely the case here), the L4 addresses (ports) are only present in the first fragment, so the second fragment doesn't match the filter. But since the first fragment is not a complete packet, it doesn't make it to the sniffer output either.
 
User avatar
hike
just joined
Topic Author
Posts: 12
Joined: Mon May 18, 2020 1:44 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 2:56 pm

You filter on UDP and port number, but if IP packets are fragmented (which is likely the case here), the L4 addresses (ports) are only present in the first fragment, so the second fragment doesn't match the filter. But since the first fragment is not a complete packet, it doesn't make it to the sniffer output either.
Not one single IP Packet in the dump above has ip.flags.mf (More fragments) set so I guess that can't be it.
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 3:09 pm

Of course there is no MF flag in packets which did make it to the capture. You are interested in those which didn't. As I've understood, you can see those "as-if-missing" packets at receiving side, what is their size there? Also, for the same reason as described (port numbers only present in the first fragment), firewalls often reassemble fragmented packets before matching them to rules/conntrack, so the fragment size may differ at the sender and at the recipient.
 
User avatar
hike
just joined
Topic Author
Posts: 12
Joined: Mon May 18, 2020 1:44 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 5:03 pm

First fragments usually contain the L4 header (8 bytes UDP in this case), ip.flags.mf=1 and ip.offset=0.
If ip.flags.mf is not set anywhere, no fragments will follow.
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 5:12 pm

First fragments usually contain the L4 header (8 bytes UDP in this case), ip.flags.mf=1 and ip.offset=0.
If ip.flags.mf is not set anywhere, no fragments will follow.
This is correct. But what I am saying is that the sniffer filter only looks for complete packets if you ask it to match on protocol and port, and it doesn't do reassembly itself, hence it skips any fragments, including the first ones. So if the Mikrotik fragments a larger-than-mtu packet when sending it, the sniffer with this filter (UDP 4500) misses it completely. Try filtering on the remote IP address only, not on UDP 4500, and see what happens.
 
User avatar
hike
just joined
Topic Author
Posts: 12
Joined: Mon May 18, 2020 1:44 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 5:35 pm

Try filtering on the remote IP address only, not on UDP 4500, and see what happens.

I just did, same result.
Many more missing ESP UDP datagrams on the sending than on the receiving side.
 
sindy
Forum Guru
Forum Guru
Posts: 10206
Joined: Mon Dec 04, 2017 9:19 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 5:57 pm

I just did, same result. Many more missing ESP UDP datagrams on the sending than on the receiving side.
If so, it looks like an overload of the device or a bug of the sniffer.
 
User avatar
hike
just joined
Topic Author
Posts: 12
Joined: Mon May 18, 2020 1:44 pm

Re: packet sniffer missing outgoing ESP datagrams

Fri May 29, 2020 6:10 pm

I just did, same result. Many more missing ESP UDP datagrams on the sending than on the receiving side.
If so, it looks like an overload of the device or a bug of the sniffer.
I assume the latter, the device is not in use and mostly idle.

Who is online

Users browsing this forum: Adrijan, korbanpinjol, pajapatak and 103 guests