From efb4018be70b5936b1ea4527cd7e4cc5eab1bfa1 Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Sat, 21 Feb 2004 12:48:25 +0000 Subject: [PATCH] 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. --- sys/net/if.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/net/if.c b/sys/net/if.c index edec90f227eb..afec9f90408f 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -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