Improve the SIOCSIFCAP handler a bit:

- allow for ifp->if_ioctl being NULL, as the rest of ifioctl() does;
- give the interface driver a chance to report a error to the caller;
- don't forget to update ifp->if_lastchange upon successful modification
  of interface operation parameters.
This commit is contained in:
Yaroslav Tykhiy 2004-02-21 12:48:25 +00:00
parent 1b105d0c6e
commit efb4018be7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=126062

View File

@ -1351,9 +1351,13 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
error = suser(td);
if (error)
return (error);
if (ifp->if_ioctl == NULL)
return (EOPNOTSUPP);
if (ifr->ifr_reqcap & ~ifp->if_capabilities)
return (EINVAL);
(void) (*ifp->if_ioctl)(ifp, cmd, data);
error = (*ifp->if_ioctl)(ifp, cmd, data);
if (error == 0)
getmicrotime(&ifp->if_lastchange);
break;
#ifdef MAC