mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-08-13 22:20:26 +00:00
ip: fix igmp parsing when iface is long
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>
This commit is contained in:
parent
a05b9557f4
commit
530903dd90
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user