Reinstate linux_ifname. Although the Linuxulator doesn't use it
itself, it's used outside the Linuxulator. Reimplement the function so that its behaviour matches the current renaming scheme. It's probably better to formalize these interdependencies.
This commit is contained in:
parent
74aac58b52
commit
bea90c29cf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=89379
@ -1817,6 +1817,33 @@ linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args)
|
||||
*/
|
||||
#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER)
|
||||
|
||||
/*
|
||||
* Interface function used by linprocfs (at the time of writing). It's not
|
||||
* used by the Linuxulator itself.
|
||||
*/
|
||||
int
|
||||
linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen)
|
||||
{
|
||||
struct ifnet *ifscan;
|
||||
int ethno;
|
||||
|
||||
/* Short-circuit non ethernet interfaces */
|
||||
if (!IFP_IS_ETH(ifp))
|
||||
return (snprintf(buffer, buflen, "%s%d", ifp->if_name,
|
||||
ifp->if_unit));
|
||||
|
||||
/* Determine the (relative) unit number for ethernet interfaces */
|
||||
ethno = 0;
|
||||
TAILQ_FOREACH(ifscan, &ifnet, if_link) {
|
||||
if (ifscan == ifp)
|
||||
return (snprintf(buffer, buflen, "eth%d", ethno));
|
||||
if (IFP_IS_ETH(ifscan))
|
||||
ethno++;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate a Linux interface name to a FreeBSD interface name,
|
||||
* and return the associated ifnet structure
|
||||
|
Loading…
Reference in New Issue
Block a user