* [PATCH 1/1] ip: fix igmp parsing when iface is long
@ 2017-01-16 23:25 Petr Vorel
2017-01-17 8:08 ` Petr Vorel
2017-01-17 16:41 ` Stephen Hemminger
0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2017-01-16 23:25 UTC (permalink / raw)
To: netdev; +Cc: Petr Vorel
Entries with long vhost names in /proc/net/igmp have no whitespace
between name and colon, so sscanf() adds it to vhost and
'ip maddr show iface' doesn't include inet result.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
ip/ipmaddr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c
index 22eb407..4f726fd 100644
--- a/ip/ipmaddr.c
+++ b/ip/ipmaddr.c
@@ -136,13 +136,17 @@ static void read_igmp(struct ma_info **result_p)
while (fgets(buf, sizeof(buf), fp)) {
struct ma_info *ma;
+ size_t len;
if (buf[0] != '\t') {
sscanf(buf, "%d%s", &m.index, m.name);
+ len = strlen(m.name);
+ if (m.name[len - 1] == ':')
+ len--;
continue;
}
- if (filter.dev && strcmp(filter.dev, m.name))
+ if (filter.dev && strncmp(filter.dev, m.name, len))
continue;
sscanf(buf, "%08x%d", (__u32 *)&m.addr.data, &m.users);
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] ip: fix igmp parsing when iface is long
2017-01-16 23:25 [PATCH 1/1] ip: fix igmp parsing when iface is long Petr Vorel
@ 2017-01-17 8:08 ` Petr Vorel
2017-01-17 16:41 ` Stephen Hemminger
2017-01-17 16:41 ` Stephen Hemminger
1 sibling, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2017-01-17 8:08 UTC (permalink / raw)
To: netdev
Hi,
> Entries with long vhost names in /proc/net/igmp have no whitespace
> between name and colon, so sscanf() adds it to vhost and
> 'ip maddr show iface' doesn't include inet result.
Bug was also reported to bugzilla (https://bugzilla.kernel.org/show_bug.cgi?id=192741),
with updated comment in the patch.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] ip: fix igmp parsing when iface is long
2017-01-17 8:08 ` Petr Vorel
@ 2017-01-17 16:41 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2017-01-17 16:41 UTC (permalink / raw)
To: Petr Vorel; +Cc: netdev
On Tue, 17 Jan 2017 09:08:09 +0100
Petr Vorel <pvorel@suse.cz> wrote:
> Hi,
>
> > Entries with long vhost names in /proc/net/igmp have no whitespace
> > between name and colon, so sscanf() adds it to vhost and
> > 'ip maddr show iface' doesn't include inet result.
>
> Bug was also reported to bugzilla (https://bugzilla.kernel.org/show_bug.cgi?id=192741),
> with updated comment in the patch.
>
>
> Kind regards,
> Petr
Kernel bugzilla is irrelevant and ignored by network developers.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] ip: fix igmp parsing when iface is long
2017-01-16 23:25 [PATCH 1/1] ip: fix igmp parsing when iface is long Petr Vorel
2017-01-17 8:08 ` Petr Vorel
@ 2017-01-17 16:41 ` Stephen Hemminger
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2017-01-17 16:41 UTC (permalink / raw)
To: Petr Vorel; +Cc: netdev
On Tue, 17 Jan 2017 00:25:50 +0100
Petr Vorel <pvorel@suse.cz> wrote:
> Entries with long vhost names in /proc/net/igmp have no whitespace
> between name and colon, so sscanf() adds it to vhost and
> 'ip maddr show iface' doesn't include inet result.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
Looks good, applied
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-17 16:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-16 23:25 [PATCH 1/1] ip: fix igmp parsing when iface is long Petr Vorel
2017-01-17 8:08 ` Petr Vorel
2017-01-17 16:41 ` Stephen Hemminger
2017-01-17 16:41 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).