[PR #241] fix: stop netlink dump on no progress #256

Open
opened 2026-10-13 21:08:03 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/241
Author: @HeisLuka
Created: 9/14/2026
Status: 🔄 Open

Base: master ← Head: fix/netlink-dump-no-progress


📝 Commits (1)

  • 8047fd9 fix: stop netlink dump on no progress

📊 Changes

1 file changed (+9 additions, -1 deletions)

View changed files

📝 src/netlink.c (+9 -1)

📄 Description

Summary

Stop wg_get_device_dump() from returning the same multipart dump state
forever when the next peer cannot fit in the current netlink message.

When get_peer() fails with -EMSGSIZE, the dump now distinguishes between:

  • real progress, such as an allowed-IPs continuation or a message that already
    emitted earlier peers; and
  • no progress at all, where the peer nest was canceled and the peer cursor did
    not advance.

In the no-progress case the dump returns -EMSGSIZE instead of returning a
non-zero skb length with an unchanged cursor. This prevents userspace from
receiving the same device-only message indefinitely.

Allowed-IP pagination is preserved because that path leaves serialized peer
data in the skb and stores ctx->next_allowedip.

Why this matters

Large I1-I5 device attributes can leave too little space for even the first
peer. In that state the old code left ctx->next_peer unchanged and returned
skb->len, so the next dump callback repeated the same message forever.

This can make awg show hang and consume large amounts of CPU/memory.

Fixes #228


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/241 **Author:** [@HeisLuka](https://github.com/HeisLuka) **Created:** 9/14/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix/netlink-dump-no-progress` --- ### 📝 Commits (1) - [`8047fd9`](https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/commit/8047fd98f9d5a627e0afe8b5038997d170aa4ef4) fix: stop netlink dump on no progress ### 📊 Changes **1 file changed** (+9 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/netlink.c` (+9 -1) </details> ### 📄 Description ## Summary Stop `wg_get_device_dump()` from returning the same multipart dump state forever when the next peer cannot fit in the current netlink message. When `get_peer()` fails with `-EMSGSIZE`, the dump now distinguishes between: - real progress, such as an allowed-IPs continuation or a message that already emitted earlier peers; and - no progress at all, where the peer nest was canceled and the peer cursor did not advance. In the no-progress case the dump returns `-EMSGSIZE` instead of returning a non-zero skb length with an unchanged cursor. This prevents userspace from receiving the same device-only message indefinitely. Allowed-IP pagination is preserved because that path leaves serialized peer data in the skb and stores `ctx->next_allowedip`. ## Why this matters Large I1-I5 device attributes can leave too little space for even the first peer. In that state the old code left `ctx->next_peer` unchanged and returned `skb->len`, so the next dump callback repeated the same message forever. This can make `awg show` hang and consume large amounts of CPU/memory. Fixes #228 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amneziawg-linux-kernel-module#256
No description provided.