summaryrefslogtreecommitdiffstats
path: root/sys/net/if_mib.c
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2003-10-31 18:32:15 +0000
committerbrooks <brooks@FreeBSD.org>2003-10-31 18:32:15 +0000
commitf1e94c6f29b079e4ad9d9305ef3e90a719bcbbda (patch)
tree4d9e6671d486576767506230a4240131526fea49 /sys/net/if_mib.c
parentbe546fdee455a96afdefee10d0bdba8547399f5b (diff)
downloadFreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.zip
FreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.tar.gz
Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
Diffstat (limited to 'sys/net/if_mib.c')
-rw-r--r--sys/net/if_mib.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c
index b8e7ed6..f104b77 100644
--- a/sys/net/if_mib.c
+++ b/sys/net/if_mib.c
@@ -71,10 +71,9 @@ static int
sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
{
int *name = (int *)arg1;
- int error, ifnlen;
+ int error;
u_int namelen = arg2;
struct ifnet *ifp;
- char workbuf[64];
struct ifmibdata ifmd;
if (namelen != 2)
@@ -91,13 +90,7 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
return ENOENT;
case IFDATA_GENERAL:
- ifnlen = snprintf(workbuf, sizeof(workbuf),
- "%s%d", ifp->if_name, ifp->if_unit);
- if(ifnlen + 1 > sizeof ifmd.ifmd_name) {
- return ENAMETOOLONG;
- } else {
- strcpy(ifmd.ifmd_name, workbuf);
- }
+ strlcpy(ifmd.ifmd_name, ifp->if_xname, sizeof(ifmd.ifmd_name));
#define COPY(fld) ifmd.ifmd_##fld = ifp->if_##fld
COPY(pcount);
OpenPOWER on IntegriCloud