- Fix sanity check of GIFSOPTS ioctl.

- Rename option mask s/GIF_FULLOPTS/GIF_OPTMASK/

Spotted by:	Eygene Ryabinkin, delphij
This commit is contained in:
Hiroki Sato 2009-06-09 02:27:59 +00:00
parent 38676b52dd
commit fb70e72b0c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=193796
2 changed files with 6 additions and 6 deletions

View File

@ -912,10 +912,10 @@ gif_ioctl(ifp, cmd, data)
case GIFSOPTS:
if ((error = priv_check(curthread, PRIV_NET_GIF)) != 0)
break;
if ((error = copyin(&options, &sc->gif_options,
sizeof(sc->gif_options)))) {
if ((options | GIF_FULLOPTS) == GIF_FULLOPTS)
ifr->ifr_data = (caddr_t)options;
if (!(error = copyin(ifr->ifr_data, &options,
sizeof(options)))) {
if ((options | GIF_OPTMASK) == GIF_OPTMASK)
sc->gif_options = options;
else
error = EINVAL;
}

View File

@ -150,11 +150,11 @@ extern struct vnet_gif vnet_gif_0;
#endif /* _KERNEL */
#define GIFGOPTS _IOR('i', 150, struct ifreq)
#define GIFGOPTS _IOWR('i', 150, struct ifreq)
#define GIFSOPTS _IOW('i', 151, struct ifreq)
#define GIF_ACCEPT_REVETHIP 0x0001
#define GIF_SEND_REVETHIP 0x0010
#define GIF_FULLOPTS (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)
#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)
#endif /* _NET_IF_GIF_H_ */