From owner-freebsd-bugs Mon May 18 03:44:20 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA25717 for freebsd-bugs-outgoing; Mon, 18 May 1998 03:44:20 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA25707 for ; Mon, 18 May 1998 03:44:17 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id DAA25276; Mon, 18 May 1998 03:40:02 -0700 (PDT) Received: from chen.ml.org (luoqi.watermarkgroup.com [207.202.73.170]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA24890 for ; Mon, 18 May 1998 03:39:47 -0700 (PDT) (envelope-from luoqi@chen.ml.org) Received: (from root@localhost) by chen.ml.org (8.8.8/8.8.8) id GAA02762; Mon, 18 May 1998 06:39:48 -0400 (EDT) (envelope-from luoqi) Message-Id: <199805181039.GAA02762@chen.ml.org> Date: Mon, 18 May 1998 06:39:48 -0400 (EDT) From: Luoqi Chen Reply-To: luoqi@chen.ml.org To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/6676: natd doesn't respond to SIGTERM Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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