diff options
author | ru <ru@FreeBSD.org> | 2003-08-13 13:16:19 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2003-08-13 13:16:19 +0000 |
commit | 4618cdf9bba82ecac1b4bae9df782f2ae1a40253 (patch) | |
tree | 7d45f89edd2b4c4387828e78e01b78c65f60e11f /sbin | |
parent | b870660f361c6260755ce03ef02a78249dfbc9eb (diff) | |
download | FreeBSD-src-4618cdf9bba82ecac1b4bae9df782f2ae1a40253.zip FreeBSD-src-4618cdf9bba82ecac1b4bae9df782f2ae1a40253.tar.gz |
Added an option to specify an alternate PID file.
PR: bin/37159
Submitted by: "Aleksandr A. Babaylov" <.@babolo.ru>
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/natd/natd.8 | 5 | ||||
-rw-r--r-- | sbin/natd/natd.c | 21 |
2 files changed, 23 insertions, 3 deletions
diff --git a/sbin/natd/natd.8 b/sbin/natd/natd.8 index 90f5c13..9c1b80b 100644 --- a/sbin/natd/natd.8 +++ b/sbin/natd/natd.8 @@ -32,6 +32,7 @@ .Op Fl log_facility Ar facility_name .Op Fl punch_fw Ar firewall_range .Op Fl log_ipfw_denied +.Op Fl pid_file | P Ar pidfile .Ek .Sh DESCRIPTION The @@ -478,6 +479,10 @@ Log when a packet cannot be re-injected because an rule blocks it. This is the default with .Fl verbose . +.It Fl pid_file | P Ar file +Specify an alternate file in which to store the process ID. +The default is +.Pa /var/run/natd.pid . .El .Sh RUNNING NATD The following steps are necessary before attempting to run diff --git a/sbin/natd/natd.c b/sbin/natd/natd.c index 40f68c2..ec123f7 100644 --- a/sbin/natd/natd.c +++ b/sbin/natd/natd.c @@ -122,6 +122,7 @@ static int dropIgnoredIncoming; static int logDropped; static int logFacility; static int logIpfwDenied; +static char* pidName; int main (int argc, char** argv) { @@ -156,6 +157,7 @@ int main (int argc, char** argv) logDropped = 0; logFacility = LOG_DAEMON; logIpfwDenied = -1; + pidName = PIDFILE; ParseArgs (argc, argv); /* @@ -380,7 +382,7 @@ int main (int argc, char** argv) } if (background) - unlink (PIDFILE); + unlink (pidName); return 0; } @@ -392,7 +394,7 @@ static void DaemonMode () daemon (0, 0); background = 1; - pidFile = fopen (PIDFILE, "w"); + pidFile = fopen (pidName, "w"); if (pidFile) { fprintf (pidFile, "%d\n", getpid ()); @@ -836,7 +838,8 @@ enum Option { LogDenied, LogFacility, PunchFW, - LogIpfwDenied + LogIpfwDenied, + PidFile }; enum Param { @@ -1063,6 +1066,14 @@ static struct OptionInfo optionTable[] = { "log packets converted by natd, but denied by ipfw", "log_ipfw_denied", NULL }, + + { PidFile, + 0, + String, + "file_name", + "store PID in an alternate file", + "pid_file", + "P" }, }; static void ParseOption (const char* option, const char* parms) @@ -1250,6 +1261,10 @@ static void ParseOption (const char* option, const char* parms) case LogIpfwDenied: logIpfwDenied = yesNoValue;; break; + + case PidFile: + pidName = strdup (strValue); + break; } } |