From 2bebb49117fd74a1d035743df818f1e47a110613 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Sun, 1 Mar 2009 11:01:00 +0000 Subject: [PATCH] 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 --- sys/net/vnet.h | 3 +++ sys/netinet/vinet.h | 3 +++ sys/netinet6/vinet6.h | 3 +++ sys/netipsec/vipsec.h | 3 +++ 4 files changed, 12 insertions(+) diff --git a/sys/net/vnet.h b/sys/net/vnet.h index b0216085465..93546103740 100644 --- a/sys/net/vnet.h +++ b/sys/net/vnet.h @@ -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; diff --git a/sys/netinet/vinet.h b/sys/netinet/vinet.h index e123006c02d..73cd3b98e39 100644 --- a/sys/netinet/vinet.h +++ b/sys/netinet/vinet.h @@ -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; diff --git a/sys/netinet6/vinet6.h b/sys/netinet6/vinet6.h index e0a1fa039a2..092020099cc 100644 --- a/sys/netinet6/vinet6.h +++ b/sys/netinet6/vinet6.h @@ -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; diff --git a/sys/netipsec/vipsec.h b/sys/netipsec/vipsec.h index 472a3368d61..2bc38cbe055 100644 --- a/sys/netipsec/vipsec.h +++ b/sys/netipsec/vipsec.h @@ -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;