diff options
author | fenner <fenner@FreeBSD.org> | 2001-10-17 04:12:29 +0000 |
---|---|---|
committer | fenner <fenner@FreeBSD.org> | 2001-10-17 04:12:29 +0000 |
commit | 1e7fe9f955a3d9d24a8f7545a033f8b90126e3bf (patch) | |
tree | 3a092a48e9ca517c0577423fc3e3894299750bb4 /sys/net | |
parent | b69c7c0b789e7ca4de555baab2ee087e1bb5d231 (diff) | |
download | FreeBSD-src-1e7fe9f955a3d9d24a8f7545a033f8b90126e3bf.zip FreeBSD-src-1e7fe9f955a3d9d24a8f7545a033f8b90126e3bf.tar.gz |
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
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_mib.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c index 5b04cbb..b8e7ed6 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; |