With a dump file (ss -D), rtnl_dump_filter_l() wrote NLMSG_ALIGN(status) bytes, reading up to 3 bytes past the received data, and past the buffer when the datagram is larger than 32K. Write the datagram, then explicit zero padding, since rtnl_from_file() expects padded messages. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Stephen Hemminger --- lib/libnetlink.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/libnetlink.c b/lib/libnetlink.c index de0681ac..f67f2b48 100644 --- a/lib/libnetlink.c +++ b/lib/libnetlink.c @@ -928,8 +928,13 @@ static int rtnl_dump_filter_l(struct rtnl_handle *rth, if (status < 0) return status; - if (rth->dump_fp) - fwrite(buf, 1, NLMSG_ALIGN(status), rth->dump_fp); + if (rth->dump_fp) { + static const char pad[NLMSG_ALIGNTO]; + + /* rtnl_from_file() expects padded messages */ + fwrite(buf, 1, status, rth->dump_fp); + fwrite(pad, 1, NLMSG_ALIGN(status) - status, rth->dump_fp); + } for (a = arg; a->filter; a++) { struct nlmsghdr *h = (struct nlmsghdr *)buf; -- 2.53.0