Project

General

Profile

Actions

Bug #489

closed

batman-adv preserves RX timestamps when transmitting packets, causing fq horizon drops

Added by David Lutz 13 days ago. Updated 10 days ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
11/02/2026
Due date:
% Done:

100%

Estimated time:

Description

Environment:

  • Debian 12, Linux kernel 6.1
  • batman-adv 2024.3 (DKMS)
  • fastd TAP interfaces
  • net.core.default_qdisc=fq

Problem:

After upgrading from Linux 4.19 to newer kernels, we experienced asymmetric packet loss between batman-adv gateways. Routing tables and originator information were correct, but certain unicast packets and batman-adv ICMP replies never reached their destinations.

Investigation revealed thousands of horizon_drops in the fq queueing discipline.

Using bpftrace, we traced skb->tstamp through the batman-adv ICMP receive and transmit paths:

RX:     tstamp=1793640196114589972
BAT-TX: tstamp=1793640196114589972
QDISC:  tstamp=1793640196114589972

The timestamp remains unchanged throughout transmission. It represents CLOCK_REALTIME, whereas Linux 6.1's fq scheduler compares it against CLOCK_MONOTONIC.
Consequently, fq interprets the packet as scheduled approximately 57 years into the future and drops it due to the default 10-second horizon.

Workaround:

Changing the TAP interface's queueing discipline immediately resolves the issue:

tc qdisc replace dev ff3l-mesh-vpn1 root fq_codel

Previously failing batman-adv pings now succeed with 0% packet loss, and previously broken TCP connections work again.

Suspected cause:

batman-adv appears to preserve receive timestamps when retransmitting packets instead of clearing skb->tstamp.

Would resetting skb->tstamp = 0 in the appropriate batman-adv transmission paths be the correct fix?

Like in Linux Kernel commit 8203e2d844d3?


Related issues 1 (1 open — 0 closed)

Related to batman-adv - Bug #490: use skb_scrub_packet instead of nf_reset_ctIn Progressbatman-adv developers11/02/2026

Actions
Actions #1

Updated by Sven Eckelmann 13 days ago

  • Related to Bug #490: use skb_scrub_packet instead of nf_reset_ct added
Actions #2

Updated by Sven Eckelmann 13 days ago ยท Edited

  • Description updated (diff)
  • Status changed from New to Feedback
  • Assignee changed from batman-adv developers to David Lutz

Thanks for the detailed (but still well structured) report.

I wanted to wrap up the 2026.4 release but maybe you can test the patch https://patchwork.open-mesh.org/project/b.a.t.m.a.n./patch/20261102-clear-tstamp-v1-1-f64a8ac9af80@narfation.org/ and we can also integrate it directly.

Would resetting skb->tstamp = 0 in the appropriate batman-adv transmission paths be the correct fix?

yes and no. You should not do this anymore since commit https://git.open-mesh.org/batadv.git/commit/?id=de799101519aad23c6096041ba2744d7b5517e6a. Instead the helper skb_clear_tstamp has to be used. But the general approach seems to be fine.

Actions #3

Updated by David Lutz 13 days ago

I've successfully tested your patch!

I backported it to batman-adv 2024.3 (the only required adjustment was the patch context due to the existing network coding code) and rebuilt my DKMS module for Linux 6.1.0-54-amd64.

bpftrace confirms that the incoming CLOCK_REALTIME timestamp is preserved until batadv_send_skb_packet(), but is correctly cleared before __dev_queue_xmit() (skb->tstamp = 0).

I switched the fastd TAP interface back to the previously problematic fq qdisc.

Results:

3,442 packets transmitted, 0 drops (including 0 horizon drops).
batman-adv ICMP ping: 5/5 replies, 0% packet loss.
Average RTT: 11.14 ms.

The issue is resolved with your patch, even when using fq.

Thanks for the quick fix!

Actions #4

Updated by Sven Eckelmann 13 days ago

  • Status changed from Feedback to Resolved
  • Assignee changed from David Lutz to batman-adv developers
  • Target version set to 2026.4
  • % Done changed from 0 to 100
Actions #5

Updated by Sven Eckelmann 10 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF