Bug 94485 - ipacctd may miss signals
Summary: ipacctd may miss signals
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: skv
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-15 17:30 UTC by Eugene Grosbein
Modified: 2006-03-16 14:16 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein 2006-03-15 17:30:24 UTC
	A kernel does not deliver signals to ipacctd
	when its parent has masked signals before starting ipacctd.
	For example, this is a case for mpd and its ip-up scripts.

Fix: ipacctd should unmask signals it expects to catch.
	Here is ports/net-mgmt/ipacctd/files/patch-sigunmask
	implementing this behavour.



Eugene Grosbein--RK6i0rMSUVnLNUFTO4jZIGapDVpmQ7hAMkh3mFtfjhkwfzIQ
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- src/ipacctd.c.orig	Wed Mar 15 21:36:48 2006
+++ src/ipacctd.c	Wed Mar 15 21:53:09 2006
@@ -138,6 +138,7 @@
 	fd_set 	allsocks;
 	struct 	ip *ip;
 	struct 	acct rec;
+	sigset_t set;
     
 	bzero(&ds, size_ds);
 	max_nrecords = MAX_NRECORDS;
@@ -198,6 +199,12 @@
 	}
 
 	/* signal handling */
+	sigemptyset(&set);
+	sigaddset(&set, SIGTERM);
+	sigaddset(&set, SIGHUP);
+	sigaddset(&set, SIGUSR2);
+	sigprocmask(SIG_UNBLOCK, &set, NULL);
+	
 	if (signal(SIGTERM, catch_signal) == SIG_ERR)
 		err(1, "signal(SIGTERM)");
 	if (!flag_server)
How-To-Repeat: 	Run ipacctd using scripts that mpd invokes when an interface comes up.
	ipacctd will run with some signals being masked out.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-03-15 20:58:03 UTC
Responsible Changed
From-To: freebsd-ports-bugs->skv

Over to maintainer
Comment 2 skv freebsd_committer freebsd_triage 2006-03-16 14:16:27 UTC
State Changed
From-To: open->closed

Committed, thanks.