From owner-p4-projects@FreeBSD.ORG Wed Jul 4 12:49:41 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 55CE716A46C; Wed, 4 Jul 2007 12:49:41 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E429916A468 for ; Wed, 4 Jul 2007 12:49:40 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id D2DC613C45A for ; Wed, 4 Jul 2007 12:49:40 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l64CneVx066463 for ; Wed, 4 Jul 2007 12:49:40 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l64Cne1r066460 for perforce@freebsd.org; Wed, 4 Jul 2007 12:49:40 GMT (envelope-from zec@FreeBSD.org) Date: Wed, 4 Jul 2007 12:49:40 GMT Message-Id: <200707041249.l64Cne1r066460@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 122852 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2007 12:49:41 -0000 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 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 #include @@ -40,10 +41,12 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -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 #include @@ -41,6 +42,7 @@ #include #include #include +#include #include #include @@ -67,6 +69,7 @@ #endif #endif /*FAST_IPSEC*/ +#include #include 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 -#include +#include +#include #include -#include #include +#include +#include +#include +#include #include -#include + #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 #include @@ -54,6 +55,7 @@ #include #include #include +#include #include #include @@ -67,6 +69,7 @@ #include #ifdef INET6 +#include #include #endif #include @@ -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 #include @@ -42,6 +43,7 @@ #include #include #include +#include #include #include @@ -53,6 +55,7 @@ #include #include #ifdef INET6 +#include #include #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 #include @@ -56,17 +57,20 @@ #include #include #include +#include #include #include #include +#include #include #include #include #include #ifdef INET6 +#include #include #include #include @@ -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 #include #include +#include #include #include +#include #include #include @@ -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 #include @@ -50,10 +51,12 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -62,6 +65,7 @@ #include #include #include +#include #include #include @@ -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;