"netstat -ia" is missing multicast addresses on some interfaces. These addresses are shown correctly in "ifmcstat". The bug is in netstat/if.c function next_ifma(), it does a strcmp() on sdl->sdl_data but the interface name may not be NULL terminated. This should be changed to a strncmp() with length sdl->sdl_nlen
Created attachment 263078 [details] Suggested patch
Do we also need to check that the length of "name" is equal to sdl_nlen? Could you please attach patches emitted by git-format-patch? That'd make it easier to apply them to the tree.
Created attachment 263751 [details] Updated patch Added an updated patch, checking the length and from git-format-patch
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=0952943a680dca12fe8f65f8813a9dca0783ce88 commit 0952943a680dca12fe8f65f8813a9dca0783ce88 Author: Nick Reilly <nreilly@qnx.com> AuthorDate: 2025-09-12 19:27:59 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-10-03 14:32:09 +0000 netstat: Fix -ia missing multicast addresses on some interfaces sdl_data isn't always NULL terminated Signed-off-by: nreilly@qnx.com PR: 288958 Reviewed by: markj MFC after: 1 week usr.bin/netstat/if.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=54a72bbaee2eeed26f8a06bb28a1fc52f24789f7 commit 54a72bbaee2eeed26f8a06bb28a1fc52f24789f7 Author: Nick Reilly <nreilly@qnx.com> AuthorDate: 2025-09-12 19:27:59 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-10-11 15:21:48 +0000 netstat: Fix -ia missing multicast addresses on some interfaces sdl_data isn't always NULL terminated Signed-off-by: nreilly@qnx.com PR: 288958 Reviewed by: markj MFC after: 1 week (cherry picked from commit 0952943a680dca12fe8f65f8813a9dca0783ce88) usr.bin/netstat/if.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=146b7bb2a111b2d01dc4ce555237a724de27f6cb commit 146b7bb2a111b2d01dc4ce555237a724de27f6cb Author: Nick Reilly <nreilly@qnx.com> AuthorDate: 2025-09-12 19:27:59 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2025-10-11 15:22:45 +0000 netstat: Fix -ia missing multicast addresses on some interfaces sdl_data isn't always NULL terminated Signed-off-by: nreilly@qnx.com PR: 288958 Reviewed by: markj MFC after: 1 week (cherry picked from commit 0952943a680dca12fe8f65f8813a9dca0783ce88) usr.bin/netstat/if.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Thank you for the patch.