From 65657fce6578ef31040fa2321c2090efc54e9ebf Mon Sep 17 00:00:00 2001 From: bz Date: Wed, 27 Apr 2011 19:36:35 +0000 Subject: [PATCH] MfP4 CH=192029: Expose ip_icmp.c to INET6 as well and only export badport_bandlim() along with the two sysctls in the non-INET case. The bandlim types work for all cases I reviewed in IPv6 as well and the sysctls are available as we export net.inet.* from in_proto.c. Reviewed by: gnn Sponsored by: The FreeBSD Foundation Sponsored by: iXsystems MFC after: 4 days --- sys/conf/files | 2 +- sys/netinet/ip_icmp.c | 29 +++++++++++++++++------------ 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index a23ff56342db..104462bd08d5 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2707,7 +2707,7 @@ netinet/ipfw/ip_fw_pfil.c optional inet ipfirewall netinet/ipfw/ip_fw_sockopt.c optional inet ipfirewall netinet/ipfw/ip_fw_table.c optional inet ipfirewall netinet/ipfw/ip_fw_nat.c optional inet ipfirewall_nat -netinet/ip_icmp.c optional inet +netinet/ip_icmp.c optional inet | inet6 netinet/ip_input.c optional inet netinet/ip_ipsec.c optional inet ipsec netinet/ip_mroute.c optional mrouting inet | mrouting inet6 diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 480a2c80db55..3542aa18114d 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" #include "opt_ipsec.h" #include @@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef INET #ifdef IPSEC #include #include @@ -70,12 +72,26 @@ __FBSDID("$FreeBSD$"); #include #include +#endif /* INET */ /* * ICMP routines: error generation, receive packet processing, and * routines to turnaround packets back to the originator, and * host table maintenance routines. */ +static VNET_DEFINE(int, icmplim) = 200; +#define V_icmplim VNET(icmplim) +SYSCTL_VNET_INT(_net_inet_icmp, ICMPCTL_ICMPLIM, icmplim, CTLFLAG_RW, + &VNET_NAME(icmplim), 0, + "Maximum number of ICMP responses per second"); + +static VNET_DEFINE(int, icmplim_output) = 1; +#define V_icmplim_output VNET(icmplim_output) +SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, icmplim_output, CTLFLAG_RW, + &VNET_NAME(icmplim_output), 0, + "Enable rate limiting of ICMP responses"); + +#ifdef INET VNET_DEFINE(struct icmpstat, icmpstat); SYSCTL_VNET_STRUCT(_net_inet_icmp, ICMPCTL_STATS, stats, CTLFLAG_RW, &VNET_NAME(icmpstat), icmpstat, ""); @@ -104,18 +120,6 @@ SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, log_redirect, CTLFLAG_RW, &VNET_NAME(log_redirect), 0, "Log ICMP redirects to the console"); -static VNET_DEFINE(int, icmplim) = 200; -#define V_icmplim VNET(icmplim) -SYSCTL_VNET_INT(_net_inet_icmp, ICMPCTL_ICMPLIM, icmplim, CTLFLAG_RW, - &VNET_NAME(icmplim), 0, - "Maximum number of ICMP responses per second"); - -static VNET_DEFINE(int, icmplim_output) = 1; -#define V_icmplim_output VNET(icmplim_output) -SYSCTL_VNET_INT(_net_inet_icmp, OID_AUTO, icmplim_output, CTLFLAG_RW, - &VNET_NAME(icmplim_output), 0, - "Enable rate limiting of ICMP responses"); - static VNET_DEFINE(char, reply_src[IFNAMSIZ]); #define V_reply_src VNET(reply_src) SYSCTL_VNET_STRING(_net_inet_icmp, OID_AUTO, reply_src, CTLFLAG_RW, @@ -922,6 +926,7 @@ ip_next_mtu(int mtu, int dir) } return 0; } +#endif /* INET */ /*