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)
This commit is contained in:
Andrey V. Elsukov 2014-12-25 21:32:37 +00:00
parent c05bafc566
commit f188f14d43
8 changed files with 19 additions and 38 deletions

View File

@ -118,16 +118,6 @@ void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af);
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 *);

View File

@ -114,6 +114,16 @@ void gif_input(struct mbuf *, struct ifnet *, int, uint8_t);
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)

View File

@ -119,16 +119,6 @@ static int gre_set_tunnel(struct ifnet *, struct sockaddr *,
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");

View File

@ -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

View File

@ -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);

View File

@ -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,

View File

@ -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);

View File

@ -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,