Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jul 2007 12:49:40 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 122852 for review
Message-ID:  <200707041249.l64Cne1r066460@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=122852

Change 122852 by zec@zec_tpx32 on 2007/07/04 12:49:00

	Allow the kernel to be compiled if both VIMAGE and FAST_IPSEC
	options are enabled.
	Submitted by:	Ana Kukec <anchie@fer.hr>

Affected files ...

.. //depot/projects/vimage/src/sys/netinet/ip_ipsec.c#4 edit
.. //depot/projects/vimage/src/sys/netinet6/ip6_ipsec.c#2 edit
.. //depot/projects/vimage/src/sys/netinet6/vinet6.h#6 edit
.. //depot/projects/vimage/src/sys/netipsec/ipsec_input.c#4 edit
.. //depot/projects/vimage/src/sys/netipsec/ipsec_output.c#4 edit
.. //depot/projects/vimage/src/sys/netipsec/key.c#4 edit
.. //depot/projects/vimage/src/sys/netipsec/keysock.c#3 edit
.. //depot/projects/vimage/src/sys/netipsec/xform_ipip.c#2 edit

Differences ...

==== //depot/projects/vimage/src/sys/netinet/ip_ipsec.c#4 (text+ko) ====

@@ -30,6 +30,7 @@
  */
 
 #include "opt_ipsec.h"
+#include "opt_vimage.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -40,10 +41,12 @@
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
+#include <sys/vimage.h>
 
 #include <net/if.h>
 #include <net/route.h>
 
+#include <netinet/vinet.h>
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/in_var.h>
@@ -91,6 +94,7 @@
 ip_ipsec_fwd(struct mbuf *m)
 {
 #ifdef FAST_IPSEC
+	INIT_VNET_INET(curvnet);
 	struct m_tag *mtag;
 	struct tdb_ident *tdbi;
 	struct secpolicy *sp;
@@ -119,7 +123,7 @@
 	KEY_FREESP(&sp);
 	splx(s);
 	if (error) {
-		ipstat.ips_cantforward++;
+		V_ipstat.ips_cantforward++;
 		return 1;
 	}
 #endif /* FAST_IPSEC */

==== //depot/projects/vimage/src/sys/netinet6/ip6_ipsec.c#2 (text+ko) ====

@@ -30,6 +30,7 @@
  */
 
 #include "opt_ipsec.h"
+#include "opt_vimage.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,6 +42,7 @@
 #include <sys/socket.h>
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
+#include <sys/vimage.h>
 
 #include <net/if.h>
 #include <net/route.h>
@@ -67,6 +69,7 @@
 #endif
 #endif /*FAST_IPSEC*/
 
+#include <netinet6/vinet6.h>
 #include <netinet6/ip6_ipsec.h>
 
 extern	struct protosw inet6sw[];
@@ -99,6 +102,7 @@
 ip6_ipsec_fwd(struct mbuf *m)
 {
 #ifdef FAST_IPSEC
+	INIT_VNET_INET6(curvnet);
 	struct m_tag *mtag;
 	struct tdb_ident *tdbi;
 	struct secpolicy *sp;
@@ -126,7 +130,7 @@
 	KEY_FREESP(&sp);
 	splx(s);
 	if (error) {
-		ipstat.ips_cantforward++;
+		V_ip6stat.ip6s_cantforward++;
 		return 1;
 	}
 #endif /* FAST_IPSEC */

==== //depot/projects/vimage/src/sys/netinet6/vinet6.h#6 (text+ko) ====

@@ -34,12 +34,16 @@
 #define _NETINET6_VINET6_H_
 
 #include <netinet/ip6.h>
-#include <netinet/icmp6.h>
+#include <netinet/ip6.h>
+#include <netinet6/in6_var.h>
 #include <netinet6/ip6_var.h>
-#include <netinet6/in6_var.h>
 #include <netinet6/raw_ip6.h>
+#include <netinet/in_pcb.h>
+#include <netinet/icmp6.h>
+#include <netinet6/scope6_var.h>
+#include <netinet6/in6_ifattach.h>
 #include <netinet6/nd6.h>
-#include <netinet6/scope6_var.h>
+
 
 #define INIT_VNET_INET6(vnet) \
 	INIT_FROM_VNET(vnet, VNET_MOD_INET6, \

==== //depot/projects/vimage/src/sys/netipsec/ipsec_input.c#4 (text+ko) ====

@@ -44,6 +44,7 @@
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
 #include "opt_enc.h"
+#include "opt_vimage.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +55,7 @@
 #include <sys/socket.h>
 #include <sys/errno.h>
 #include <sys/syslog.h>
+#include <sys/vimage.h>
 
 #include <net/if.h>
 #include <net/route.h>
@@ -67,6 +69,7 @@
 
 #include <netinet/ip6.h>
 #ifdef INET6
+#include <netinet6/vinet6.h>
 #include <netinet6/ip6_var.h>
 #endif
 #include <netinet/in_pcb.h>
@@ -543,6 +546,7 @@
 ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int protoff,
     struct m_tag *mt)
 {
+	INIT_VNET_INET6(curvnet);
 	int prot, af, sproto;
 	struct ip6_hdr *ip6;
 	struct m_tag *mtag;
@@ -723,7 +727,7 @@
 	nxt = nxt8;
 	while (nxt != IPPROTO_DONE) {
 		if (ip6_hdrnestlimit && (++nest > ip6_hdrnestlimit)) {
-			ip6stat.ip6s_toomanyhdr++;
+			V_ip6stat.ip6s_toomanyhdr++;
 			error = EINVAL;
 			goto bad;
 		}
@@ -733,7 +737,7 @@
 		 * more sanity checks in header chain processing.
 		 */
 		if (m->m_pkthdr.len < skip) {
-			ip6stat.ip6s_tooshort++;
+			V_ip6stat.ip6s_tooshort++;
 			in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);
 			error = EINVAL;
 			goto bad;

==== //depot/projects/vimage/src/sys/netipsec/ipsec_output.c#4 (text+ko) ====

@@ -33,6 +33,7 @@
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
 #include "opt_enc.h"
+#include "opt_vimage.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -42,6 +43,7 @@
 #include <sys/socket.h>
 #include <sys/errno.h>
 #include <sys/syslog.h>
+#include <sys/vimage.h>
 
 #include <net/if.h>
 #include <net/route.h>
@@ -53,6 +55,7 @@
 #include <netinet/in_var.h>
 #include <netinet/ip_ecn.h>
 #ifdef INET6
+#include <netinet6/vinet6.h>
 #include <netinet6/ip6_ecn.h>
 #endif
 
@@ -679,6 +682,7 @@
 int
 ipsec6_output_tunnel(struct ipsec_output_state *state, struct secpolicy *sp, int flags)
 {
+	INIT_VNET_INET6(curvnet);
 	struct ip6_hdr *ip6;
 	struct ipsecrequest *isr;
 	struct secasindex saidx;
@@ -757,7 +761,7 @@
 			rtalloc(state->ro);
 		}
 		if (state->ro->ro_rt == 0) {
-			ip6stat.ip6s_noroute++;
+			V_ip6stat.ip6s_noroute++;
 			ipsec6stat.ips_out_noroute++;
 			error = EHOSTUNREACH;
 			goto bad;

==== //depot/projects/vimage/src/sys/netipsec/key.c#4 (text+ko) ====

@@ -37,6 +37,7 @@
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
+#include "opt_vimage.h"
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -56,17 +57,20 @@
 #include <sys/queue.h>
 #include <sys/refcount.h>
 #include <sys/syslog.h>
+#include <sys/vimage.h>
 
 #include <net/if.h>
 #include <net/route.h>
 #include <net/raw_cb.h>
 
+#include <netinet/vinet.h>
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/in_var.h>
 
 #ifdef INET6
+#include <netinet6/vinet6.h>
 #include <netinet/ip6.h>
 #include <netinet6/in6_var.h>
 #include <netinet6/ip6_var.h>
@@ -3689,6 +3693,7 @@
 	struct sockaddr *sa;
 {
 #ifdef INET
+	INIT_VNET_INET(curvnet);
 	struct sockaddr_in *sin;
 	struct in_ifaddr *ia;
 #endif
@@ -3699,7 +3704,7 @@
 #ifdef INET
 	case AF_INET:
 		sin = (struct sockaddr_in *)sa;
-		for (ia = in_ifaddrhead.tqh_first; ia;
+		for (ia = V_in_ifaddrhead.tqh_first; ia;
 		     ia = ia->ia_link.tqe_next)
 		{
 			if (sin->sin_family == ia->ia_addr.sin_family &&
@@ -3733,10 +3738,11 @@
 key_ismyaddr6(sin6)
 	struct sockaddr_in6 *sin6;
 {
+	INIT_VNET_INET6(curvnet);
 	struct in6_ifaddr *ia;
 	struct in6_multi *in6m;
 
-	for (ia = in6_ifaddr; ia; ia = ia->ia_next) {
+	for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) {
 		if (key_sockaddrcmp((struct sockaddr *)&sin6,
 		    (struct sockaddr *)&ia->ia_addr, 0) == 0)
 			return 1;

==== //depot/projects/vimage/src/sys/netipsec/keysock.c#3 (text+ko) ====

@@ -31,6 +31,7 @@
  */
 
 #include "opt_ipsec.h"
+#include "opt_vimage.h"
 
 /* This code has derived from sys/net/rtsock.c on FreeBSD2.2.5 */
 
@@ -49,9 +50,11 @@
 #include <sys/socketvar.h>
 #include <sys/sysctl.h>
 #include <sys/systm.h>
+#include <sys/vimage.h>
 
 #include <net/raw_cb.h>
 #include <net/route.h>
+#include <net/vnet.h>
 
 #include <net/pfkeyv2.h>
 #include <netipsec/key.h>
@@ -264,6 +267,7 @@
 	struct mbuf *m;
 	int target;
 {
+	INIT_VNET_NET(curvnet);
 	struct mbuf *n;
 	struct keycb *kp;
 	int sendup;
@@ -290,7 +294,7 @@
 		pfkeystat.in_msgtype[msg->sadb_msg_type]++;
 	}
 	mtx_lock(&rawcb_mtx);
-	LIST_FOREACH(rp, &rawcb_list, list)
+	LIST_FOREACH(rp, &V_rawcb_list, list)
 	{
 		if (rp->rcb_proto.sp_family != PF_KEY)
 			continue;

==== //depot/projects/vimage/src/sys/netipsec/xform_ipip.c#2 (text+ko) ====

@@ -42,6 +42,7 @@
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_enc.h"
+#include "opt_vimage.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,10 +51,12 @@
 #include <sys/kernel.h>
 #include <sys/protosw.h>
 #include <sys/sysctl.h>
+#include <sys/vimage.h>
 
 #include <net/if.h>
 #include <net/route.h>
 #include <net/netisr.h>
+#include <net/vnet.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
@@ -62,6 +65,7 @@
 #include <netinet/ip_ecn.h>
 #include <netinet/ip_var.h>
 #include <netinet/ip_encap.h>
+#include <netinet/vinet.h>
 
 #include <netipsec/ipsec.h>
 #include <netipsec/xform.h>
@@ -154,6 +158,7 @@
 static void
 _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
 {
+	INIT_VNET_NET(curvnet);
 	register struct sockaddr_in *sin;
 	register struct ifnet *ifp;
 	register struct ifaddr *ifa;
@@ -301,7 +306,7 @@
 	    !(m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK)) &&
 	    ipip_allow != 2) {
 	    	IFNET_RLOCK();
-		TAILQ_FOREACH(ifp, &ifnet, if_link) {
+		TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
 			TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
 #ifdef INET
 				if (ipo) {
@@ -391,6 +396,9 @@
 	int protoff
 )
 {
+#ifdef INET
+	INIT_VNET_INET(curvnet);
+#endif /* INET */
 	struct secasvar *sav;
 	u_int8_t tp, otos;
 	struct secasindex *saidx;
@@ -443,7 +451,7 @@
 		ipo->ip_v = IPVERSION;
 		ipo->ip_hl = 5;
 		ipo->ip_len = htons(m->m_pkthdr.len);
-		ipo->ip_ttl = ip_defttl;
+		ipo->ip_ttl = V_ip_defttl;
 		ipo->ip_sum = 0;
 		ipo->ip_src = saidx->src.sin.sin_addr;
 		ipo->ip_dst = saidx->dst.sin.sin_addr;
@@ -528,7 +536,7 @@
 		ip6o->ip6_vfc &= ~IPV6_VERSION_MASK;
 		ip6o->ip6_vfc |= IPV6_VERSION;
 		ip6o->ip6_plen = htons(m->m_pkthdr.len);
-		ip6o->ip6_hlim = ip_defttl;
+		ip6o->ip6_hlim = V_ip_defttl;
 		ip6o->ip6_dst = saidx->dst.sin6.sin6_addr;
 		ip6o->ip6_src = saidx->src.sin6.sin6_addr;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707041249.l64Cne1r066460>