Diff below remove various external variable declaration from sources
files and move them to the corresponding header with an appropriate
comment if necessary.

ok?

Index: netinet/igmp.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/igmp.c,v
retrieving revision 1.31
diff -u -p -r1.31 igmp.c
--- netinet/igmp.c      20 Apr 2010 22:05:43 -0000      1.31
+++ netinet/igmp.c      8 Apr 2013 13:23:23 -0000
@@ -563,9 +563,6 @@ igmp_sendpkt(struct in_multi *inm, int t
        struct igmp *igmp;
        struct ip *ip;
        struct ip_moptions imo;
-#ifdef MROUTING
-       extern struct socket *ip_mrouter;
-#endif /* MROUTING */
 
        MGETHDR(m, M_DONTWAIT, MT_HEADER);
        if (m == NULL)
Index: netinet/ip_icmp.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.96
diff -u -p -r1.96 ip_icmp.c
--- netinet/ip_icmp.c   18 Sep 2012 12:35:51 -0000      1.96
+++ netinet/ip_icmp.c   8 Apr 2013 13:23:23 -0000
@@ -125,6 +125,9 @@ void icmp_mtudisc_timeout(struct rtentry
 int icmp_ratelimit(const struct in_addr *, const int, const int);
 void icmp_redirect_timeout(struct rtentry *, struct rttimer *);
 
+/* from ip_input.c */
+extern u_char ip_protox[];
+
 extern struct protosw inetsw[];
 
 void
@@ -312,8 +315,6 @@ icmp_input(struct mbuf *m, ...)
        struct in_ifaddr *ia;
        void *(*ctlfunc)(int, struct sockaddr *, u_int, void *);
        int code;
-       extern u_char ip_protox[];
-       extern int ipforwarding;
        int hlen;
        va_list ap;
        struct rtentry *rt;
@@ -1007,7 +1008,6 @@ icmp_mtudisc_timeout(struct rtentry *rt,
        if ((rt->rt_flags & (RTF_DYNAMIC | RTF_HOST)) ==
            (RTF_DYNAMIC | RTF_HOST)) {
                void *(*ctlfunc)(int, struct sockaddr *, u_int, void *);
-               extern u_char ip_protox[];
                struct sockaddr_in sa;
                struct rt_addrinfo info;
 
Index: netinet/ip_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.206
diff -u -p -r1.206 ip_input.c
--- netinet/ip_input.c  29 Mar 2013 13:16:14 -0000      1.206
+++ netinet/ip_input.c  8 Apr 2013 13:23:23 -0000
@@ -122,12 +122,7 @@ int        ip_maxqueue = 300;
 int    ip_frags = 0;
 
 /* from in_pcb.c */
-extern int ipport_firstauto;
-extern int ipport_lastauto;
-extern int ipport_hifirstauto;
-extern int ipport_hilastauto;
 extern struct baddynamicports baddynamicports;
-extern int la_hold_total;
 
 int *ipctl_vars[IPCTL_MAXID] = IPCTL_VARS;
 
@@ -391,8 +386,6 @@ ipv4_input(struct mbuf *m)
        if (IN_MULTICAST(ip->ip_dst.s_addr)) {
                struct in_multi *inm;
 #ifdef MROUTING
-               extern struct socket *ip_mrouter;
-
                if (ipmforwarding && ip_mrouter) {
                        if (m->m_flags & M_EXT) {
                                if ((m = m_pullup(m, hlen)) == NULL) {
Index: netinet/ip_ipsp.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_ipsp.c,v
retrieving revision 1.186
diff -u -p -r1.186 ip_ipsp.c
--- netinet/ip_ipsp.c   28 Mar 2013 23:10:05 -0000      1.186
+++ netinet/ip_ipsp.c   8 Apr 2013 13:23:23 -0000
@@ -64,6 +64,7 @@
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/in_pcb.h>
+#include <netinet/ip_var.h>
 #endif /* INET */
 
 #ifdef INET6
@@ -102,7 +103,6 @@ extern int  ipsec_esp_trans_default_level
 extern int     ipsec_esp_network_default_level;
 extern int     ipsec_ipcomp_default_level;
 
-extern int encdebug;
 int ipsec_in_use = 0;
 u_int64_t ipsec_last_added = 0;
 
Index: netinet/ip_output.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_output.c,v
retrieving revision 1.235
diff -u -p -r1.235 ip_output.c
--- netinet/ip_output.c 6 Nov 2012 12:32:42 -0000       1.235
+++ netinet/ip_output.c 8 Apr 2013 13:23:23 -0000
@@ -523,8 +523,6 @@ reroute:
                         * above, will be forwarded by the ip_input() routine,
                         * if necessary.
                         */
-                       extern struct socket *ip_mrouter;
-
                        if (ipmforwarding && ip_mrouter &&
                            (flags & IP_FORWARDING) == 0) {
                                if (ip_mforward(m, ifp) != 0) {
Index: netinet/ip_var.h
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_var.h,v
retrieving revision 1.44
diff -u -p -r1.44 ip_var.h
--- netinet/ip_var.h    16 Jul 2012 18:05:36 -0000      1.44
+++ netinet/ip_var.h    8 Apr 2013 13:23:23 -0000
@@ -149,8 +149,20 @@ extern struct ipstat ipstat;
 extern LIST_HEAD(ipqhead, ipq) ipq;    /* ip reass. queue */
 extern int ip_defttl;                  /* default IP ttl */
 
+extern struct socket *ip_mrouter;      /* multicast routing daemon */
+
 extern int ip_mtudisc;                 /* mtu discovery */
 extern u_int ip_mtudisc_timeout;       /* seconds to timeout mtu discovery */
+
+extern int ipport_firstauto;           /* min port for port allocation */
+extern int ipport_lastauto;            /* max port for port allocation */
+extern int ipport_hifirstauto;         /* min dynamic/private port number */
+extern int ipport_hilastauto;          /* max dynamic/private port number */
+extern int encdebug;                   /* enable message reporting */
+extern int ipforwarding;               /* enable IP forwarding */
+extern int ipmforwarding;              /* enable multicast forwarding */
+extern int la_hold_total;
+
 extern struct rttimer_queue *ip_mtudisc_timeout_q;
 extern struct pool ipqent_pool;
 struct inpcb;
Index: netinet/ipsec_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ipsec_input.c,v
retrieving revision 1.111
diff -u -p -r1.111 ipsec_input.c
--- netinet/ipsec_input.c       31 Mar 2013 00:59:52 -0000      1.111
+++ netinet/ipsec_input.c       8 Apr 2013 13:23:23 -0000
@@ -952,7 +952,6 @@ void *
 ipsec_common_ctlinput(u_int rdomain, int cmd, struct sockaddr *sa,
     void *v, int proto)
 {
-       extern u_int ip_mtudisc_timeout;
        struct ip *ip = v;
        int s;
 
Index: netinet/ipsec_output.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ipsec_output.c,v
retrieving revision 1.47
diff -u -p -r1.47 ipsec_output.c
--- netinet/ipsec_output.c      28 Mar 2013 23:10:06 -0000      1.47
+++ netinet/ipsec_output.c      8 Apr 2013 13:23:23 -0000
@@ -375,8 +375,6 @@ ipsp_process_packet(struct mbuf *m, stru
        /* Non expansion policy for IPCOMP */
        if (tdb->tdb_sproto == IPPROTO_IPCOMP) {
                if ((m->m_pkthdr.len - i) < tdb->tdb_compalgxform->minlen) {
-                       extern struct ipcompstat ipcompstat;
-
                        /* No need to compress, leave the packet untouched */
                        ipcompstat.ipcomps_minlen++;
                        return ipsp_process_done(m, tdb);
Index: netinet/raw_ip.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/raw_ip.c,v
retrieving revision 1.65
diff -u -p -r1.65 raw_ip.c
--- netinet/raw_ip.c    2 Apr 2013 18:27:47 -0000       1.65
+++ netinet/raw_ip.c    8 Apr 2013 13:23:23 -0000
@@ -399,9 +399,7 @@ rip_usrreq(struct socket *so, int req, s
        struct inpcb *inp = sotoinpcb(so);
        int error = 0;
        int s;
-#ifdef MROUTING
-       extern struct socket *ip_mrouter;
-#endif
+
        if (req == PRU_CONTROL)
                return (in_control(so, (u_long)m, (caddr_t)nam,
                    (struct ifnet *)control));
Index: netinet/tcp_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/tcp_input.c,v
retrieving revision 1.259
diff -u -p -r1.259 tcp_input.c
--- netinet/tcp_input.c 2 Apr 2013 18:27:47 -0000       1.259
+++ netinet/tcp_input.c 8 Apr 2013 13:23:24 -0000
@@ -121,8 +121,6 @@ struct  tcpipv6hdr tcp_saveti6;
 int    tcprexmtthresh = 3;
 int    tcptv_keep_init = TCPTV_KEEP_INIT;
 
-extern u_long sb_max;
-
 int tcp_rst_ppslim = 100;              /* 100pps */
 int tcp_rst_ppslim_count = 0;
 struct timeval tcp_rst_ppslim_last;
Index: netinet/tcp_subr.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/tcp_subr.c,v
retrieving revision 1.117
diff -u -p -r1.117 tcp_subr.c
--- netinet/tcp_subr.c  2 Apr 2013 18:27:47 -0000       1.117
+++ netinet/tcp_subr.c  8 Apr 2013 13:23:24 -0000
@@ -84,6 +84,7 @@
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
+#include <netinet/in_var.h>
 #include <netinet/in_pcb.h>
 #include <netinet/ip_var.h>
 #include <netinet/ip_icmp.h>
@@ -97,6 +98,7 @@
 
 #ifdef INET6
 #include <netinet6/in6_var.h>
+#include <netinet6/ip6_var.h>
 #include <netinet6/ip6protosw.h>
 #endif /* INET6 */
 
@@ -137,10 +139,6 @@ int tcp_reass_limit = NMBCLUSTERS / 2; /
 int tcp_sackhole_limit = 32*1024; /* hardlimit for sackhl_pool */
 #endif
 
-#ifdef INET6
-extern int ip6_defhlim;
-#endif /* INET6 */
-
 struct pool tcpcb_pool;
 struct pool tcpqe_pool;
 #ifdef TCP_SACK
@@ -778,7 +776,6 @@ tcp_ctlinput(int cmd, struct sockaddr *s
        struct in_addr faddr;
        tcp_seq seq;
        u_int mtu;
-       extern int inetctlerrmap[];
        void (*notify)(struct inpcb *, int) = tcp_notify;
        int errno;
 
Index: netinet/tcp_usrreq.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/tcp_usrreq.c,v
retrieving revision 1.110
diff -u -p -r1.110 tcp_usrreq.c
--- netinet/tcp_usrreq.c        24 Feb 2012 06:19:00 -0000      1.110
+++ netinet/tcp_usrreq.c        8 Apr 2013 13:23:24 -0000
@@ -100,14 +100,6 @@
 #include <netinet/tcpip.h>
 #include <netinet/tcp_debug.h>
 
-/*
- * TCP protocol interface to socket abstraction.
- */
-extern char *tcpstates[];
-extern int tcptv_keep_init;
-
-extern int tcp_rst_ppslim;
-
 /* from in_pcb.c */
 extern struct baddynamicports baddynamicports;
 
Index: netinet/tcp_var.h
===================================================================
RCS file: /home/ncvs/src/sys/netinet/tcp_var.h,v
retrieving revision 1.99
diff -u -p -r1.99 tcp_var.h
--- netinet/tcp_var.h   6 Jul 2011 23:44:20 -0000       1.99
+++ netinet/tcp_var.h   8 Apr 2013 13:23:24 -0000
@@ -538,7 +538,9 @@ extern      struct inpcbtable tcbtable;     /* he
 extern struct tcpstat tcpstat; /* tcp statistics */
 extern u_int32_t tcp_now;              /* for RFC 1323 timestamps */
 extern int tcp_do_rfc1323;     /* enabled/disabled? */
+extern int tcptv_keep_init;    /* time to keep alive the initial SYN packet */
 extern int tcp_mssdflt;        /* default maximum segment size */
+extern int tcp_rst_ppslim;     /* maximum outgoing RST packet per second */
 extern int tcp_ack_on_push;    /* ACK immediately on PUSH */
 #ifdef TCP_SACK
 extern int tcp_do_sack;        /* SACK enabled/disabled */
Index: netinet/udp_usrreq.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/udp_usrreq.c,v
retrieving revision 1.159
diff -u -p -r1.159 udp_usrreq.c
--- netinet/udp_usrreq.c        4 Apr 2013 19:23:39 -0000       1.159
+++ netinet/udp_usrreq.c        8 Apr 2013 13:23:24 -0000
@@ -99,9 +99,8 @@
 #ifndef INET
 #include <netinet/in.h>
 #endif
+#include <netinet6/ip6_var.h>
 #include <netinet6/ip6protosw.h>
-
-extern int ip6_defhlim;
 #endif /* INET6 */
 
 #include "pf.h"
@@ -905,7 +904,6 @@ udp_ctlinput(int cmd, struct sockaddr *s
        struct udphdr *uhp;
        struct in_addr faddr;
        struct inpcb *inp;
-       extern int inetctlerrmap[];
        void (*notify)(struct inpcb *, int) = udp_notify;
        int errno;
 
Index: netinet6/in6_pcb.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/in6_pcb.c,v
retrieving revision 1.53
diff -u -p -r1.53 in6_pcb.c
--- netinet6/in6_pcb.c  28 Mar 2013 16:45:16 -0000      1.53
+++ netinet6/in6_pcb.c  8 Apr 2013 13:23:24 -0000
@@ -117,6 +117,7 @@
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
 #include <netinet/in_pcb.h>
+#include <netinet/ip_var.h>
 
 #include <netinet6/in6_var.h>
 #include <netinet/ip6.h>
@@ -133,11 +134,6 @@
  */
 
 struct in6_addr zeroin6_addr;
-
-extern int ipport_firstauto;
-extern int ipport_lastauto;
-extern int ipport_hifirstauto;
-extern int ipport_hilastauto;
 
 /*
  * Keep separate inet6ctlerrmap, because I may remap some of these.
Index: netinet6/nd6.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet6/nd6.c,v
retrieving revision 1.97
diff -u -p -r1.97 nd6.c
--- netinet6/nd6.c      25 Mar 2013 14:40:57 -0000      1.97
+++ netinet6/nd6.c      8 Apr 2013 13:23:24 -0000
@@ -103,7 +103,6 @@ void nd6_llinfo_timer(void *);
 
 struct timeout nd6_slowtimo_ch;
 struct timeout nd6_timer_ch;
-extern struct timeout in6_tmpaddrtimer_ch;
 
 int fill_drlist(void *, size_t *, size_t);
 int fill_prlist(void *, size_t *, size_t);

Reply via email to