svn commit: r276215 - in head/sys: net netinet netinet6

Andrey V. Elsukov ae at FreeBSD.org
Thu Dec 25 21:32:41 UTC 2014


Author: ae
Date: Thu Dec 25 21:32:37 2014
New Revision: 276215
URL: https://svnweb.freebsd.org/changeset/base/276215

Log:
  Extern declarations in C files loses compile-time checking that
  the functions' calls match their definitions. Move them to header files.
  
  Reviewed by:	jilles (previous version)

Modified:
  head/sys/net/if_gif.c
  head/sys/net/if_gif.h
  head/sys/net/if_gre.c
  head/sys/net/if_gre.h
  head/sys/netinet/in_gif.c
  head/sys/netinet/ip_gre.c
  head/sys/netinet6/in6_gif.c
  head/sys/netinet6/ip6_gre.c

Modified: head/sys/net/if_gif.c
==============================================================================
--- head/sys/net/if_gif.c	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/net/if_gif.c	Thu Dec 25 21:32:37 2014	(r276215)
@@ -118,16 +118,6 @@ 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/net/if_gif.h
==============================================================================
--- head/sys/net/if_gif.h	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/net/if_gif.h	Thu Dec 25 21:32:37 2014	(r276215)
@@ -114,6 +114,16 @@ void gif_input(struct mbuf *, struct ifn
 int gif_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
 	       struct route *);
 int gif_encapcheck(const struct mbuf *, int, int, void *);
+#ifdef INET
+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 *);
+#endif
+#ifdef INET6
+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 *);
+#endif
 #endif /* _KERNEL */
 
 #define GIFGOPTS	_IOWR('i', 150, struct ifreq)

Modified: head/sys/net/if_gre.c
==============================================================================
--- head/sys/net/if_gre.c	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/net/if_gre.c	Thu Dec 25 21:32:37 2014	(r276215)
@@ -119,16 +119,6 @@ static int	gre_set_tunnel(struct ifnet *
     struct sockaddr *);
 static void	gre_delete_tunnel(struct ifnet *);
 
-int		gre_input(struct mbuf **, int *, int);
-#ifdef INET
-extern int	in_gre_attach(struct gre_softc *);
-extern int	in_gre_output(struct mbuf *, int, int);
-#endif
-#ifdef INET6
-extern int	in6_gre_attach(struct gre_softc *);
-extern int	in6_gre_output(struct mbuf *, int, int);
-#endif
-
 SYSCTL_DECL(_net_link);
 static SYSCTL_NODE(_net_link, IFT_TUNNEL, gre, CTLFLAG_RW, 0,
     "Generic Routing Encapsulation");

Modified: head/sys/net/if_gre.h
==============================================================================
--- head/sys/net/if_gre.h	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/net/if_gre.h	Thu Dec 25 21:32:37 2014	(r276215)
@@ -100,6 +100,15 @@ struct gre_softc {
 #define	gre_oip			gre_gihdr->gi_ip
 #define	gre_oip6		gre_gi6hdr->gi6_ip6
 
+int	gre_input(struct mbuf **, int *, int);
+#ifdef INET
+int	in_gre_attach(struct gre_softc *);
+int	in_gre_output(struct mbuf *, int, int);
+#endif
+#ifdef INET6
+int	in6_gre_attach(struct gre_softc *);
+int	in6_gre_output(struct mbuf *, int, int);
+#endif
 /*
  * CISCO uses special type for GRE tunnel created as part of WCCP
  * connection, while in fact those packets are just IPv4 encapsulated

Modified: head/sys/netinet/in_gif.c
==============================================================================
--- head/sys/netinet/in_gif.c	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/netinet/in_gif.c	Thu Dec 25 21:32:37 2014	(r276215)
@@ -67,10 +67,6 @@ __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);

Modified: head/sys/netinet/ip_gre.c
==============================================================================
--- head/sys/netinet/ip_gre.c	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/netinet/ip_gre.c	Thu Dec 25 21:32:37 2014	(r276215)
@@ -68,11 +68,6 @@ __FBSDID("$FreeBSD$");
 #include <net/if_gre.h>
 
 extern struct domain inetdomain;
-extern int gre_input(struct mbuf **, int *, int);
-
-int in_gre_attach(struct gre_softc *);
-int in_gre_output(struct mbuf *, int, int);
-
 static const struct protosw in_gre_protosw = {
 	.pr_type =		SOCK_RAW,
 	.pr_domain =		&inetdomain,

Modified: head/sys/netinet6/in6_gif.c
==============================================================================
--- head/sys/netinet6/in6_gif.c	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/netinet6/in6_gif.c	Thu Dec 25 21:32:37 2014	(r276215)
@@ -81,10 +81,6 @@ 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);

Modified: head/sys/netinet6/ip6_gre.c
==============================================================================
--- head/sys/netinet6/ip6_gre.c	Thu Dec 25 20:15:13 2014	(r276214)
+++ head/sys/netinet6/ip6_gre.c	Thu Dec 25 21:32:37 2014	(r276215)
@@ -62,11 +62,6 @@ __FBSDID("$FreeBSD$");
 #include <net/if_gre.h>
 
 extern  struct domain inet6domain;
-extern int gre_input(struct mbuf **, int *, int);
-
-int in6_gre_attach(struct gre_softc *);
-int in6_gre_output(struct mbuf *, int, int);
-
 struct protosw in6_gre_protosw = {
 	.pr_type =	SOCK_RAW,
 	.pr_domain =	&inet6domain,


More information about the svn-src-all mailing list