diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2013-06-11 16:09:42 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2013-06-11 16:09:42 +0400 |
commit | 23ef56423c127464216d534fe12a206c807a53d1 (patch) | |
tree | 549791f2dd706a740822ce85b1f2d9854a04950c /accel-pppd | |
parent | ca0729a15bd271d9cb85c5e493e98d3b5b6f7fea (diff) | |
download | accel-ppp-23ef56423c127464216d534fe12a206c807a53d1.tar.gz accel-ppp-23ef56423c127464216d534fe12a206c807a53d1.zip |
fixed 'restart' commnd (stops all sessions, then do restart)
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/cli/std_cmd.c | 32 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 6 | ||||
-rw-r--r-- | accel-pppd/main.c | 4 |
3 files changed, 19 insertions, 23 deletions
diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c index 38198a2..84a7711 100644 --- a/accel-pppd/cli/std_cmd.c +++ b/accel-pppd/cli/std_cmd.c @@ -341,41 +341,37 @@ static void reload_help(char * const *fields, int fields_cnt, void *client) //========================== -static void __do_restart(void) +static void __do_restart1(void) { -#ifdef USE_BACKUP - core_restart(0); -#else core_restart(1); -#endif - _exit(0); } +static void __do_restart0(void) +{ + core_restart(0); +} + + static int restart_exec(const char *cmd, char * const *f, int f_cnt, void *cli) { - int hard = 0; + void (*restart)(void); if (f_cnt == 2) { if (strcmp(f[1], "soft") == 0) - hard = 0; + restart = __do_restart1; else if (strcmp(f[1], "gracefully") == 0) - hard = 1; + restart = __do_restart0; else if (strcmp(f[1], "hard") == 0) - __do_restart(); + core_restart(0); else return CLI_CMD_SYNTAX; } else if (f_cnt == 1) - hard = 0; + restart = __do_restart1; else return CLI_CMD_SYNTAX; - if (hard) { - core_restart(1); - _exit(0); - } else { - ap_shutdown_soft(__do_restart); - terminate_all_sessions(0); - } + ap_shutdown_soft(restart); + terminate_all_sessions(0); return CLI_CMD_OK; } diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 3e3a3e8..e9edd9b 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -534,14 +534,14 @@ static void __ipoe_session_start(struct ipoe_session *ses) ses->siaddr = ses->router; if (!ses->siaddr) + find_gw_addr(ses); + + if (!ses->siaddr) ses->siaddr = ses->serv->opt_src; if (!ses->siaddr && ses->serv->dhcpv4_relay) ses->siaddr = ses->serv->dhcpv4_relay->giaddr; - if (!ses->siaddr) - find_gw_addr(ses); - if (!ses->siaddr) { log_ppp_error("can't determine Server-ID\n"); ap_session_terminate(&ses->ses, TERM_NAS_ERROR, 0); diff --git a/accel-pppd/main.c b/accel-pppd/main.c index 8a75d5d..365aee0 100644 --- a/accel-pppd/main.c +++ b/accel-pppd/main.c @@ -148,7 +148,7 @@ void core_restart(int soft) if (fork()) { //close_all_fd(); - return; + _exit(0); } pthread_sigmask(SIG_SETMASK, &orig_set, NULL); @@ -180,7 +180,7 @@ void core_restart(int soft) sprintf(exe, "/proc/%u/exe", getpid()); readlink(exe, exe, PATH_MAX); - if (!f) + if (!f && soft) argv[n++] = "--internal"; argv[n++] = NULL; |