svn commit: r276148 - in head: . sys/net sys/netinet sys/netinet6
Jilles Tjoelker
jilles at stack.nl
Thu Dec 25 18:44:08 UTC 2014
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 <netinet/ip_ecn.h>
> #ifdef INET
> #include <netinet/in_var.h>
> -#include <netinet/in_gif.h>
> #include <netinet/ip_var.h>
> #endif /* INET */
>
> @@ -85,7 +84,6 @@ __FBSDID("$FreeBSD$");
> #include <netinet6/ip6_ecn.h>
> #include <netinet6/ip6_var.h>
> #include <netinet6/scope6_var.h>
> -#include <netinet6/in6_gif.h>
> #include <netinet6/ip6protosw.h>
> #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 <netinet/in_systm.h>
> #include <netinet/ip.h>
> #include <netinet/ip_var.h>
> -#include <netinet/in_gif.h>
> #include <netinet/in_var.h>
> #include <netinet/ip_encap.h>
> #include <netinet/ip_ecn.h>
> @@ -68,11 +67,16 @@ __FBSDID("$FreeBSD$");
>
> #include <net/if_gif.h>
>
> +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 <netinet/ip6.h>
> #include <netinet6/ip6_var.h>
> -#include <netinet6/in6_gif.h>
> #include <netinet6/in6_var.h>
> #endif
> #include <netinet/ip_ecn.h>
> @@ -74,18 +73,24 @@ __FBSDID("$FreeBSD$");
>
> #include <net/if_gif.h>
>
> -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
More information about the svn-src-all
mailing list