From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH iproute2] ip maddr: fix filtering by device Date: Mon, 23 Oct 2017 14:42:24 +0200 Message-ID: <20171023144224.076200d0@shemminger-XPS-13-9360> References: <20171019082108.40D7AA0EDF@unicorn.suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Petr Vorel , Phil Sutter To: Michal Kubecek Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:55580 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932170AbdJWMme (ORCPT ); Mon, 23 Oct 2017 08:42:34 -0400 Received: by mail-wm0-f65.google.com with SMTP id u138so9569451wmu.4 for ; Mon, 23 Oct 2017 05:42:33 -0700 (PDT) In-Reply-To: <20171019082108.40D7AA0EDF@unicorn.suse.cz> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, 19 Oct 2017 10:21:08 +0200 (CEST) Michal Kubecek wrote: > 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 Applied