aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if_mib.c
diff options
context:
space:
mode:
authorBill Fenner <fenner@FreeBSD.org>2001-10-17 04:12:29 +0000
committerBill Fenner <fenner@FreeBSD.org>2001-10-17 04:12:29 +0000
commitb9d45cebf476588f9bbe0c5534fd3a7cb2f0528e (patch)
tree3a092a48e9ca517c0577423fc3e3894299750bb4 /sys/net/if_mib.c
parent2856a77139a76205cd66217939530c786622e23c (diff)
downloadsrc-b9d45cebf476588f9bbe0c5534fd3a7cb2f0528e.tar.gz
src-b9d45cebf476588f9bbe0c5534fd3a7cb2f0528e.zip
The interface index space may be sparsely populated (e.g. when an
interface in the middle is if_detach()'d). Return (and handle) ENOENT when the ifmib(4) is accessed for a nonexistent interface. MFC after: 14 days
Notes
Notes: svn path=/head/; revision=85040
Diffstat (limited to 'sys/net/if_mib.c')
-rw-r--r--sys/net/if_mib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c
index 5b04cbb2ba32..b8e7ed6f6766 100644
--- a/sys/net/if_mib.c
+++ b/sys/net/if_mib.c
@@ -80,7 +80,8 @@ sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */
if (namelen != 2)
return EINVAL;
- if (name[0] <= 0 || name[0] > if_index)
+ if (name[0] <= 0 || name[0] > if_index ||
+ ifaddr_byindex(name[0]) == NULL)
return ENOENT;
ifp = ifaddr_byindex(name[0])->ifa_ifp;