Index: busybox-1.31.1/init/init.c =================================================================== --- busybox-1.31.1.orig/init/init.c 2021-03-31 20:03:39.284137278 +0800 +++ busybox-1.31.1/init/init.c 2021-03-31 19:41:32.417070800 +0800 @@ -944,6 +944,28 @@ _exit(EXIT_SUCCESS); } +int checkBr2684ctlExist(void); +int checkBr2684ctlExist(void) +{ + int Br2684ctlExist = 0; + char tmp[128] = {0}, buf[128] = {0}; + FILE *fp = NULL; + + system("ps | grep br2684ctl >/tmp/br2684.txt"); + if((fp = fopen("/tmp/br2684.txt", "r")) != NULL){ + while(fgets(buf, sizeof(buf) - 1, fp)){ + if(!strstr(buf, "grep") && strstr(buf, "br2684ctl")){ + Br2684ctlExist = 1; + break; + } + } + fclose(fp); + } + unlink(tmp); + + return Br2684ctlExist; +} + static void run_shutdown_and_kill_processes(void) { /* Run everything to be run at "shutdown". This is done _prior_ @@ -953,6 +975,11 @@ message(L_CONSOLE | L_LOG, "The system is going down NOW!"); + if(checkBr2684ctlExist() == 1){// kill pppd first, otherwise CPE does not send PADT + system("killall pppd"); + usleep(500000);system("killall -9 pppd"); + } + /* Send signals to every process _except_ pid 1 */ kill(-1, SIGTERM); message(L_CONSOLE, "Sent SIG%s to all processes", "TERM");