Cleanup icmp_var.h, make icmp bandlim sysctl permanent but if ICMP_BANDLIM

option not defined the sysctl int value is set to -1 and read-only.

    #ifdef KERNEL's added appropriately to wall off visibility of kernel
    routines from user code.
This commit is contained in:
Matthew Dillon 1998-12-04 04:21:25 +00:00
parent a3e7459d60
commit 5fce7fc47f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=41497
2 changed files with 19 additions and 15 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)icmp_var.h 8.1 (Berkeley) 6/10/93
* $Id: icmp_var.h,v 1.10 1998/12/03 20:23:20 dillon Exp $
* $Id: icmp_var.h,v 1.11 1998/12/04 03:49:18 dillon Exp $
*/
#ifndef _NETINET_ICMP_VAR_H_
@ -67,26 +67,20 @@ struct icmpstat {
*/
#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */
#define ICMPCTL_STATS 2 /* statistics (read-only) */
#ifdef ICMP_BANDLIM
#define ICMPCTL_ICMPLIM 3
#define ICMPCTL_MAXID 4
#define ICMP_BANDLIM_INFO { "icmplim", CTLTYPE_INT },
#else
#define ICMPCTL_MAXID 3
#define ICMP_BANDLIM_INFO
#endif
#define ICMPCTL_NAMES { \
{ 0, 0 }, \
{ "maskrepl", CTLTYPE_INT }, \
{ "stats", CTLTYPE_STRUCT }, \
ICMP_BANDLIM_INFO \
{ "icmplim", CTLTYPE_INT }, \
}
#ifdef KERNEL
#ifdef ICMP_BANDLIM
extern int badport_bandlim __P((int));
#endif
#endif
#endif

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94
* $Id: ip_icmp.c,v 1.31 1998/09/15 10:49:03 jkoshy Exp $
* $Id: ip_icmp.c,v 1.32 1998/12/03 20:23:20 dillon Exp $
*/
#include <sys/param.h>
@ -71,16 +71,26 @@ SYSCTL_INT(_net_inet_icmp, ICMPCTL_MASKREPL, maskrepl, CTLFLAG_RW,
#ifdef ICMP_BANDLIM
/*
* ICMP error-response bandwidth limiting
*/
/*
* ICMP error-response bandwidth limiting sysctl. If not enabled, sysctl
* variable content is -1 and read-only.
*/
static int icmplim = 100;
SYSCTL_INT(_net_inet_icmp, ICMPCTL_ICMPLIM, icmplim, CTLFLAG_RW,
&icmplim, 0, "");
#else
static int icmplim = -1;
SYSCTL_INT(_net_inet_icmp, ICMPCTL_ICMPLIM, icmplim, CTLFLAG_RD,
&icmplim, 0, "");
#endif
/*
* ICMP broadcast echo sysctl
*/
static int icmpbmcastecho = 0;
SYSCTL_INT(_net_inet_icmp, OID_AUTO, bmcastecho, CTLFLAG_RW, &icmpbmcastecho,
0, "");