linux(4): Add a counterpart to linux_ifflags

For further use in linux_ioctl_socket add bsd_to_linux_ifflags() which
accepts FreeBSD interface flags and translate it to Linux if flags.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D38873
This commit is contained in:
Dmitry Chagin 2023-03-04 12:26:48 +03:00
parent 945a7f0d21
commit 5c32488de0
2 changed files with 11 additions and 3 deletions

View File

@ -434,10 +434,17 @@ ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname)
unsigned short
linux_ifflags(struct ifnet *ifp)
{
unsigned short fl, flags;
unsigned short flags;
flags = if_getflags(ifp) | if_getdrvflags(ifp);
return (bsd_to_linux_ifflags(flags));
}
unsigned short
bsd_to_linux_ifflags(int fl)
{
unsigned short flags = 0;
fl = (if_getflags(ifp) | if_getdrvflags(ifp)) & 0xffff;
flags = 0;
if (fl & IFF_UP)
flags |= LINUX_IFF_UP;
if (fl & IFF_BROADCAST)

View File

@ -39,6 +39,7 @@ int ifname_linux_to_bsd(struct thread *, const char *, char *);
unsigned short linux_ifflags(struct ifnet *);
int linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa);
unsigned short bsd_to_linux_ifflags(int);
int linux_to_bsd_domain(int domain);
int bsd_to_linux_domain(int domain);
int bsd_to_linux_sockaddr(const struct sockaddr *sa,