Skip to contentSkip to conversation

Use Disconnect-Cause=Admin-Reset if SIGTERM received

PATCH In review Alexey Mahotkin 2 participants 3 messages May 27, 2010 – May 29, 2010 PPP protocol drivers and compressors

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 Use Disconnect-Cause=Admin-Reset if SIGTERM received

---
 pppd/main.c                  |    2 +-
 pppd/plugins/radius/radius.c |    5 ++++-
 pppd/pppd.h                  |    1 +
 3 files changed, 6 insertions(+), 2 deletions(-)
pppd/main.c +1 -1
index 3cc2624..f97c8ad 100644
@@ -633,7 +633,7 @@ handle_events()
 	kill_link = 1;
 	asked_to_quit = 1;
 	persist = 0;
-	status = EXIT_USER_REQUEST;
+	status = EXIT_SIGTERM;
 	got_sigterm = 0;
     }
     if (got_sigchld) {
pppd/plugins/radius/radius.c +4 -1
index b882e7a..5d1c619 100644
@@ -989,10 +989,13 @@ radius_acct_stop(void)
     av_type = PW_NAS_ERROR;
     switch( status ) {
 	case EXIT_OK:
-	case EXIT_USER_REQUEST:
 	    av_type = PW_USER_REQUEST;
 	    break;
 
+	case EXIT_SIGTERM:
+	    av_type = PW_ADMIN_RESET;
+	    break;
+
 	case EXIT_HANGUP:
 	case EXIT_PEER_DEAD:
 	case EXIT_CONNECT_FAILED:
pppd/pppd.h +1 -0
index cf9840a..dfa9112 100644
@@ -808,6 +808,7 @@ extern void (*snoop_send_hook) __P((unsigned char *p, int len));
 #define EXIT_TRAFFIC_LIMIT	20
 #endif
 #define EXIT_CNID_AUTH_FAILED	21
+#define EXIT_SIGTERM	        23
 
 /*
  * Debug macros.  Slightly useful for finding bugs in pppd, not particularly
Signature · 1 line
1.6.2.5
#1 lore raw

Re: [PATCH 6/6] Use Disconnect-Cause=Admin-Reset if SIGTERM

First off, thanks for putting together this set of patches. This one needs a little more explanation, however, concerning what the distinction between the existing EXIT_USER_REQUEST and the new EXIT_SIGTERM is. Why do we need a separate code for kill -TERM vs. kill -HUP? And shouldn't a ^C at pppd's controlling terminal result in EXIT_USER_REQUEST rather than EXIT_SIGTERM?

Adding a new EXIT_SIGTERM also has the possibility of breaking existing scripts that look at pppd's exit code. Plus, if we're going to add it, it would need to be documented in pppd.8.

On the whole, I think it would be better just to make EXIT_USER_REQUEST result in PW_ADMIN_RESET and drop the new EXIT_SIGTERM.

Paul.

#2 lore raw
In reply to Alexey Mahotkin
Quoted 3 lines · Paul Mackerras

On the whole, I think it would be better just to make EXIT_USER_REQUEST result in PW_ADMIN_RESET and drop the new EXIT_SIGTERM.

Ok, I'll agree.

Thank you,

Signature · 2 lines
Alexey Mahotkin
http://squadette.ru/