svn commit: r189225 - in head/sys: net netinet netinet6 netipsec

Bjoern A. Zeeb bz at FreeBSD.org
Sun Mar 1 03:01:02 PST 2009


Author: bz
Date: Sun Mar  1 11:01:00 2009
New Revision: 189225
URL: http://svn.freebsd.org/changeset/base/189225

Log:
  Add size-guards evaluated at compile-time to the main struct vnet_*
  which are not in a module of their own like gif.
  
  Single kernel compiles and universe will fail if the size of the struct
  changes. Th expected values are given in sys/vimage.h.
  See the comments where how to handle this.
  
  Requested by:	peter

Modified:
  head/sys/net/vnet.h
  head/sys/netinet/vinet.h
  head/sys/netinet6/vinet6.h
  head/sys/netipsec/vipsec.h

Modified: head/sys/net/vnet.h
==============================================================================
--- head/sys/net/vnet.h	Sun Mar  1 10:51:34 2009	(r189224)
+++ head/sys/net/vnet.h	Sun Mar  1 11:01:00 2009	(r189225)
@@ -56,6 +56,9 @@ struct vnet_net {
 	int	_ether_ipfw;
 };
 
+/* Size guard. See sys/vimage.h. */
+VIMAGE_CTASSERT(SIZEOF_vnet_net, sizeof(struct vnet_net));
+
 #ifndef VIMAGE
 #ifndef VIMAGE_GLOBALS
 extern struct vnet_net vnet_net_0;

Modified: head/sys/netinet/vinet.h
==============================================================================
--- head/sys/netinet/vinet.h	Sun Mar  1 10:51:34 2009	(r189224)
+++ head/sys/netinet/vinet.h	Sun Mar  1 11:01:00 2009	(r189225)
@@ -196,6 +196,9 @@ struct vnet_inet {
 	int	_fw_one_pass;
 };
 
+/* Size guard. See sys/vimage.h. */
+VIMAGE_CTASSERT(SIZEOF_vnet_inet, sizeof(struct vnet_inet));
+
 #ifndef VIMAGE
 #ifndef VIMAGE_GLOBALS
 extern struct vnet_inet vnet_inet_0;

Modified: head/sys/netinet6/vinet6.h
==============================================================================
--- head/sys/netinet6/vinet6.h	Sun Mar  1 10:51:34 2009	(r189224)
+++ head/sys/netinet6/vinet6.h	Sun Mar  1 11:01:00 2009	(r189225)
@@ -155,6 +155,9 @@ struct vnet_inet6 {
 	struct ip6_pktopts		_ip6_opts;
 };
 
+/* Size guard. See sys/vimage.h. */
+VIMAGE_CTASSERT(SIZEOF_vnet_inet6, sizeof(struct vnet_inet6));
+
 #ifndef VIMAGE
 #ifndef VIMAGE_GLOBALS
 extern struct vnet_inet6 vnet_inet6_0;

Modified: head/sys/netipsec/vipsec.h
==============================================================================
--- head/sys/netipsec/vipsec.h	Sun Mar  1 10:51:34 2009	(r189224)
+++ head/sys/netipsec/vipsec.h	Sun Mar  1 11:01:00 2009	(r189225)
@@ -107,6 +107,9 @@ struct vnet_ipsec {
 	LIST_HEAD(, secspacq)	_spacqtree;
 };
 
+/* Size guard. See sys/vimage.h. */
+VIMAGE_CTASSERT(SIZEOF_vnet_ipsec, sizeof(struct vnet_ipsec));
+
 #ifndef VIMAGE
 #ifndef VIMAGE_GLOBALS
 extern struct vnet_ipsec vnet_ipsec_0;


More information about the svn-src-head mailing list