|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Martin Pieuchot (mpieuchot
nolizard.org)
Date: Fri May 03 2013 - 03:36:03 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
One more simple diff about global variables:
- Document which variables are used for sysctl(8)
- Remove the redundant debug-only icmpprintfs variable
- Add static to global variables used only in this file.
ok?
Index: netinet/ip_icmp.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_icmp.c,v
retrieving revision 1.98
diff -u -p -r1.98 ip_icmp.c
--- netinet/ip_icmp.c 24 Apr 2013 10:17:08 -0000 1.98
+++ netinet/ip_icmp.c 3 May 2013 08:19:44 -0000

-105,17 +105,17 
* host table maintenance routines.
*/
+/* values controllable via sysctl */
int icmpmaskrepl = 0;
int icmpbmcastecho = 0;
int icmptstamprepl = 1;
-#ifdef ICMPPRINTFS
-int icmpprintfs = 0;
-#endif
int icmperrppslim = 100;
-int icmperrpps_count = 0;
-struct timeval icmperrppslim_last;
int icmp_rediraccept = 0;
int icmp_redirtimeout = 10 * 60;
+
+static int icmperrpps_count = 0;
+static struct timeval icmperrppslim_last;
+
static struct rttimer_queue *icmp_redirect_timeout_q = NULL;
struct icmpstat icmpstat;

-148,8 +148,7 
icmp_do_error(struct mbuf *n, int type,
unsigned icmplen, mblen;
#ifdef ICMPPRINTFS
- if (icmpprintfs)
- printf("icmp_error(%x, %d, %d)\n", oip, type, code);
+ printf("icmp_error(%x, %d, %d)\n", oip, type, code);
#endif
if (type != ICMP_REDIRECT)
icmpstat.icps_error++;

-325,7 +324,7 
icmp_input(struct mbuf *m, ...)
*/
icmplen = ntohs(ip->ip_len) - hlen;
#ifdef ICMPPRINTFS
- if (icmpprintfs) {
+ {
char buf[4 * sizeof("123")];
strlcpy(buf, inet_ntoa(ip->ip_dst), sizeof buf);

-357,9 +356,7 
icmp_input(struct mbuf *m, ...)
/*
* Message type specific processing.
*/
- if (icmpprintfs)
- printf("icmp_input, type %d code %d\n", icp->icmp_type,
- icp->icmp_code);
+ printf("icmp_input, type %d code %d\n", icp->icmp_type, icp->icmp_code);
#endif
if (icp->icmp_type > ICMP_MAXTYPE)
goto raw;

-453,8 +450,7 
icmp_input(struct mbuf *m, ...)
}
#endif /* INET6 */
#ifdef ICMPPRINTFS
- if (icmpprintfs)
- printf("deliver to protocol %d\n", icp->icmp_ip.ip_p);
+ printf("deliver to protocol %d\n", icp->icmp_ip.ip_p);
#endif
icmpsrc.sin_addr = icp->icmp_ip.ip_dst;
#if NCARP > 0

-578,7 +574,7 
reflect:
icmpgw.sin_addr = ip->ip_src;
icmpdst.sin_addr = icp->icmp_gwaddr;
#ifdef ICMPPRINTFS
- if (icmpprintfs) {
+ {
char buf[4 * sizeof("123")];
strlcpy(buf, inet_ntoa(icp->icmp_ip.ip_dst),
sizeof buf);

-729,9 +725,8 
icmp_reflect(struct mbuf *m, struct mbuf
}
if (op && opts) {
#ifdef ICMPPRINTFS
- if (icmpprintfs)
- printf("icmp_reflect optlen %d rt %d => ",
- optlen, opts->m_len);
+ printf("icmp_reflect optlen %d rt %d => ",
+ optlen, opts->m_len);
#endif
for (cnt = optlen; cnt > 0; cnt -= len, cp += len) {
opt = cp[IPOPT_OPTVAL];

-767,8 +762,7 
icmp_reflect(struct mbuf *m, struct mbuf
opts->m_len++;
}
#ifdef ICMPPRINTFS
- if (icmpprintfs)
- printf("%d\n", opts->m_len);
+ printf("%d\n", opts->m_len);
#endif
}
/*

-811,7 +805,7 
icmp_send(struct mbuf *m, struct mbuf *o
m->m_data -= hlen;
m->m_len += hlen;
#ifdef ICMPPRINTFS
- if (icmpprintfs) {
+ {
char buf[4 * sizeof("123")];
strlcpy(buf, inet_ntoa(ip->ip_dst), sizeof buf);
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]