network: 0.882 graphic: 0.879 vnc: 0.870 socket: 0.857 performance: 0.846 semantic: 0.844 architecture: 0.840 arm: 0.840 device: 0.834 PID: 0.825 files: 0.808 risc-v: 0.805 ppc: 0.805 register: 0.804 peripherals: 0.801 mistranslation: 0.801 hypervisor: 0.797 debug: 0.793 kernel: 0.793 x86: 0.784 virtual: 0.783 boot: 0.776 VMM: 0.771 permissions: 0.771 KVM: 0.767 i386: 0.744 assembly: 0.725 TCG: 0.720 user-level: 0.594 SIOCGIFNAME takes a struct ifreq not an integer The ioctl SIOCGIFNAME takes a pointer to a struct ifreq, not an integer. This leads to if_indextoname() not correctly returning interface names (well, not if they're longer than 4 characters including the trailing NULL ;-). This is observed on v3.1.0. The following one-line patch will be sent to the qemu-devel mailing list: """ diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h index ae8951625f..37501f575c 100644 --- a/linux-user/ioctls.h +++ b/linux-user/ioctls.h @@ -178,7 +178,7 @@ #endif /* CONFIG_USBFS */ IOCTL(SIOCATMARK, IOC_R, MK_PTR(TYPE_INT)) - IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(TYPE_INT)) + IOCTL(SIOCGIFNAME, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_int_ifreq))) IOCTL(SIOCGIFFLAGS, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) IOCTL(SIOCSIFFLAGS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_short_ifreq))) IOCTL(SIOCGIFADDR, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_sockaddr_ifreq))) """ Your suggested fix looks good -- did you want to send it to qemu-devel with a suitable Signed-off-by: line ? Sure. Looking at HEAD, and even the surrounding the lines, I think I should have tried STRUCT_short_ifreq instead of STRUCT_int_ifreq, though I'm not sure what the real difference would be. I'll try to test internally with the _short_ version and if that works send that. On Wed, 10 Apr 2019 at 01:26, Erik Kline