netlink: fix build without INVARIANTS
Reported by: cy
(cherry picked from commit 03994c24da957ffd6556096cdd6f6522eb968ba8)