Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jan 2011 10:16:42 +0100
From:      joris dedieu <joris.dedieu@gmail.com>
To:        freebsd-hackers <freebsd-hackers@freebsd.org>
Subject:   netinet6 little cleanup
Message-ID:  <AANLkTinSKhwLL2JQWtAgXwGOtTt9EbPNyVdnvR%2B6Amtr@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi,
As I was reading netinet6 code, I found some redundant SYSCTL_DECL.
I don't know if it's really useful but here is a patch to clean it.
- remove SYSCTL_DECL(_net_inet6_ip6) and SYSCTL_DECL(_net_inet6) from c files
+ add them to netinet6/in6_var.h header (like for netinet).

Cheers
Joris

diff --git a/sys/netinet/ipfw/ip_fw2.c b/sys/netinet/ipfw/ip_fw2.c
index 43b2d11..d1d1f6d 100644
--- a/sys/netinet/ipfw/ip_fw2.c
+++ b/sys/netinet/ipfw/ip_fw2.c
@@ -175,7 +175,6 @@ SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, static_count,
     "Number of static rules");

 #ifdef INET6
-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall");
 SYSCTL_VNET_INT(_net_inet6_ip6_fw, OID_AUTO, deny_unknown_exthdrs,
     CTLFLAG_RW | CTLFLAG_SECURE, &VNET_NAME(fw_deny_unknown_exthdrs), 0,
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index e786836..1cf0cc6 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$");
 VNET_DEFINE(int, ip6_gif_hlim) = GIF_HLIM;
 #define        V_ip6_gif_hlim                  VNET(ip6_gif_hlim)

-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM, gifhlim, CTLFLAG_RW,
     &VNET_NAME(ip6_gif_hlim), 0, "");

diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 1438c32..9f33cb7 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -148,7 +148,6 @@ static int  in6p_set_multicast_if(struct inpcb *,
struct sockopt *);
 static int     in6p_set_source_filters(struct inpcb *, struct sockopt *);
 static int     sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS);

-SYSCTL_DECL(_net_inet6_ip6);   /* XXX Not in any common header. */

 SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv6 multicast");

diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
index 2a13646..1943945 100644
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -204,7 +204,6 @@ in6_matroute(void *v_arg, struct radix_node_head *head)
        return rn;
 }

-SYSCTL_DECL(_net_inet6_ip6);

 static VNET_DEFINE(int, rtq_reallyold6) = 60*60;
        /* one hour is ``really old'' */
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 49bc715..bb60996 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -989,7 +989,6 @@ struct walkarg {
 };

 static int in6_src_sysctl(SYSCTL_HANDLER_ARGS);
-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6_ip6, IPV6CTL_ADDRCTLPOLICY, addrctlpolicy,
        CTLFLAG_RD, in6_src_sysctl, "");

diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 00342fd..23f927d 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -653,6 +653,11 @@ im6s_get_mode(const struct in6_multi *inm, const
struct ip6_msource *ims,

@@ -653,6 +653,11 @@ im6s_get_mode(const struct in6_multi *inm, const
struct ip6_msource *ims,


@@ -653,6 +653,11 @@ im6s_get_mode(const struct in6_multi *inm, const
struct ip6_msource *ims,

diff --git a/sys/netinet/ipfw/ip_fw2.c b/sys/netinet/ipfw/ip_fw2.c
index 43b2d11..d1d1f6d 100644
--- a/sys/netinet/ipfw/ip_fw2.c
+++ b/sys/netinet/ipfw/ip_fw2.c
@@ -175,7 +175,6 @@ SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, static_count,
     "Number of static rules");

 #ifdef INET6
-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, fw, CTLFLAG_RW, 0, "Firewall");
 SYSCTL_VNET_INT(_net_inet6_ip6_fw, OID_AUTO, deny_unknown_exthdrs,
     CTLFLAG_RW | CTLFLAG_SECURE, &VNET_NAME(fw_deny_unknown_exthdrs), 0,
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index e786836..1cf0cc6 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$");
 VNET_DEFINE(int, ip6_gif_hlim) = GIF_HLIM;
 #define        V_ip6_gif_hlim                  VNET(ip6_gif_hlim)

-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_VNET_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM, gifhlim, CTLFLAG_RW,
     &VNET_NAME(ip6_gif_hlim), 0, "");

diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 1438c32..9f33cb7 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -148,7 +148,6 @@ static int  in6p_set_multicast_if(struct inpcb *,
struct sockopt *);
 static int     in6p_set_source_filters(struct inpcb *, struct sockopt *);
 static int     sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS);

-SYSCTL_DECL(_net_inet6_ip6);   /* XXX Not in any common header. */

 SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv6 multicast");

diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
index 2a13646..1943945 100644
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -204,7 +204,6 @@ in6_matroute(void *v_arg, struct radix_node_head *head)
        return rn;
 }

-SYSCTL_DECL(_net_inet6_ip6);

 static VNET_DEFINE(int, rtq_reallyold6) = 60*60;
        /* one hour is ``really old'' */
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 49bc715..bb60996 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -989,7 +989,6 @@ struct walkarg {
 };

 static int in6_src_sysctl(SYSCTL_HANDLER_ARGS);
-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6_ip6, IPV6CTL_ADDRCTLPOLICY, addrctlpolicy,
        CTLFLAG_RD, in6_src_sysctl, "");

diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 00342fd..23f927d 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -653,6 +653,11 @@ im6s_get_mode(const struct in6_multi *inm, const
struct ip6_msource *ims,

index 1438c32..9f33cb7 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -148,7 +148,6 @@ static int  in6p_set_multicast_if(struct inpcb *,
struct sockopt *);
 static int     in6p_set_source_filters(struct inpcb *, struct sockopt *);
 static int     sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS);

-SYSCTL_DECL(_net_inet6_ip6);   /* XXX Not in any common header. */

 SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv6 multicast");

diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
index 2a13646..1943945 100644
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -204,7 +204,6 @@ in6_matroute(void *v_arg, struct radix_node_head *head)
        return rn;
 }

-SYSCTL_DECL(_net_inet6_ip6);

 static VNET_DEFINE(int, rtq_reallyold6) = 60*60;
        /* one hour is ``really old'' */
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 49bc715..bb60996 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -989,7 +989,6 @@ struct walkarg {
 };

 static int in6_src_sysctl(SYSCTL_HANDLER_ARGS);
-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6_ip6, IPV6CTL_ADDRCTLPOLICY, addrctlpolicy,
        CTLFLAG_RD, in6_src_sysctl, "");

diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 00342fd..23f927d 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -653,6 +653,11 @@ im6s_get_mode(const struct in6_multi *inm, const
struct ip6_msource *ims,

diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 1438c32..9f33cb7 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -148,7 +148,6 @@ static int  in6p_set_multicast_if(struct inpcb *,
struct sockopt *);
 static int     in6p_set_source_filters(struct inpcb *, struct sockopt *);
 static int     sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS);

-SYSCTL_DECL(_net_inet6_ip6);   /* XXX Not in any common header. */

 SYSCTL_NODE(_net_inet6_ip6, OID_AUTO, mcast, CTLFLAG_RW, 0, "IPv6 multicast");

diff --git a/sys/netinet6/in6_rmx.c b/sys/netinet6/in6_rmx.c
index 2a13646..1943945 100644
--- a/sys/netinet6/in6_rmx.c
+++ b/sys/netinet6/in6_rmx.c
@@ -204,7 +204,6 @@ in6_matroute(void *v_arg, struct radix_node_head *head)
        return rn;
 }

-SYSCTL_DECL(_net_inet6_ip6);

 static VNET_DEFINE(int, rtq_reallyold6) = 60*60;
        /* one hour is ``really old'' */
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index 49bc715..bb60996 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -989,7 +989,6 @@ struct walkarg {
 };

 static int in6_src_sysctl(SYSCTL_HANDLER_ARGS);
-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6_ip6, IPV6CTL_ADDRCTLPOLICY, addrctlpolicy,
        CTLFLAG_RD, in6_src_sysctl, "");

diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index 00342fd..23f927d 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -653,6 +653,11 @@ im6s_get_mode(const struct in6_multi *inm, const
struct ip6_msource *ims,


 #ifdef _KERNEL

+#ifdef SYSCTL_DECL
+SYSCTL_DECL(_net_inet6);
+SYSCTL_DECL(_net_inet6_ip6);
+#endif
+
 /*
  * Lock macros for IPv6 layer multicast address lists.  IPv6 lock goes
  * before link layer multicast locks in the lock order.  In most cases,
diff --git a/sys/netinet6/ip6_ipsec.c b/sys/netinet6/ip6_ipsec.c
index 96b09ef..72ec2d7 100644
--- a/sys/netinet6/ip6_ipsec.c
+++ b/sys/netinet6/ip6_ipsec.c
@@ -86,7 +86,6 @@ static VNET_DEFINE(int, ip6_ipsec6_filtertunnel) = 0;
 #endif
 #define        V_ip6_ipsec6_filtertunnel       VNET(ip6_ipsec6_filtertunnel)

-SYSCTL_DECL(_net_inet6_ipsec6);
 SYSCTL_VNET_INT(_net_inet6_ipsec6, OID_AUTO,
        filtertunnel, CTLFLAG_RW, &VNET_NAME(ip6_ipsec6_filtertunnel),  0,
        "If set filter packets from an IPsec tunnel.");
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 0c1ff78..395ccf2 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -154,8 +154,6 @@ static int pim6_encapcheck(const struct mbuf *,
int, int, void *);
 static VNET_DEFINE(int, ip6_mrouter_ver) = 0;
 #define        V_ip6_mrouter_ver       VNET(ip6_mrouter_ver)

-SYSCTL_DECL(_net_inet6);
-SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_NODE(_net_inet6, IPPROTO_PIM, pim, CTLFLAG_RW, 0, "PIM");

 static struct mrt6stat mrt6stat;
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index 21d9eab..7bea10a 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -215,8 +215,6 @@ static VNET_DEFINE(int, current_state_timers_running6);
 #define        V_state_change_timers_running6
VNET(state_change_timers_running6)
 #define        V_current_state_timers_running6
VNET(current_state_timers_running6)

-SYSCTL_DECL(_net_inet6);       /* Note: Not in any common header. */
-
 SYSCTL_NODE(_net_inet6, OID_AUTO, mld, CTLFLAG_RW, 0,
     "IPv6 Multicast Listener Discovery");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinSKhwLL2JQWtAgXwGOtTt9EbPNyVdnvR%2B6Amtr>