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
This is a multi-part message in MIME format. ------=_NextPart_000_0038_01C1A6D7.EFE5AA70 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > 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 ------=_NextPart_000_0038_01C1A6D7.EFE5AA70 Content-Type: application/octet-stream; name="natd.readcfg.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="natd.readcfg.patch" --- natd.c.orig Wed Aug 29 09:18:23 2001=0A= +++ natd.c Wed Aug 29 18:00:25 2001=0A= @@ -85,7 +85,7 @@=0A= static void SetAliasAddressFromIfName (const char *ifName);=0A= static void InitiateShutdown (int);=0A= static void Shutdown (int);=0A= -static void RefreshAddr (int);=0A= +static void Refresh (int);=0A= static void ParseOption (const char* option, const char* parms);=0A= static void ReadConfigFile (const char* fileName);=0A= static void SetupPortRedirect (const char* parms);=0A= @@ -107,6 +107,7 @@=0A= static int verbose;=0A= static int background;=0A= static int running;=0A= +static char* nameConfigFile;=0A= static int assignAliasAddr;=0A= static char* ifName;=0A= static int ifIndex;=0A= @@ -297,7 +298,7 @@=0A= siginterrupt(SIGTERM, 1);=0A= siginterrupt(SIGHUP, 1);=0A= signal (SIGTERM, InitiateShutdown);=0A= - signal (SIGHUP, RefreshAddr);=0A= + signal (SIGHUP, Refresh);=0A= /*=0A= * Set alias address if it has been given.=0A= */=0A= @@ -825,10 +826,12 @@=0A= warn ("%s", msg);=0A= }=0A= =0A= -static void RefreshAddr (int sig)=0A= +static void Refresh (int sig)=0A= {=0A= if (ifName)=0A= assignAliasAddr =3D 1;=0A= + if (nameConfigFile)=0A= + ReadConfigFile(nameConfigFile);=0A= }=0A= =0A= static void InitiateShutdown (int sig)=0A= @@ -1243,6 +1246,7 @@=0A= =0A= case ConfigFile:=0A= ReadConfigFile (strValue);=0A= + nameConfigFile =3D strdup(strValue);=0A= break;=0A= =0A= case LogDenied:=0A= @@ -1286,6 +1290,8 @@=0A= file =3D fopen (fileName, "r");=0A= if (!file)=0A= err(1, "cannot open config file %s", fileName);=0A= +=0A= + syslog(LOG_INFO, "Using configuration in %s", fileName);=0A= =0A= while ((buf =3D fgetln(file, &len)) !=3D NULL) {=0A= if (buf[len - 1] =3D=3D '\n')=0A= ------=_NextPart_000_0038_01C1A6D7.EFE5AA70-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003c01c1a701$da5209e0$1200a8c0>