summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2010-12-23 23:19:19 +0300
committerDmitry Kozlov <xeb@mail.ru>2010-12-23 23:19:19 +0300
commit69d7920a494e2ee9c40bda9afe84d69f89d28aea (patch)
tree47f5b39d3d65afd7d98a1a60a684e550cf286a72
parent1639b17d0126f1dec0a8823d33c0a88cf681184d (diff)
downloadaccel-ppp-69d7920a494e2ee9c40bda9afe84d69f89d28aea.tar.gz
accel-ppp-69d7920a494e2ee9c40bda9afe84d69f89d28aea.zip
ppp,radius,cli: send Acct-Terminate-Cause=NAS-Reboot when daemon shutdown from cli
-rw-r--r--accel-pptpd/cli/std_cmd.c14
-rw-r--r--accel-pptpd/ppp/ppp.h3
-rw-r--r--accel-pptpd/radius/acct.c3
3 files changed, 17 insertions, 3 deletions
diff --git a/accel-pptpd/cli/std_cmd.c b/accel-pptpd/cli/std_cmd.c
index 58fd76b3..127e7a27 100644
--- a/accel-pptpd/cli/std_cmd.c
+++ b/accel-pptpd/cli/std_cmd.c
@@ -306,6 +306,16 @@ static void shutdown_help(char * const *fields, int fields_cnt, void *client)
cli_send(client, "\t\tcancel - cancel 'shutdown soft' and return to normal operation\r\n");
}
+static void ppp_terminate_soft2(struct ppp_t *ppp)
+{
+ ppp_terminate(ppp, TERM_NAS_REBOOT, 0);
+}
+
+static void ppp_terminate_hard2(struct ppp_t *ppp)
+{
+ ppp_terminate(ppp, TERM_NAS_REBOOT, 1);
+}
+
static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
{
int hard = 0;
@@ -329,9 +339,9 @@ static int shutdown_exec(const char *cmd, char * const *f, int f_cnt, void *cli)
pthread_rwlock_rdlock(&ppp_lock);
list_for_each_entry(ppp, &ppp_list, entry) {
if (hard)
- triton_context_call(ppp->ctrl->ctx, (triton_event_func)ppp_terminate_hard, ppp);
+ triton_context_call(ppp->ctrl->ctx, (triton_event_func)ppp_terminate_hard2, ppp);
else
- triton_context_call(ppp->ctrl->ctx, (triton_event_func)ppp_terminate_soft, ppp);
+ triton_context_call(ppp->ctrl->ctx, (triton_event_func)ppp_terminate_soft2, ppp);
}
pthread_rwlock_unlock(&ppp_lock);
diff --git a/accel-pptpd/ppp/ppp.h b/accel-pptpd/ppp/ppp.h
index 38e07074..c633135c 100644
--- a/accel-pptpd/ppp/ppp.h
+++ b/accel-pptpd/ppp/ppp.h
@@ -52,7 +52,8 @@
#define TERM_USER_ERROR 4
#define TERM_NAS_ERROR 5
#define TERM_NAS_REQUEST 6
-#define TERM_AUTH_ERROR 7
+#define TERM_NAS_REBOOT 7
+#define TERM_AUTH_ERROR 8
struct ppp_t;
diff --git a/accel-pptpd/radius/acct.c b/accel-pptpd/radius/acct.c
index 9d951e4e..86dd0cd0 100644
--- a/accel-pptpd/radius/acct.c
+++ b/accel-pptpd/radius/acct.c
@@ -274,6 +274,9 @@ void rad_acct_stop(struct radius_pd_t *rpd)
case TERM_NAS_REQUEST:
rad_packet_add_val(rpd->acct_req->pack, "Acct-Terminate-Cause", "NAS-Request");
break;
+ case TERM_NAS_REBOOT:
+ rad_packet_add_val(rpd->acct_req->pack, "Acct-Terminate-Cause", "NAS-Reboot");
+ break;
}
rad_packet_change_val(rpd->acct_req->pack, "Acct-Status-Type", "Stop");
req_set_stat(rpd->acct_req, rpd->ppp);