Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 1998 06:39:48 -0400 (EDT)
From:      Luoqi Chen <luoqi@chen.ml.org>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/6676: natd doesn't respond to SIGTERM
Message-ID:  <199805181039.GAA02762@chen.ml.org>

next in thread | raw e-mail | index | archive | help

>Number:         6676
>Category:       bin
>Synopsis:       natd doesn't respond to signals when there is no traffic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 18 03:40:01 PDT 1998
>Last-Modified:
>Originator:     Luoqi Chen
>Organization:
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	3.0-current as of 5/16/98

>Description:

	When all of the following conditions are true,
	    o same in & out divert port (default)
	    o alias_address is used instead of an interface name
	    o there is no ip divert traffic (e.g. ipfw divert rule is removed)
	natd won't respond to SIGTERM. I have a natd shutdown script which
	removes ipfw divert rule first, then terminate natd with kill -TERM.
	I could reverse the order, kill natd first, then removes divert rule,
	since natd has a 10 sec grace period before shutdown, but this is
	nevertheless a bug.

	The cause of the problem is that by default signal handlers are
	installed with SA_RESTART flag set, under aforementioned conditions,
	recvfrom() syscall in DoAliasing() will block forever.

>How-To-Repeat:

	Start natd with alias_address option, e.g.
		natd -alias_address ${public_ip_address}

	Now in my shutdown script, I first removes ipfw divert rule, then
		killall natd
	natd won't go away.

>Fix:
	
	Set SIGTERM interruptable. (There's similar problem with SIGHUP,
	in this case, refresh of address is delayed and the first packet
	after an address change might be mistranslated.)

Index: natd.c
===================================================================
RCS file: /fun/cvs/src/usr.sbin/natd/natd.c,v
retrieving revision 1.8
diff -u -r1.8 natd.c
--- natd.c	1997/12/27 19:31:11	1.8
+++ natd.c	1998/05/18 10:09:32
@@ -243,6 +243,8 @@
  * Catch signals to manage shutdown and
  * refresh of interface address.
  */
+	siginterrupt (SIGHUP, 1);
+	siginterrupt (SIGALRM, 1);
 	signal (SIGTERM, InitiateShutdown);
 	signal (SIGHUP, RefreshAddr);
 /*

>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?199805181039.GAA02762>