mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-25 03:54:17 +01:00
Added an option to specify an alternate PID file.
PR: bin/37159 Submitted by: "Aleksandr A. Babaylov" <.@babolo.ru>
This commit is contained in:
parent
6a9f5ebdc4
commit
b79840a6db
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118873
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user