svn commit: r193796 - head/sys/net

Hiroki Sato hrs at FreeBSD.org
Tue Jun 9 02:28:00 UTC 2009


Author: hrs
Date: Tue Jun  9 02:27:59 2009
New Revision: 193796
URL: http://svn.freebsd.org/changeset/base/193796

Log:
  - Fix sanity check of GIFSOPTS ioctl.
  - Rename option mask s/GIF_FULLOPTS/GIF_OPTMASK/
  
  Spotted by:	Eygene Ryabinkin, delphij

Modified:
  head/sys/net/if_gif.c
  head/sys/net/if_gif.h

Modified: head/sys/net/if_gif.c
==============================================================================
--- head/sys/net/if_gif.c	Tue Jun  9 01:43:58 2009	(r193795)
+++ head/sys/net/if_gif.c	Tue Jun  9 02:27:59 2009	(r193796)
@@ -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;
 		}

Modified: head/sys/net/if_gif.h
==============================================================================
--- head/sys/net/if_gif.h	Tue Jun  9 01:43:58 2009	(r193795)
+++ head/sys/net/if_gif.h	Tue Jun  9 02:27:59 2009	(r193796)
@@ -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_ */


More information about the svn-src-all mailing list