HomeFreeBSD

linux(4): Refactor socket ioctl path to avoid referencing an unstable interfaces

Description

linux(4): Refactor socket ioctl path to avoid referencing an unstable interfaces

Split the linux_ioctl_socket() function on two counterparts, where
the linux_ioctl_socket_ifreq() intended to use in a code path which
requires the struct ifreq manipulation, i.e., translating in/out
values of the struct, while the linux_ioctl_socket() function is left
as is, it calls sys_ioctl() without touching in/out values.

Due to structures ifreq, sockaddr difference between FreeBSD and Linux
the linux_ioctl_socket_ifreq() calls kern_ioctl() directly, converting
in and out values to FreeBSD and to Linux accordingly.

Finally, modify the ifname_linux_to_bsd() to return error code, not
an unstable reference to the interface.

Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38794