Skip to content

Fix tunnel stats not accounting for handshakes#68

Open
dlon wants to merge 1 commit intomainfrom
fix-counters
Open

Fix tunnel stats not accounting for handshakes#68
dlon wants to merge 1 commit intomainfrom
fix-counters

Conversation

@dlon
Copy link
Member

@dlon dlon commented Jan 22, 2026

The main difference I've seen compared to wireguard-go is that handshake initiations do not affect tx_bytes.

I've tried to make the behavior identical to that of wireguard-go. Any incoming packet that's accepted should contribute to rx_bytes, and any outbound packet on the UDP socket should contribute to tx_bytes. Except cookies. One difference is that wg-go adds MinMessageSize to incoming packet lengths (https://github.com/WireGuard/wireguard-go/blob/f333402bd9cbe0f3eeb02507bd14e23d7d639280/device/receive.go#L463).

Side-note: It might be more difficult than necessary to keep track of the side effects that different functions have on timers and counters.


This change is Reviewable

In short, any incoming authenticated packet and any outbound packet should affect the byte count.
@dlon dlon marked this pull request as ready for review February 11, 2026 12:04
@dlon dlon requested a review from Serock3 February 11, 2026 12:05
Copy link
Contributor

@Serock3 Serock3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Serock3 reviewed 2 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dlon).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants