Date: Wed, 17 Apr 2002 01:41:34 +0400 (MSD) From: .@babolo.ru To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/37159: Option to redefine pid file for natd [PATCH] Message-ID: <200204162141.BAA28570@aaz.links.ru>
next in thread | raw e-mail | index | archive | help
>Number: 37159
>Category: bin
>Synopsis: more then one natd use running use the same pid file
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Tue Apr 16 14:50:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Aleksandr A. Babaylov
>Release: FreeBSD 4.5-STABLE
>Organization:
home
>Environment:
There are routers with different aliasing rules
for different IP groups so more then one natd
are running.
>Description:
Every natd running writes the same /var/run/natd.pid
>How-To-Repeat:
Launch 2 natd (with different rules possibly)
>Fix:
--- sbin/natd/natd.8 Thu Dec 20 15:21:46 2001
+++ sbin/natd/natd.8 Wed Apr 17 01:08:03 2002
@@ -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
This program provides a Network Address Translation facility for use
@@ -468,6 +469,10 @@
rule blocks it.
This is the default with
.Fl verbose .
+.It Fl pid_file | P Ar file
+Use
+.Ar file
+for PID instead of default.
.El
.Sh RUNNING NATD
The following steps are necessary before attempting to run
--- sbin/natd/natd.c Thu Feb 14 03:24:30 2002
+++ sbin/natd/natd.c Wed Apr 17 01:19:29 2002
@@ -121,6 +121,7 @@
static int logDropped;
static int logFacility;
static int logIpfwDenied;
+static char* pidName;
int main (int argc, char** argv)
{
@@ -155,6 +156,7 @@
logDropped = 0;
logFacility = LOG_DAEMON;
logIpfwDenied = -1;
+ pidName = PIDFILE;
ParseArgs (argc, argv);
/*
@@ -377,7 +379,7 @@
}
if (background)
- unlink (PIDFILE);
+ unlink (pidName);
return 0;
}
@@ -389,7 +391,7 @@
daemon (0, 0);
background = 1;
- pidFile = fopen (PIDFILE, "w");
+ pidFile = fopen (pidName, "w");
if (pidFile) {
fprintf (pidFile, "%d\n", getpid ());
@@ -833,7 +835,8 @@
LogDenied,
LogFacility,
PunchFW,
- LogIpfwDenied
+ LogIpfwDenied,
+ PidFile
};
enum Param {
@@ -1060,6 +1063,14 @@
"log packets converted by natd, but denied by ipfw",
"log_ipfw_denied",
NULL },
+
+ { PidFile,
+ 0,
+ String,
+ "file",
+ "Pid file name",
+ "pid_file",
+ "P" },
};
static void ParseOption (const char* option, const char* parms)
@@ -1246,6 +1257,10 @@
case LogIpfwDenied:
logIpfwDenied = yesNoValue;;
+ break;
+
+ case PidFile:
+ pidName = strdup (strValue);
break;
}
}
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204162141.BAA28570>
