[PATCH] [BZ #21812] getifaddrs() Don't return ifa entries with NULL names

Florian Weimer fweimer@redhat.com
Fri Jun 29 09:38:00 GMT 2018


On 06/29/2018 08:57 AM, Daniel Alvarez Sanchez wrote:
> Thanks a lot for reviewing. It'd be nice to get this in soon as it can
> happen easily on systems with lots of interfaces.
> 
> Here it's a reproducer:
> 
> $ sudo unshare -n
> # cat create-links.sh
> #!/bin/bash
> for i in {1..512}; do ifname="dum$i"; ip li add $ifname type dummy; ip
> li set $ifname up; done
> # ./create-links.sh
> # cat loop-add-del-link.sh
> #!/bin/bash
> while :; do ifname="test$RANDOM"; ip li add $ifname type dummy; ip li
> set $ifname up; sleep 0.1; ip li del $ifname; done
> # ./loop-add-del-link.sh &
> [1] 6260
> # ./loop-add-del-link.sh &
> [2] 6314
> # ./loop-add-del-link.sh &
> [3] 6374
> # ./loop-add-del-link.sh &
> [4] 6476
> # ./loop-add-del-link.sh &
> [5] 6628
> # cat dalvarez-tester.c
> #include <sys/types.h>
> #include <ifaddrs.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>

Can you come up with a test that uses the loopback interface and 
loopback aliases devices only (lo:NNN)?  Or is this not possible?

I don't want to implement all the Netlink stuff for creating a dummy 
interface, and the kernel module might not be available.

Thanks,
Florian



More information about the Libc-alpha mailing list