From owner-p4-projects@FreeBSD.ORG Fri Jan 26 12:01:19 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 405F016A4D7; Fri, 26 Jan 2007 12:01:19 +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 D69E116A4D0 for ; Fri, 26 Jan 2007 12:01:18 +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 BEE0D13C4B9 for ; Fri, 26 Jan 2007 12:01:18 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0QC1Iae011756 for ; Fri, 26 Jan 2007 12:01:18 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0QC1IXw011742 for perforce@freebsd.org; Fri, 26 Jan 2007 12:01:18 GMT (envelope-from zec@FreeBSD.org) Date: Fri, 26 Jan 2007 12:01:18 GMT Message-Id: <200701261201.l0QC1IXw011742@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 113551 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: Fri, 26 Jan 2007 12:01:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=113551 Change 113551 by zec@zec_tca51 on 2007/01/26 12:00:29 Let gif(4) compile with options VIMAGE. Affected files ... .. //depot/projects/vimage/src/sys/netinet/in_gif.c#2 edit .. //depot/projects/vimage/src/sys/netinet/vinet.h#9 edit .. //depot/projects/vimage/src/sys/netinet6/in6_gif.c#3 edit Differences ... ==== //depot/projects/vimage/src/sys/netinet/in_gif.c#2 (text+ko) ==== @@ -33,6 +33,7 @@ #include "opt_mrouting.h" #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_vimage.h" #include #include @@ -43,12 +44,13 @@ #include #include #include - #include +#include #include #include +#include #include #include #include @@ -70,6 +72,7 @@ static int gif_validate4(const struct ip *, struct gif_softc *, struct ifnet *); +static void in_gif_init(void); extern struct domain inetdomain; struct protosw in_gif_protosw = { @@ -80,12 +83,23 @@ .pr_input = in_gif_input, .pr_output = (pr_output_t*)rip_output, .pr_ctloutput = rip_ctloutput, + .pr_init = in_gif_init, .pr_usrreqs = &rip_usrreqs }; -static int ip_gif_ttl = GIF_TTL; -SYSCTL_INT(_net_inet_ip, IPCTL_GIF_TTL, gifttl, CTLFLAG_RW, - &ip_gif_ttl, 0, ""); +#ifndef VIMAGE +static int ip_gif_ttl; +#endif +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_GIF_TTL, gifttl, + CTLFLAG_RW, ip_gif_ttl, 0, ""); + +static void +in_gif_init(void) +{ + INIT_VNET_INET(curvnetb); + + V_ip_gif_ttl = GIF_TTL; +} int in_gif_output(ifp, family, m) @@ -93,6 +107,7 @@ int family; struct mbuf *m; { + INIT_VNET_INET(ifp->if_vnetb); struct gif_softc *sc = ifp->if_softc; struct sockaddr_in *dst = (struct sockaddr_in *)&sc->gif_ro.ro_dst; struct sockaddr_in *sin_src = (struct sockaddr_in *)sc->gif_psrc; @@ -177,7 +192,7 @@ } iphdr.ip_p = proto; /* version will be set in ip_output() */ - iphdr.ip_ttl = ip_gif_ttl; + iphdr.ip_ttl = V_ip_gif_ttl; iphdr.ip_len = m->m_pkthdr.len + sizeof(struct ip); ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED : ECN_NOCARE, &iphdr.ip_tos, &tos); @@ -242,6 +257,7 @@ struct mbuf *m; int off; { + INIT_VNET_INET(curvnetb); struct ifnet *gifp = NULL; struct gif_softc *sc; struct ip *ip; @@ -255,14 +271,14 @@ sc = (struct gif_softc *)encap_getarg(m); if (sc == NULL) { m_freem(m); - ipstat.ips_nogif++; + V_ipstat.ips_nogif++; return; } gifp = GIF2IFP(sc); if (gifp == NULL || (gifp->if_flags & IFF_UP) == 0) { m_freem(m); - ipstat.ips_nogif++; + V_ipstat.ips_nogif++; return; } @@ -322,7 +338,7 @@ break; default: - ipstat.ips_nogif++; + V_ipstat.ips_nogif++; m_freem(m); return; } @@ -339,6 +355,7 @@ struct gif_softc *sc; struct ifnet *ifp; { + INIT_VNET_INET(curvnetb); struct sockaddr_in *src, *dst; struct in_ifaddr *ia4; @@ -358,7 +375,7 @@ return 0; } /* reject packets with broadcast on source */ - TAILQ_FOREACH(ia4, &in_ifaddrhead, ia_link) { + TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) continue; if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) ==== //depot/projects/vimage/src/sys/netinet/vinet.h#9 (text+ko) ==== @@ -104,6 +104,8 @@ int _rtq_timeout; struct callout _rtq_timer; + + int _ip_gif_ttl; }; extern struct vnet_inet vnet_inet_0; @@ -167,4 +169,6 @@ #define V_rtq_timeout VNET_INET(rtq_timeout) #define V_rtq_timer VNET_INET(rtq_timer) +#define V_ip_gif_ttl VNET_INET(ip_gif_ttl) + #endif /* !_NETINET_VINET_H_ */ ==== //depot/projects/vimage/src/sys/netinet6/in6_gif.c#3 (text+ko) ==== @@ -32,6 +32,7 @@ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_vimage.h" #include #include @@ -42,8 +43,8 @@ #include #include #include - #include +#include #include #include @@ -55,6 +56,7 @@ #endif #include #ifdef INET6 +#include #include #include #include @@ -247,6 +249,7 @@ struct mbuf **mp; int *offp, proto; { + INIT_VNET_INET6(curvnetb); struct mbuf *m = *mp; struct ifnet *gifp = NULL; struct gif_softc *sc; @@ -259,14 +262,14 @@ sc = (struct gif_softc *)encap_getarg(m); if (sc == NULL) { m_freem(m); - ip6stat.ip6s_nogif++; + V_ip6stat.ip6s_nogif++; return IPPROTO_DONE; } gifp = GIF2IFP(sc); if (gifp == NULL || (gifp->if_flags & IFF_UP) == 0) { m_freem(m); - ip6stat.ip6s_nogif++; + V_ip6stat.ip6s_nogif++; return IPPROTO_DONE; } @@ -321,7 +324,7 @@ break; default: - ip6stat.ip6s_nogif++; + V_ip6stat.ip6s_nogif++; m_freem(m); return IPPROTO_DONE; }