]> git.proxmox.com Git - mirror_iproute2.git/commit - ip/ipmaddr.c
ip maddr: fix filtering by device
authorMichal Kubecek <mkubecek@suse.cz>
Thu, 19 Oct 2017 08:21:08 +0000 (10:21 +0200)
committerStephen Hemminger <sthemmin@microsoft.com>
Sat, 21 Oct 2017 13:02:24 +0000 (15:02 +0200)
commit21503ed2af233ffe795926f6641ac84ec1b15bf9
treef6e63164acacbd1e942d390ffd7342dba30f3a27
parent572e8936130440d0e180cf62ed55fface2ae8719
ip maddr: fix filtering by device

Commit 530903dd9003 ("ip: fix igmp parsing when iface is long") uses
variable len to keep trailing colon from interface name comparison.  This
variable is local to loop body but we set it in one pass and use it in
following one(s) so that we are actually using (pseudo)random length for
comparison. This became apparent since commit b48a1161f5f9 ("ipmaddr: Avoid
accessing uninitialized data") always initializes len to zero so that the
name comparison is always true. As a result, "ip maddr show dev eth0" shows
IPv4 multicast addresses for all interfaces.

Instead of keeping the length, let's simply replace the trailing colon with
a null byte. The bonus is that we get correct interface name in ma.name.

Fixes: 530903dd9003 ("ip: fix igmp parsing when iface is long")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Acked-by: Phil Sutter <phil@nwl.cc>
Acked-by: Petr Vorel <pvorel@suse.cz>
ip/ipmaddr.c