summaryrefslogtreecommitdiffstats
path: root/sys/netinet/libalias
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-05-05 20:22:09 +0000
committerglebius <glebius@FreeBSD.org>2005-05-05 20:22:09 +0000
commit497e6391d0692e98930ee7bd90084c5be0e50882 (patch)
tree74dec0cbb037790d3d1adf8256a2fb0dffa56ec3 /sys/netinet/libalias
parent89e40708a1634bd0ea331be497e0121d63483390 (diff)
downloadFreeBSD-src-497e6391d0692e98930ee7bd90084c5be0e50882.zip
FreeBSD-src-497e6391d0692e98930ee7bd90084c5be0e50882.tar.gz
Add NO_LOGGING knob, which cuts off functionality of debug logging to a file.
Diffstat (limited to 'sys/netinet/libalias')
-rw-r--r--sys/netinet/libalias/alias.h2
-rw-r--r--sys/netinet/libalias/alias_db.c29
-rw-r--r--sys/netinet/libalias/alias_local.h3
3 files changed, 19 insertions, 15 deletions
diff --git a/sys/netinet/libalias/alias.h b/sys/netinet/libalias/alias.h
index 1deec9f..64b7349 100644
--- a/sys/netinet/libalias/alias.h
+++ b/sys/netinet/libalias/alias.h
@@ -183,7 +183,9 @@ int LibAliasProxyRule(struct libalias *, const char *_cmd);
* If PKT_ALIAS_LOG is set, a message will be printed to /var/log/alias.log
* every time a link is created or deleted. This is useful for debugging.
*/
+#ifndef NO_LOGGING
#define PKT_ALIAS_LOG 0x01
+#endif
/*
* If PKT_ALIAS_DENY_INCOMING is set, then incoming connections (e.g. to ftp,
diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c
index ecf3d9d..e19289b 100644
--- a/sys/netinet/libalias/alias_db.c
+++ b/sys/netinet/libalias/alias_db.c
@@ -364,8 +364,6 @@ StartPointOut(struct in_addr, struct in_addr,
static int SeqDiff(u_long, u_long);
-static void ShowAliasStats(struct libalias *);
-
#ifndef NO_FW_PUNCH
/* Firewall control */
static void InitPunchFW(struct libalias *);
@@ -374,9 +372,12 @@ static void ClearFWHole(struct alias_link *);
#endif
+#ifndef NO_LOGGING
/* Log file control */
+static void ShowAliasStats(struct libalias *);
static void InitPacketAliasLog(struct libalias *);
static void UninitPacketAliasLog(struct libalias *);
+#endif
static u_int
StartPointIn(struct in_addr alias_addr,
@@ -425,6 +426,7 @@ SeqDiff(u_long x, u_long y)
}
+#ifndef NO_LOGGING
static void
ShowAliasStats(struct libalias *la)
{
@@ -453,10 +455,7 @@ ShowAliasStats(struct libalias *la)
fflush(la->monitorFile);
}
}
-
-
-
-
+#endif
/* Internal routines for finding, deleting and adding links
@@ -888,10 +887,12 @@ DeleteLink(struct alias_link *lnk)
/* Free memory */
free(lnk);
+#ifndef NO_LOGGING
/* Write statistics, if logging enabled */
if (la->packetAliasMode & PKT_ALIAS_LOG) {
ShowAliasStats(la);
}
+#endif
}
@@ -1027,10 +1028,11 @@ AddLink(struct libalias *la, struct in_addr src_addr,
fprintf(stderr, "malloc() call failed.\n");
#endif
}
-
+#ifndef NO_LOGGING
if (la->packetAliasMode & PKT_ALIAS_LOG) {
ShowAliasStats(la);
}
+#endif
return (lnk);
}
@@ -2143,7 +2145,7 @@ HouseKeeping(struct libalias *la)
}
}
-
+#ifndef NO_LOGGING
/* Init the log file and enable logging */
static void
InitPacketAliasLog(struct libalias *la)
@@ -2156,7 +2158,6 @@ InitPacketAliasLog(struct libalias *la)
}
}
-
/* Close the log-file and disable logging. */
static void
UninitPacketAliasLog(struct libalias *la)
@@ -2167,11 +2168,7 @@ UninitPacketAliasLog(struct libalias *la)
}
la->packetAliasMode &= ~PKT_ALIAS_LOG;
}
-
-
-
-
-
+#endif
/* Outside world interfaces
@@ -2431,7 +2428,9 @@ LibAliasUninit(struct libalias *la)
la->deleteAllLinks = 1;
CleanupAliasData(la);
la->deleteAllLinks = 0;
+#ifndef NO_LOGGING
UninitPacketAliasLog(la);
+#endif
#ifndef NO_FW_PUNCH
UninitPunchFW(la);
#endif
@@ -2448,6 +2447,7 @@ LibAliasSetMode(
* do a probe for flag values) */
)
{
+#ifndef NO_LOGGING
/* Enable logging? */
if (flags & mask & PKT_ALIAS_LOG) {
InitPacketAliasLog(la); /* Do the enable */
@@ -2456,6 +2456,7 @@ LibAliasSetMode(
if (~flags & mask & PKT_ALIAS_LOG) {
UninitPacketAliasLog(la);
}
+#endif
#ifndef NO_FW_PUNCH
/* Start punching holes in the firewall? */
if (flags & mask & PKT_ALIAS_PUNCH_FW) {
diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h
index 67947da..34f91e3 100644
--- a/sys/netinet/libalias/alias_local.h
+++ b/sys/netinet/libalias/alias_local.h
@@ -103,8 +103,9 @@ struct libalias {
int deleteAllLinks; /* If equal to zero, DeleteLink() */
/* will not remove permanent links */
-
+#ifndef NO_LOGGING
FILE *monitorFile; /* File descriptor for link */
+#endif
/* statistics monitoring file */
int newDefaultLink; /* Indicates if a new aliasing */
OpenPOWER on IntegriCloud