diff --git a/sys/net/if.c b/sys/net/if.c --- a/sys/net/if.c +++ b/sys/net/if.c @@ -868,6 +868,7 @@ #ifdef MAC mac_ifnet_create(ifp); #endif + strlcpy(ifp->if_orig_name, ifp->if_xname, sizeof(ifp->if_orig_name)); /* * Create a Link Level name for this device. @@ -4294,6 +4295,12 @@ return (0); } +const char * +if_getorigname(if_t ifp) +{ + return (ifp->if_orig_name); +} + int if_togglecapenable(if_t ifp, int togglecap) { diff --git a/sys/net/if_private.h b/sys/net/if_private.h --- a/sys/net/if_private.h +++ b/sys/net/if_private.h @@ -184,6 +184,7 @@ struct debugnet_methods *if_debugnet_methods; struct epoch_context if_epoch_ctx; + char if_orig_name[IFNAMSIZ]; /* original interface name */ /* * Spare fields to be added before branching a stable branch, so * that structure can be enhanced without changing the kernel diff --git a/sys/net/if_var.h b/sys/net/if_var.h --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -587,6 +587,7 @@ int if_getindex(const if_t ifp); int if_getidxgen(const if_t ifp); const char *if_getdname(const if_t ifp); +const char *if_getorigname(const if_t ifp); void if_setdname(if_t ifp, const char *name); const char *if_name(if_t ifp); int if_setname(if_t ifp, const char *name);