Date: Sun, 27 Jan 2002 02:11:30 -0500 From: "Matthew Emmerton" <matt@gsicomp.on.ca> To: "Nick Rogness" <nick@rogness.net>, "Clemens Hermann" <haribeau@gmx.de> Cc: "BSD NET-List" <freebsd-net@FreeBSD.ORG> Subject: Re: natd restart Message-ID: <003c01c1a701$da5209e0$1200a8c0@gsicomp.on.ca> References: <Pine.BSF.4.21.0201270011300.6340-100000@cody.jharris.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
> On Sat, 26 Jan 2002, Clemens Hermann wrote:
>
> > Hi,
> >
> > Is there a way to get natd to reload the config-file without
> > terminating?
>
> There is a natd patch, running around here somewhere, that allows
> you to send a HUP signal to natd and have it reload the config.
>
> You will have to search the mailling list archive to find out
> who/what/when/where/why etc.
Here's the patch that I wrote some time ago. YMMV.
--
Matt Emmerton
[-- Attachment #2 --]
--- natd.c.orig Wed Aug 29 09:18:23 2001
+++ natd.c Wed Aug 29 18:00:25 2001
@@ -85,7 +85,7 @@
static void SetAliasAddressFromIfName (const char *ifName);
static void InitiateShutdown (int);
static void Shutdown (int);
-static void RefreshAddr (int);
+static void Refresh (int);
static void ParseOption (const char* option, const char* parms);
static void ReadConfigFile (const char* fileName);
static void SetupPortRedirect (const char* parms);
@@ -107,6 +107,7 @@
static int verbose;
static int background;
static int running;
+static char* nameConfigFile;
static int assignAliasAddr;
static char* ifName;
static int ifIndex;
@@ -297,7 +298,7 @@
siginterrupt(SIGTERM, 1);
siginterrupt(SIGHUP, 1);
signal (SIGTERM, InitiateShutdown);
- signal (SIGHUP, RefreshAddr);
+ signal (SIGHUP, Refresh);
/*
* Set alias address if it has been given.
*/
@@ -825,10 +826,12 @@
warn ("%s", msg);
}
-static void RefreshAddr (int sig)
+static void Refresh (int sig)
{
if (ifName)
assignAliasAddr = 1;
+ if (nameConfigFile)
+ ReadConfigFile(nameConfigFile);
}
static void InitiateShutdown (int sig)
@@ -1243,6 +1246,7 @@
case ConfigFile:
ReadConfigFile (strValue);
+ nameConfigFile = strdup(strValue);
break;
case LogDenied:
@@ -1286,6 +1290,8 @@
file = fopen (fileName, "r");
if (!file)
err(1, "cannot open config file %s", fileName);
+
+ syslog(LOG_INFO, "Using configuration in %s", fileName);
while ((buf = fgetln(file, &len)) != NULL) {
if (buf[len - 1] == '\n')
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003c01c1a701$da5209e0$1200a8c0>
