From owner-svn-src-head@FreeBSD.ORG Thu Dec 25 18:44:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28DB37BA; Thu, 25 Dec 2014 18:44:08 +0000 (UTC) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id CB65F12FA; Thu, 25 Dec 2014 18:44:07 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id BF76F35930A; Thu, 25 Dec 2014 19:44:04 +0100 (CET) Received: by snail.stack.nl (Postfix, from userid 1677) id 964AB28494; Thu, 25 Dec 2014 19:44:04 +0100 (CET) Date: Thu, 25 Dec 2014 19:44:04 +0100 From: Jilles Tjoelker To: "Andrey V. Elsukov" Subject: Re: svn commit: r276148 - in head: . sys/net sys/netinet sys/netinet6 Message-ID: <20141225184404.GA28866@stack.nl> References: <201412231617.sBNGHcfe010367@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201412231617.sBNGHcfe010367@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Dec 2014 18:44:08 -0000 On Tue, Dec 23, 2014 at 04:17:38PM +0000, Andrey V. Elsukov wrote: > Author: ae > Date: Tue Dec 23 16:17:37 2014 > New Revision: 276148 > URL: https://svnweb.freebsd.org/changeset/base/276148 > Log: > Remove in_gif.h and in6_gif.h files. They only contain function > declarations used by gif(4). Instead declare these functions in C files. > Also make some variables static. Although making things static where possible is good, moving extern declarations to C files adds duplication and loses compile-time checking that the functions' calls match their definitions (output/encapcheck/attach). > [snip] > Modified: head/sys/net/if_gif.c > ============================================================================== > --- head/sys/net/if_gif.c Tue Dec 23 16:00:25 2014 (r276147) > +++ head/sys/net/if_gif.c Tue Dec 23 16:17:37 2014 (r276148) > @@ -72,7 +72,6 @@ __FBSDID("$FreeBSD$"); > #include > #ifdef INET > #include > -#include > #include > #endif /* INET */ > > @@ -85,7 +84,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > -#include > #include > #endif /* INET6 */ > > @@ -120,6 +118,16 @@ void (*ng_gif_input_orphan_p)(struct ifn > void (*ng_gif_attach_p)(struct ifnet *ifp); > void (*ng_gif_detach_p)(struct ifnet *ifp); > > +#ifdef INET > +extern int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t); > +extern int in_gif_encapcheck(const struct mbuf *, int, int, void *); > +extern int in_gif_attach(struct gif_softc *); > +#endif > +#ifdef INET6 > +extern int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t); > +extern int in6_gif_encapcheck(const struct mbuf *, int, int, void *); > +extern int in6_gif_attach(struct gif_softc *); > +#endif > static int gif_set_tunnel(struct ifnet *, struct sockaddr *, > struct sockaddr *); > static void gif_delete_tunnel(struct ifnet *); > > Modified: head/sys/netinet/in_gif.c > ============================================================================== > --- head/sys/netinet/in_gif.c Tue Dec 23 16:00:25 2014 (r276147) > +++ head/sys/netinet/in_gif.c Tue Dec 23 16:17:37 2014 (r276148) > @@ -57,7 +57,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > -#include > #include > #include > #include > @@ -68,11 +67,16 @@ __FBSDID("$FreeBSD$"); > > #include > > +int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t); > +int in_gif_encapcheck(const struct mbuf *, int, int, void *); > +int in_gif_attach(struct gif_softc *); > + > static int gif_validate4(const struct ip *, struct gif_softc *, > struct ifnet *); > +static int in_gif_input(struct mbuf **, int *, int); > > extern struct domain inetdomain; > -struct protosw in_gif_protosw = { > +static struct protosw in_gif_protosw = { > .pr_type = SOCK_RAW, > .pr_domain = &inetdomain, > .pr_protocol = 0/* IPPROTO_IPV[46] */, > @@ -83,7 +87,8 @@ struct protosw in_gif_protosw = { > .pr_usrreqs = &rip_usrreqs > }; > > -VNET_DEFINE(int, ip_gif_ttl) = GIF_TTL; > +#define GIF_TTL 30 > +static VNET_DEFINE(int, ip_gif_ttl) = GIF_TTL; > #define V_ip_gif_ttl VNET(ip_gif_ttl) > SYSCTL_INT(_net_inet_ip, IPCTL_GIF_TTL, gifttl, CTLFLAG_VNET | CTLFLAG_RW, > &VNET_NAME(ip_gif_ttl), 0, ""); > @@ -133,7 +138,7 @@ in_gif_output(struct ifnet *ifp, struct > return (ip_output(m, NULL, NULL, 0, NULL, NULL)); > } > > -int > +static int > in_gif_input(struct mbuf **mp, int *offp, int proto) > { > struct mbuf *m = *mp; > > Modified: head/sys/netinet6/in6_gif.c > ============================================================================== > --- head/sys/netinet6/in6_gif.c Tue Dec 23 16:00:25 2014 (r276147) > +++ head/sys/netinet6/in6_gif.c Tue Dec 23 16:17:37 2014 (r276148) > @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); > #ifdef INET6 > #include > #include > -#include > #include > #endif > #include > @@ -74,18 +73,24 @@ __FBSDID("$FreeBSD$"); > > #include > > -VNET_DEFINE(int, ip6_gif_hlim) = GIF_HLIM; > +#define GIF_HLIM 30 > +static VNET_DEFINE(int, ip6_gif_hlim) = GIF_HLIM; > #define V_ip6_gif_hlim VNET(ip6_gif_hlim) > > SYSCTL_DECL(_net_inet6_ip6); > SYSCTL_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM, gifhlim, CTLFLAG_VNET | CTLFLAG_RW, > &VNET_NAME(ip6_gif_hlim), 0, ""); > > +int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t); > +int in6_gif_encapcheck(const struct mbuf *, int, int, void *); > +int in6_gif_attach(struct gif_softc *); > + > static int gif_validate6(const struct ip6_hdr *, struct gif_softc *, > struct ifnet *); > +static int in6_gif_input(struct mbuf **, int *, int); > > extern struct domain inet6domain; > -struct protosw in6_gif_protosw = { > +static struct protosw in6_gif_protosw = { > .pr_type = SOCK_RAW, > .pr_domain = &inet6domain, > .pr_protocol = 0, /* IPPROTO_IPV[46] */ > @@ -144,7 +149,7 @@ in6_gif_output(struct ifnet *ifp, struct > return (ip6_output(m, 0, NULL, IPV6_MINMTU, 0, NULL, NULL)); > } > > -int > +static int > in6_gif_input(struct mbuf **mp, int *offp, int proto) > { > struct mbuf *m = *mp; -- Jilles Tjoelker