Fix off by one error introduced by the use of the ifnet_byindex()

macro. The commit log clearly states that the index given to the
macro is one higher than previously used to index the array. This
wasn't represented in the code and resulted in kernel page faults.

Reported by: Andrew Atrens <atrens@nortelnetworks.com>
This commit is contained in:
Marcel Moolenaar 2001-09-14 08:04:25 +00:00
parent cfcb80526f
commit b7a81e06aa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83436
2 changed files with 2 additions and 2 deletions

View file

@ -202,7 +202,7 @@ osf1_ioctl_i(p, uap, cmd, dir, len)
* structure, as DU interface names are all different.
*/
for (ifn = 0; ifn < if_index; ifn++) {
ifp = ifnet_byindex(ifn);
ifp = ifnet_byindex(ifn + 1);
/* Only look at ether interfaces, exclude alteon nics
* because osf/1 doesn't know about most of them.
*/

View file

@ -1385,7 +1385,7 @@ linux_ioctl_socket(struct thread *td, struct linux_ioctl_args *args)
* structure, as Linux interface names are all different.
*/
for (ifn = 0; ifn < if_index; ifn++) {
ifp = ifnet_byindex(ifn);
ifp = ifnet_byindex(ifn + 1);
if (ifp->if_type == IFT_ETHER) {
ifa = TAILQ_FIRST(&ifp->if_addrhead);
while (ifa) {