fix: set ifindex in AddrList request to avoid dumping all addresses#1175
fix: set ifindex in AddrList request to avoid dumping all addresses#1175aboch merged 1 commit intovishvananda:mainfrom
Conversation
When a link is provided, AddrList was doing a full NLM_F_DUMP of all addresses and filtering in the client side. On systems with many interfaces this is wasteful and prone to NLM_F_DUMP_INTR errors. Set ifa_index in the request message so the kernel can do the filtering. Kernel-side filtering requires NETLINK_GET_STRICT_CHK to be enabled on the handle (Handle.SetStrictCheck). Without it, the kernel ignores the index field and the existing userspace filter serves as fallback. Signed-off-by: Patryk Diak <pdiak@redhat.com>
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
LGTM |
When a link is provided, AddrList was doing a full NLM_F_DUMP of all addresses and filtering in the client side. On systems with many dynamically created interfaces this is wasteful and prone to NLM_F_DUMP_INTR errors.
Set ifa_index in the request message so the kernel can do the filtering. Kernel-side filtering requires NETLINK_GET_STRICT_CHK to be enabled on the handle (Handle.SetStrictCheck). Without it, the kernel ignores the index field and the existing userspace filter serves as fallback.
Verified it with strace:
Summary by CodeRabbit