summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2003-12-26 18:09:35 +0000
committergreen <green@FreeBSD.org>2003-12-26 18:09:35 +0000
commit0c878eef027c8107cc08f8198c283e3abeb31c53 (patch)
treeee885881036e32c846bc221d47e1916e8e560f4b /sys/net/if.c
parent11930a9c8cd405e9cf40384f3e059d6c00118835 (diff)
downloadFreeBSD-src-0c878eef027c8107cc08f8198c283e3abeb31c53.zip
FreeBSD-src-0c878eef027c8107cc08f8198c283e3abeb31c53.tar.gz
Don't truncate the interface name in ifunit(). It's now possible to query
"very long interface names", e.g.: ndis_atheros0: flags=8847<UP,BROADCAST,DEBUG,RUNNING,SIMPLEX,MULTICAST> mtu 1500
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 447e4a1..6453be4 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1229,7 +1229,7 @@ if_slowtimo(void *arg)
struct ifnet *
ifunit(const char *name)
{
- char namebuf[IFNAMSIZ + 1];
+ char namebuf[IFNAMSIZ + sizeof("net")]; /* XXX net_cdevsw.d_name */
struct ifnet *ifp;
dev_t dev;
@@ -1241,7 +1241,7 @@ ifunit(const char *name)
* XXX
* Devices should really be known as /dev/fooN, not /dev/net/fooN.
*/
- snprintf(namebuf, IFNAMSIZ, "%s/%s", net_cdevsw.d_name, name);
+ snprintf(namebuf, sizeof(namebuf), "%s/%s", net_cdevsw.d_name, name);
IFNET_RLOCK();
TAILQ_FOREACH(ifp, &ifnet, if_link) {
dev = ifdev_byindex(ifp->if_index);
OpenPOWER on IntegriCloud