summaryrefslogtreecommitdiffstats
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>2001-10-17 04:23:14 +0000
committerfenner <fenner@FreeBSD.org>2001-10-17 04:23:14 +0000
commita6c2ac281a06cd68d22c5f9c91deb5186d940920 (patch)
treefa6a6f2d7c7f6554c7e2c1cc026ec36fffcdab4b /sys/net/if.c
parent1e7fe9f955a3d9d24a8f7545a033f8b90126e3bf (diff)
downloadFreeBSD-src-a6c2ac281a06cd68d22c5f9c91deb5186d940920.zip
FreeBSD-src-a6c2ac281a06cd68d22c5f9c91deb5186d940920.tar.gz
if_index is the highest interface index in the system, not the next
available index.
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 5e7b5bc1..f542b41 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -344,7 +344,7 @@ found:
name, unit, devname);
}
for (unit = 1; ; unit++) {
- if (unit < if_index && ifaddr_byindex(unit) != NULL)
+ if (unit <= if_index && ifaddr_byindex(unit) != NULL)
continue;
if (resource_string_value(name, unit, "ether", &p) == 0 ||
resource_string_value(name, unit, "dev", &p) == 0)
@@ -382,8 +382,8 @@ if_attach(ifp)
SLIST_INIT(&ifp->if_klist);
getmicrotime(&ifp->if_lastchange);
ifp->if_index = if_findindex(ifp);
- if (ifp->if_index >= if_index)
- if_index = ifp->if_index + 1;
+ if (ifp->if_index > if_index)
+ if_index = ifp->if_index;
if (if_index >= if_indexlim)
if_grow();
OpenPOWER on IntegriCloud