20180911_jeffrey - silenceuncrio/diary GitHub Wiki
ariel 表示 banner 上的 signa 顯示很長都是 0 格
我先把昨天為了 real time usage 的動態顯示告一段落
使用 angular-gauge 這個 library
proscend/prosrc/www/app/app.module.js
@@ -1 +1 @@
-angular.module('app', ['ngRoute', 'pascalprecht.translate', 'ngFileUpload', 'ngFileSaver', 'chart.js']);
+angular.module('app', ['ngRoute', 'pascalprecht.translate', 'ngFileUpload', 'ngFileSaver', 'chart.js', 'angularjs-gauge']);
proscend/prosrc/www/app/feature/usage_apn.html
@@ -62,6 +62,30 @@
<div id="real_time" class="tab-pane fade in active">
+ <h4 class="text-center">Used MB in 10 Seconds</h4>
+
+ <br />
+
+ <div class="row">
+ <div class="col-md-4">
+ <ng-gauge type="arch" value="vm.real_time.recent_10secs_data[0]"
+ size="260" thick="12" min="0" max="40"
+ label="Download" append="MB" foreground-color="#0000ff"></ng-gauge>
+ </div>
+ <div class="col-md-4">
+ <ng-gauge type="arch" value="vm.real_time.recent_10secs_data[1]"
+ size="260" thick="12" min="0" max="40"
+ label="Upload" append="MB" foreground-color="#00ff00"></ng-gauge>
+ </div>
+ <div class="col-md-4">
+ <ng-gauge type="arch" value="vm.real_time.recent_10secs_data[2]"
+ size="260" thick="12" min="0" max="40"
+ label="Total" append="MB" foreground-color="#800080"></ng-gauge>
+ </div>
+ </div>
+
+ <br />
+
<canvas
id="line"
class="chart chart-line"
proscend/prosrc/www/app/feature/usage_apn1.js
@@ -28,7 +28,7 @@ function config($routeProvider) {
})
};
-function controller($scope, $interval, icos, real_time, info) {
+function controller($scope, $interval, $timeout, icos, real_time, info) {
var vm = this;
vm._real_time = real_time;
@@ -98,6 +98,8 @@ function controller($scope, $interval, icos, real_time, info) {
[vm._real_time.apn0_month_rx], [vm._real_time.apn0_month_tx], [vm._real_time.apn0_DisplayTotal],
];
+ vm.real_time.recent_10secs_data = [0, 0, 0];
+
vm.real_time.labels = [
60, 58, 56, 54, 52, 50, 48, 46, 44, 42,
40, 38, 36, 34, 32, 30, 28, 26, 24, 22,
@@ -122,6 +124,17 @@ function controller($scope, $interval, icos, real_time, info) {
if (vm.real_time.data[i].length > 30) {
vm.real_time.data[i].shift();
}
+
+ if (vm.real_time.data[i].length >= 6) {
+ vm.real_time.recent_10secs_data[i] =
+ vm.real_time.data[i][vm.real_time.data[i].length - 1] -
+ vm.real_time.data[i][vm.real_time.data[i].length - 6];
+ } else {
+ vm.real_time.recent_10secs_data[i] =
+ vm.real_time.data[i][vm.real_time.data[i].length - 1] -
+ vm.real_time.data[i][0];
+ }
+
}
});
}
proscend/prosrc/www/app/feature/usage_apn2.js
@@ -28,7 +28,7 @@ function config($routeProvider) {
})
};
-function controller($scope, $interval, icos, real_time, info) {
+function controller($scope, $interval, $timeout, icos, real_time, info) {
var vm = this;
vm._real_time = real_time;
@@ -98,6 +98,8 @@ function controller($scope, $interval, icos, real_time, info) {
[vm._real_time.apn1_month_rx], [vm._real_time.apn1_month_tx], [vm._real_time.apn1_DisplayTotal],
];
+ vm.real_time.recent_10secs_data = [0, 0, 0];
+
vm.real_time.labels = [
60, 58, 56, 54, 52, 50, 48, 46, 44, 42,
40, 38, 36, 34, 32, 30, 28, 26, 24, 22,
@@ -113,6 +115,8 @@ function controller($scope, $interval, icos, real_time, info) {
vm.real_time.datasetOverride = angular.copy(vm.chart_template.datasetOverride);
+
+
function updateTime() {
icos.usage_display.real_time().then(function(result) {
vm.real_time.data[0].push(result.data.real_time.apn1_month_rx);
@@ -122,6 +126,16 @@ function controller($scope, $interval, icos, real_time, info) {
if (vm.real_time.data[i].length > 30) {
vm.real_time.data[i].shift();
}
+
+ if (vm.real_time.data[i].length >= 6) {
+ vm.real_time.recent_10secs_data[i] =
+ vm.real_time.data[i][vm.real_time.data[i].length - 1] -
+ vm.real_time.data[i][vm.real_time.data[i].length - 6];
+ } else {
+ vm.real_time.recent_10secs_data[i] =
+ vm.real_time.data[i][vm.real_time.data[i].length - 1] -
+ vm.real_time.data[i][0];
+ }
}
});
}
proscend/prosrc/www/src/index.html.src
@@ -35,6 +35,8 @@
<script src="libs/angular-chart/Chart.min.js"></script>
<script src="libs/angular-chart/angular-chart.js"></script>
+<script src="libs/angularjs-gauge/angularjs-gauge.js"></script>
+
<script src="app/app.module.js"></script>
<script src="app/app.controller.js"></script>
<script src="app/app.translate-config.js"></script>
效果如下
在 real time usage 的 download 從 16x 遞增到 18x 的過程雖然很和緩
但透過目前追加的 Used MB in 10 Seconds
顯示
使用者可以很直觀的感受到目前正在發生什麼事
build image 測一下
上 code
commit e93dca8104934c12148e70354675817cef4668e6
Refs: [release/v0.07], {origin/release/v0.07}
Author: jeffrey <[email protected]>
Date: Tue Sep 11 10:21:50 2018 +0800
dual APN have their own APN Usage web page:
- add 'Used MB in 10 Seconds' at 'Real Time' tab
proscend/prosrc/www/app/app.module.js | 2 +-
proscend/prosrc/www/app/feature/usage_apn.html | 24 ++
proscend/prosrc/www/app/feature/usage_apn1.js | 15 +-
proscend/prosrc/www/app/feature/usage_apn2.js | 16 +-
.../www/libs/angularjs-gauge/angularjs-gauge.js | 366 +++++++++++++++++++++
proscend/prosrc/www/src/index.html.src | 2 +
6 files changed, 422 insertions(+), 3 deletions(-)
來看一下 banner 上的 signa 發生什麼事
盤一下相關的 source code
top.html
<p class="navbar-text">
<img ng-src="{{vm.get_signal_img(vm.share.signal)}}" height="20"> {{vm.help.rssi}} {{vm.share.operator}}</p>
<p class="navbar-text">{{ 'IDENTIFICATION_SYSTEM_UPTIME' | translate }}: {{vm.help.sysUpTime_text}}</p>
app.controller.js
function get_signal_img(signal) {
switch (signal) {
case 1: return "app/images/signal-1.png";
case 2: return "app/images/signal-2.png";
case 3: return "app/images/signal-3.png";
case 4: return "app/images/signal-4.png";
default: return "app/images/signal-0.png";
}
}
function appController($scope, $translate, $templateCache, $interval, icos, share) {
vm.share = {};
vm.get_signal_img = get_signal_img;
function interval_10sec_fn() {
icos.status.top()
.then(function(result) {
vm.top = result.data.top;
// update to share service date
share.data.signal = vm.top.signal;
if (vm.top.lte_cur_proto_state == 2) {
share.data.operator = vm.top.modem_operator_name;
} else {
share.data.operator = "";
}
vm.help.sysUpTime_text = time2text(vm.top.sysUpTime);
if (vm.top.lte_cur_rssi == 0) {
vm.help.rssi = "(RSSI: N/A)"
} else {
vm.help.rssi = "(RSSI: " + vm.top.lte_cur_rssi + " dBm)"
}
})
}
function interval_3sec_fn() {
// update from share service data
vm.share.signal = share.data.signal;
}
}
異常的畫面如下
我還可以看到隨著時間會跳動
把會異動的部分打印 - proscend/prosrc/www/app/app.controller.js
@@ -120,6 +120,7 @@ function appController($scope, $translate, $templateCache, $interval, icos, shar
// update from share service data
vm.share.operator = share.data.operator;
vm.share.signal = share.data.signal;
+ console.log("vm.share.signal: ", vm.share.signal);
vm.share.whoAmI = share.data.whoAmI;
馬上看到異常現象
這是因為 status.js
熱心幫倒忙的關係
function status_controller($scope, $timeout, $route, $templateCache, share, status) {
// update to share service data
share.data.signal = vm.status.current_sim.signal;
}
拿掉吧
banner 靠自己就好了
不要透過 share 互相干擾 - proscend/prosrc/www/app/feature/status.js
@@ -30,8 +30,7 @@ angular
.module('app')
.controller('status_controller', status_controller);
-function status_controller(
- $scope, $timeout, $route, $templateCache, share, status) {
+function status_controller($scope, $timeout, $route, $templateCache, status) {
// clear out $templateCache in AngularJS
$templateCache.removeAll();
@@ -40,11 +39,6 @@ function status_controller(
vm.status = status;
- // update to share service data
- share.data.signal = vm.status.current_sim.signal;
-
-
-
var timer;
vm.myLoop = function() {
先 stash 一下
把一些不相干的 brand 先刪掉
ommit e586abe1e3f49a073640a56eba93348836be9de7
Refs: [release/v0.07], {origin/release/v0.07}
Author: jeffrey <[email protected]>
Date: Tue Sep 11 11:01:52 2018 +0800
refactoring
- remove unused files
proscend/prosrc/www/Makefile | 49 +--------
.../prosrc/www/brand_ctcu/app/images/signal-0.png | Bin 10849 -> 0 bytes
.../prosrc/www/brand_ctcu/app/images/signal-1.png | Bin 7738 -> 0 bytes
.../prosrc/www/brand_ctcu/app/images/signal-2.png | Bin 7601 -> 0 bytes
.../prosrc/www/brand_ctcu/app/images/signal-3.png | Bin 7354 -> 0 bytes
.../prosrc/www/brand_ctcu/app/images/signal-4.png | Bin 6548 -> 0 bytes
proscend/prosrc/www/brand_ctcu/brand/body_bg.png | Bin 127328 -> 0 bytes
proscend/prosrc/www/brand_ctcu/brand/custom.css | 65 ------------
proscend/prosrc/www/brand_ctcu/brand/top.png | Bin 18134 -> 0 bytes
.../prosrc/www/brand_ctcu/src/brand/top.html.src | 49 ---------
.../prosrc/www/brand_cxr/app/images/signal-0.png | Bin 10535 -> 0 bytes
.../prosrc/www/brand_cxr/app/images/signal-1.png | Bin 7344 -> 0 bytes
.../prosrc/www/brand_cxr/app/images/signal-2.png | Bin 7275 -> 0 bytes
.../prosrc/www/brand_cxr/app/images/signal-3.png | Bin 7169 -> 0 bytes
.../prosrc/www/brand_cxr/app/images/signal-4.png | Bin 6548 -> 0 bytes
proscend/prosrc/www/brand_cxr/brand/custom.css | 62 -----------
proscend/prosrc/www/brand_cxr/brand/top.png | Bin 87348 -> 0 bytes
.../prosrc/www/brand_cxr/src/brand/top.html.src | 49 ---------
.../www/brand_digicomm/app/images/signal-0.png | Bin 9503 -> 0 bytes
.../www/brand_digicomm/app/images/signal-1.png | Bin 5878 -> 0 bytes
.../www/brand_digicomm/app/images/signal-2.png | Bin 6176 -> 0 bytes
.../www/brand_digicomm/app/images/signal-3.png | Bin 6493 -> 0 bytes
.../www/brand_digicomm/app/images/signal-4.png | Bin 6548 -> 0 bytes
proscend/prosrc/www/brand_digicomm/brand/body.jpg | Bin 128133 -> 0 bytes
.../prosrc/www/brand_digicomm/brand/bottom.html | 8 --
.../prosrc/www/brand_digicomm/brand/custom.css | 39 -------
proscend/prosrc/www/brand_digicomm/brand/top.html | 34 -------
proscend/prosrc/www/brand_digicomm/brand/top.png | Bin 11392 -> 0 bytes
.../prosrc/www/brand_digicomm/brand/top_gnss.html | 45 --------
.../www/brand_digicomm/src/brand/top.html.src | 50 ---------
.../www/brand_planet/app/images/signal-0.png | Bin 9503 -> 0 bytes
.../www/brand_planet/app/images/signal-1.png | Bin 5878 -> 0 bytes
.../www/brand_planet/app/images/signal-2.png | Bin 6176 -> 0 bytes
.../www/brand_planet/app/images/signal-3.png | Bin 6493 -> 0 bytes
.../www/brand_planet/app/images/signal-4.png | Bin 6548 -> 0 bytes
proscend/prosrc/www/brand_planet/brand/custom.css | 56 ----------
proscend/prosrc/www/brand_planet/brand/top.png | Bin 15381 -> 0 bytes
proscend/prosrc/www/brand_planet/brand/top_bg.png | Bin 175 -> 0 bytes
.../prosrc/www/brand_planet/src/brand/top.html.src | 49 ---------
proscend/prosrc/www/react/05/M300App.jsx | 113 ---------------------
proscend/prosrc/www/react/05/index.html | 23 -----
proscend/prosrc/www/react/06/Lanst.jsx | 49 ---------
proscend/prosrc/www/react/06/M300App.jsx | 21 ----
proscend/prosrc/www/react/06/Wanst.jsx | 51 ----------
proscend/prosrc/www/react/06/index.html | 27 -----
proscend/prosrc/www/react/07/Lanst.jsx | 91 -----------------
proscend/prosrc/www/react/07/M300App.jsx | 21 ----
proscend/prosrc/www/react/07/Wanst.jsx | 51 ----------
proscend/prosrc/www/react/07/index.html | 27 -----
proscend/prosrc/www/react/index_00.html | 23 -----
proscend/prosrc/www/react/index_00.jsx | 31 ------
proscend/prosrc/www/react/index_01.html | 23 -----
proscend/prosrc/www/react/index_01.jsx | 31 ------
proscend/prosrc/www/react/index_02.html | 23 -----
proscend/prosrc/www/react/index_02.jsx | 41 --------
proscend/prosrc/www/react/index_03.html | 23 -----
proscend/prosrc/www/react/index_03.jsx | 79 --------------
proscend/prosrc/www/react/index_04.html | 23 -----
proscend/prosrc/www/react/index_04.jsx | 113 ---------------------
59 files changed, 1 insertion(+), 1438 deletions(-)
繼續
proscend/prosrc/www/brand_nobrand/src/brand/top.html.src
@@ -7,7 +7,7 @@
</a>
</div>
<p class="navbar-text">
- <img ng-src="{{vm.get_signal_img(vm.share.signal)}}" height="20"> {{vm.help.rssi}} {{vm.share.operator}}</p>
+ <img ng-src="{{vm.get_signal_img(vm.help.signal)}}" height="20"> {{vm.help.rssi}} {{vm.help.operator}}</p>
<p class="navbar-text">{{ 'IDENTIFICATION_SYSTEM_UPTIME' | translate }}: {{vm.help.sysUpTime_text}}</p>
#ifndef PROSRC_BRCTL_LAN2
proscend/prosrc/www/brand_proscend/src/brand/top.html.src
@@ -7,7 +7,7 @@
</a>
</div>
<p class="navbar-text">
- <img ng-src="{{vm.get_signal_img(vm.share.signal)}}" height="20"> {{vm.help.rssi}} {{vm.share.operator}}</p>
+ <img ng-src="{{vm.get_signal_img(vm.help.signal)}}" height="20"> {{vm.help.rssi}} {{vm.help.operator}}</p>
<p class="navbar-text">{{ 'IDENTIFICATION_SYSTEM_UPTIME' | translate }}: {{vm.help.sysUpTime_text}}</p>
#ifndef PROSRC_BRCTL_LAN2
這樣一來 proscend/prosrc/www/app/app.controller.js
就顧好自己就好了
@@ -69,18 +69,14 @@ function appController($scope, $translate, $templateCache, $interval, icos, shar
var vm = this;
- vm.share = {};
-
vm.language = "en";
vm.language_change = function() {
$translate.use(vm.language);
};
vm.operator = "NA";
- vm.signal_img = "app/images/signal-0.png";
vm.help = {};
- vm.help.gnss_link_to_google_maps = 0;
vm.get_signal_img = get_signal_img;
@@ -92,13 +88,12 @@ function appController($scope, $translate, $templateCache, $interval, icos, shar
.then(function(result) {
vm.top = result.data.top;
- // update to share service date
- share.data.signal = vm.top.signal;
+ vm.help.signal = vm.top.signal;
if (vm.top.lte_cur_proto_state == 2) {
- share.data.operator = vm.top.modem_operator_name;
+ vm.help.operator = vm.top.modem_operator_name;
} else {
- share.data.operator = "";
+ vm.help.operator = "";
}
vm.help.sysUpTime_text = time2text(vm.top.sysUpTime);
@@ -115,25 +110,12 @@ function appController($scope, $translate, $templateCache, $interval, icos, shar
- function interval_3sec_fn() {
-
- // update from share service data
- vm.share.operator = share.data.operator;
- vm.share.signal = share.data.signal;
-
- vm.share.whoAmI = share.data.whoAmI;
-
- }
-
var interval_10sec = $interval(interval_10sec_fn, 10000);
- var interval_3sec = $interval(interval_3sec_fn, 3000);
interval_10sec_fn();
- interval_3sec_fn();
$scope.$on("$destroy", function (event) {
$interval.cancel(interval_10sec);
- $interval.cancel(interval_3sec);
});
}
build 個 image 試試
PASS
上 code
commit a003387cd03f8854c676d1fbfbbfc71e91d7d658
Refs: [release/v0.07], {origin/release/v0.07}
Author: jeffrey <[email protected]>
Date: Tue Sep 11 11:57:31 2018 +0800
fix the abnormal signal display at banner bar
proscend/prosrc/www/app/app.controller.js | 24 +++-------------------
proscend/prosrc/www/app/feature/status.js | 8 +-------
.../www/brand_nobrand/src/brand/top.html.src | 2 +-
.../www/brand_proscend/src/brand/top.html.src | 2 +-
4 files changed, 6 insertions(+), 30 deletions(-)
回頭看一下 M300 的 banner 是不是也有一樣的問題
M300 的 status.js 並沒有熱心幫倒忙
再 build 最新的 image 作整合測試
Client List 異常
剛剛我已經先 Load Factory 後只改了 Daul APN 的設定
- LTE Net Mode: Bridge + Router
- APN1 - APN: internet
- APN2 - APN: emome
apply 之後重開機
幫忙追一下好了
相關 CGI 如下
dhcp_client_list.c
static void _lan()
{
json_object *dhcp_client_list = json_object_new_array();
if (ICOS_GetStatus(MODULE_DHCP, 0, 0, dhcp_client_list, sizeof(dhcp_client_list)) == ICOS_SUCCESS)
{
jweb.out.json.data("dhcp_client_list", dhcp_client_list);
}
else
{
jweb.out.json.fail("DHCPClientList.sh fail");
}
}
對應的 icos 為
static int GetClientList(int flag, int index, void* pStruct, int structSize)
{
if (pStruct == NULL)
{
return ICOS_FAILURE;
}
json_object *result = (json_object *) pStruct;
if (json_object_get_type(result) != json_type_array)
{
return ICOS_FAILURE;
}
char *output = get_command_output("DHCPClientList.sh -l /var/dhcp/dhcpd.leases -f lan");
json_object *clients = NULL;
if (output)
{
_LOG_DEBUG("The output is %s", output);
clients = json_tokener_parse(output);
if (clients == NULL)
{
_LOG_ERROR("Failed to convert the %s to JSON object", output);
}
free(output);
}
if (clients)
{
for (int i = 0; i < json_object_array_length(clients); i++)
{
json_object_array_add(result,
json_object_load(json_object_array_get_idx(clients, i)));
}
json_object_put(clients);
return ICOS_SUCCESS;
}
return ICOS_FAILURE;
}
在錯誤發生的當下
root@M360-P:~# DHCPClientList.sh -l /var/dhcp/dhcpd.leases -f lan
The /var/dhcp/dhcpd.leases not existed
/var/dhcp/dhcpd.leases
這檔案並不存在
已告知 aaron 協助處理
APN Usage - real time - used mb in 10 seconds - 微調 水平對齊
commit 3da837d4ba0e1092065373582170f33634e5e4b0
Refs: [release/v0.07], {origin/release/v0.07}
Author: jeffrey <[email protected]>
Date: Tue Sep 11 14:06:48 2018 +0800
dual APN have their own APN Usage web page:
- fine tune the horizontal alignment
proscend/prosrc/www/app/feature/usage_apn.html | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
aaron 已經把問題修正了
改 build 一版 PI 的試試
注意到語系的部分有 繁體中文 和 法文
nobrand 為了 demo 用會有全部的語系
不過 PI 就只保留英文就好了
但只保留英文一個選項卻還是用下拉選單來呈現的話更奇怪
算了 不改了
再盤一下 M360 還有什麼需要作的
john 請我把 Ethernet Ports 的 1000 Half 選項拿掉
proscend/prosrc/www/app/feature/switch.html
@@ -46,7 +46,6 @@
ng-model="vm.config.mediaMode" convert-to-number>
<option value="0">Auto</option>
<option value="6">1000M Full</option>
- <option value="7">1000M Half</option>
<option value="1">100M Full</option>
<option value="2">100M Half</option>
<option value="3">10M Full</option>
commit c8b319bc72a9806fd5cbbe0a5f2896d9620f0d10
Refs: [release/v0.07], {origin/release/v0.07}
Author: jeffrey <[email protected]>
Date: Tue Sep 11 14:55:58 2018 +0800
remove '1000M Half' option from 'Ethernet Ports' web page
proscend/prosrc/www/app/feature/switch.html | 1 -
1 file changed, 1 deletion(-)
繼續盤一下 M360 待作事項
禮拜五的 M360 release 目前看來我可以暫緩休息一下了
回頭先看一下 M300 好了
mantis issue 有五條
- 246 - [web] URL Filter suggest add "back" button
- 245 - [WEB] MAC Filter suggest add "back" button
- 244 - [WEB] IP filter suggest add "back" button
- 243 - [WEB] port forwarding suggest add "back" button
- 236 - (Hytec) Add checking for encrypt file to avoid https start failure.
待作事項有 GRE tunnel with NHRP
我先解 issue - 236 - (Hytec) Add checking for encrypt file to avoid https start failure.
那就 build 一個 M300/10_GPS_HYTEC
先從 /home/log/web.log
來盤一下流程
1536650388[20180911 7:19:48] [notify_web:854]Recv bcast evt 14 before module init done.Ignore it.
1536650391[20180911 7:19:51] [notify_web:862]IN(E82|S44|D44)
1536650391[20180911 7:19:51] [notify_web:871]module init
1536650397[20180911 7:19:57] [notify_web:862]IN(E73|S60|D00)
1536650406[20180911 7:20:6] [notify_web:862]IN(E77|S87|D00)
1536650409[20180911 7:20:9] [notify_web:862]IN(E72|S00|D00)
1536650409[20180911 7:20:9] [notify_web:896]boot init done
1536650409[20180911 7:20:9] [web_dump:516]===init config===
1536650409[20180911 7:20:9] [web_dump:526][COM]conn_mgr=1,mod_init_done:1.
1536650409[20180911 7:20:9] [web_dump:554][CFG]mode=both,httpd_port=80,https_port=443,refreshperiod=2,sport=80,intf=lan,secure=all,clienip=0.0.0.0,httpd_access=lan,https_access=lan
1536650409[20180911 7:20:9] [web_dump:562][DMN0]active=1,pid=-1,status=0,flag=0x0,DID0
1536650409[20180911 7:20:9] [web_dump:562][DMN1]active=1,pid=-1,status=0,flag=0x0,DID1
1536650409[20180911 7:20:9] [web_dump:567][RTI]wan4_ifname=,wan6_ifname=.
1536650409[20180911 7:20:9] [notify_web:1039]ipt_mgmt_rule_set[4]: iface_sel=3, wan4_ifname=
1536650409[20180911 7:20:9] [daemon_restart:706][DID0] remain IP server retry for 6 times.
1536650409[20180911 7:20:9] [create_daemon_conf:605]IN
1536650409[20180911 7:20:9] [create_daemon_conf:616]cmd_buf=>dir=/
1536650409[20180911 7:20:9] [create_daemon_conf:621]cmd_buf=>cgipat=cgi-bin/**
1536650409[20180911 7:20:9] [create_daemon_conf:626]cmd_buf=>chroot
1536650409[20180911 7:20:9] [create_daemon_conf:631]cmd_buf=>user=root
1536650409[20180911 7:20:9] [create_daemon_conf:636]cmd_buf=>max_age=0
1536650409[20180911 7:20:9] [create_daemon_conf:641]cmd_buf=>debug
1536650409[20180911 7:20:9] [daemon_restart:748][DMN]Lanch=>/usr/sbin/iweb -p 80 -d /www
1536650409[20180911 7:20:9] [notify_web:1039]ipt_mgmt_rule_set[4]: iface_sel=1, wan4_ifname=
1536650409[20180911 7:20:9] [daemon_restart:706][DID1] remain IP server retry for 6 times.
1536650409[20180911 7:20:9] [gen_key_files:578]IN
1536650409[20180911 7:20:9] [gen_key_files:590]iweb genkey pid = 2198
1536650409[20180911 7:20:9] [gen_key_files:593]OUT
1536650409[20180911 7:20:9] [is_request_start:688][DMN]disabled cause key not ready.
1536650409[20180911 7:20:9] [web_dump:562][DMN0]active=1,pid=2195,status=1,flag=0x0,DID0
1536650409[20180911 7:20:9] [web_dump:562][DMN1]active=1,pid=-1,status=0,flag=0x1,DID1
1536650409[20180911 7:20:9] [web_dump:516]===After daemon restart===
1536650409[20180911 7:20:9] [web_dump:526][COM]conn_mgr=1,mod_init_done:1.
1536650409[20180911 7:20:9] [web_dump:554][CFG]mode=both,httpd_port=80,https_port=443,refreshperiod=2,sport=80,intf=lan,secure=all,clienip=0.0.0.0,httpd_access=lan,https_access=lan
1536650409[20180911 7:20:9] [web_dump:562][DMN0]active=1,pid=2195,status=1,flag=0x0,DID0
1536650409[20180911 7:20:9] [web_dump:562][DMN1]active=1,pid=-1,status=0,flag=0x0,DID1
1536650409[20180911 7:20:9] [web_dump:567][RTI]wan4_ifname=,wan6_ifname=.
1536650412[20180911 7:20:12] [msgcb_web:1209]IN(DID0,pid 2195)
<--
failed to load the session from binary
Icos_users.session_ttl: 300 sec
Icos_users.users[0].name: root
Icos_users.users[0].pass: $1$$2Dg0uARUa9gcTJ9I5/iKb/
Icos_users.users[0].level: 3
Icos_users.users[1].name:
Icos_users.users[1].pass:
Icos_users.users[1].level: 0
Icos_users.users[2].name:
Icos_users.users[2].pass:
Icos_users.users[2].level: 0
Icos_users.users[3].name:
Icos_users.users[3].pass:
Icos_users.users[3].level: 0
Starting iweb on port 80, serving /www
-->
1536650413[20180911 7:20:13] [notify_web:862]IN(E48|S41|D00)
1536650413[20180911 7:20:13] [notify_web:862]IN(E50|S59|D00)
1536650422[20180911 7:20:22] [notify_web:862]IN(E59|S59|D00)
1536650427[20180911 7:20:27] [notify_web:862]IN(E02|S56|D00)
1536650427[20180911 7:20:27] [notify_web:862]IN(E01|S56|D00)
1536650428[20180911 7:20:28] [notify_web:862]IN(E40|S35|D00)
1536650432[20180911 7:20:32] [notify_web:862]IN(E46|S35|D00)
1536650432[20180911 7:20:32] [notify_web:862]IN(E46|S35|D00)
1536650432[20180911 7:20:32] [notify_web:862]IN(E47|S35|D00)
1536650432[20180911 7:20:32] [notify_web:862]IN(E50|S59|D00)
1536650440[20180911 7:20:40] [notify_web:862]IN(E59|S59|D00)
1536650446[20180911 7:20:46] [termcb_web:1082]IN(2198)
1536650446[20180911 7:20:46] [termcb_web:1121]HTTPS key and cert generated done.
1536650446[20180911 7:20:46] [web_dump:516]===Key file generated done, daemon restart===
1536650446[20180911 7:20:46] [web_dump:562][DMN0]active=1,pid=2195,status=1,flag=0x0,DID0
1536650446[20180911 7:20:46] [web_dump:562][DMN1]active=1,pid=-1,status=0,flag=0x0,DID1
1536650446[20180911 7:20:46] [daemon_restart:706][DID1] remain IP server retry for 6 times.
1536650446[20180911 7:20:46] [gen_key_files:578]IN
1536650446[20180911 7:20:46] [gen_key_files:593]OUT
1536650446[20180911 7:20:46] [create_daemon_conf:605]IN
1536650446[20180911 7:20:46] [create_daemon_conf:616]cmd_buf=>dir=/
1536650446[20180911 7:20:46] [create_daemon_conf:621]cmd_buf=>cgipat=cgi-bin/**
1536650446[20180911 7:20:46] [create_daemon_conf:626]cmd_buf=>chroot
1536650446[20180911 7:20:46] [create_daemon_conf:631]cmd_buf=>user=root
1536650446[20180911 7:20:46] [create_daemon_conf:636]cmd_buf=>max_age=0
1536650446[20180911 7:20:46] [create_daemon_conf:641]cmd_buf=>debug
1536650446[20180911 7:20:46] [create_daemon_conf:648]cmd_buf=>ssl
1536650446[20180911 7:20:46] [create_daemon_conf:653]cmd_buf=>certfile=/etc/icos/ca/cert.pem
1536650446[20180911 7:20:46] [daemon_restart:748][DMN]Lanch=>/usr/sbin/iweb -p 443 -d /www -s
1536650446[20180911 7:20:46] [notify_web:862]IN(E85|S67|D00)
1536650447[20180911 7:20:47] [msgcb_web:1209]IN(DID1,pid 4176)
<--
failed to load the session from binary
-->
1536650447[20180911 7:20:47] [msgcb_web:1209]IN(DID1,pid 4176)
<--
Icos_users.session_ttl: 300 sec
-->
1536650447[20180911 7:20:47] [msgcb_web:1209]IN(DID1,pid 4176)
<--
Icos_users.users[0].name: root
Icos_users.users[0].pass: $1$$2Dg0uARUa9gcTJ9I5/iKb/
Icos_users.users[0].level: 3
Icos_users.users[1].name:
Icos_users.users[1].pass:
Icos_users.users[1].level: 0
Icos_users.users[2].name:
Icos_users.users[2].pass:
Icos_users.users[2].level: 0
Icos_users.users[3].name:
Icos_users.users[3].pass:
Icos_users.users[3].level: 0
Starting SSL iweb on port 443, cert from /etc/icos/web/iweb_cert.pem, key from /etc/icos/web/iweb_key.pem, serving /www
-->
簡單看一下 notify_web()
針對 pevent->event_id
的 switch case
static int notify_web(PRO_EVENT *pevent)
{
int i;
sWebConfig *cfg=&gWebCtrl.cfg;
RT_INFO_T *rt_info=&gWebCtrl.rt_info;
if(0==pevent->dst_id && 0==gWebCtrl.mod_init_done)
{
WEB_INFO("Recv bcast evt %d before module init done.Ignore it.\n",pevent->event_id);
return ICOS_SUCCESS;
}
if(MODULE_WEB!=pevent->dst_id && 0!=pevent->dst_id)
{
WEB_INFO("Recv for %d module evt id %d.Ignore it.\n",pevent->dst_id);
return ICOS_SUCCESS;
}
WEB_INFO("IN(E%02d|S%02d|D%02d)\n",pevent->event_id,pevent->src_id,pevent->dst_id);
switch(pevent->event_id)
{
case ICOS_UCAST_MODULE_APPLY:
...
break;
case ICOS_UCAST_MODULE_EXIT:
...
break;
case ICOS_BOOTINIT_DONE:
...
break;
case ICOS_WAN_GATEWAY_UPDATE:
case ICOS_WAN_IP_UPDATE:
...
break;
case ICOS_WAN6_GATEWAY_UPDATE:
case ICOS_WAN6_IP_UPDATE:
...
break;
case ICOS_WAN_LOST_CONNECTION:
...
break;
case ICOS_WAN6_LOST_CONNECTION:
...
break;
case ICOS_SYSTEM_UPDATE:
case ICOS_UCAST_DMN_RESTART:
...
break;
default:
break;
}
...
return ICOS_SUCCESS;
}
耐著性子一條一條 log 來看
1536650388[20180911 7:19:48] [notify_web:854]Recv bcast evt 14 before module init done.Ignore it.
pevent->dst_id
為 0 表示 broadcast
但此時 gWebCtrl.mod_init_done
為 0 表示該 module initialization 仍未完成
if(0==pevent->dst_id && 0==gWebCtrl.mod_init_done)
{
WEB_INFO("Recv bcast evt %d before module init done.Ignore it.\n",pevent->event_id);
return ICOS_SUCCESS;
}
所以忽略該 event
下一個 event
1536650391[20180911 7:19:51] [notify_web:862]IN(E82|S44|D44)
- pevent->event_id = ICOS_UCAST_MODULE_APPLY(82)
- pevent->src_id = MODULE_WEB(44)
- pevent->dst_id = MODULE_WEB(44)
觸發的流程如下
static int InitWeb(char *pCfgStr)
{
if (ApplyWebSetting(OPFLAG_APPLY_WEB_WWW, 0, pCfg,sizeof(*pCfg) ) == ICOS_FAILURE)
{
return ICOS_FAILURE;
}
return ICOS_SUCCESS;
}
static int ApplyWebSetting(int flag, int index, void* pStruct, int structSize)
{
switch (flag)
{
case OPFLAG_APPLY_WEB_WWW:
ICOS_msg_sendto(MODULE_WEB,MODULE_WEB,pCfg,sizeof(sWebConfig),ICOS_UCAST_MODULE_APPLY);
return ICOS_SUCCESS;
default:
return ICOS_FAILURE;
}
}
notify_web()
的實際流程如下
case ICOS_UCAST_MODULE_APPLY:
if(pevent->msg_len==sizeof(sWebConfig))
{
if(0==gWebCtrl.mod_init_done)
{
WEB_INFO("module init\n");
web_init((sWebConfig *)pevent->msg);
gWebCtrl.mod_init_done=1;
}
else
{
if(memcmp(cfg,pevent->msg,sizeof(sWebConfig)))
{
WEB_INFO("USER APPLY\n");
web_dump(DUMP_CFG,"Before user apply");
web_change((sWebConfig *)pevent->msg);
}
}
}
break;
依據 gWebCtrl.mod_init_done
是否為 0 分別呼叫
- web_init()
- web_change()
web_init()
static int web_init(sWebConfig *cfgp)
{
int i;
struct stat st;
memset(&gWebCtrl,0,sizeof(gWebCtrl));
memcpy(&gWebCtrl.cfg,cfgp,sizeof(sWebConfig));
//Common
gWebCtrl.mod_init_done=0;
gWebCtrl.conn_mgr=GetIcosModule(MODULE_CONNMGR)?1:0;
int keyfile = (0 == access(WEB_DAEMON_KEY_FILE, F_OK));
int certfile = (0 == access(WEB_DAEMON_CERT_FILE, F_OK));
//Daemon
for(i=0; MAX_DAEMON_NUM>i; i++)
{
gWebCtrl.dmn_ctrl[i].did=(0==i)?DID_HTTPD:DID_HTTPS;
gWebCtrl.dmn_ctrl[i].active=1;
gWebCtrl.dmn_ctrl[i].status=DAEMON_STATUS_OFF;
gWebCtrl.dmn_ctrl[i].flag=0;
gWebCtrl.dmn_ctrl[i].pid=BAD_PID;
gWebCtrl.dmn_ctrl[i].retry_cnt=MAX_DAEMON_RETRY_NUM; //-1 for forever
gWebCtrl.dmn_ctrl[i].is_keyfile_ready=0;
if (keyfile && certfile)
{
WEB_INFO("[DID%d] Key file generated done.\n", gWebCtrl.dmn_ctrl[i].did);
gWebCtrl.dmn_ctrl[i].is_keyfile_ready=1;
}
}
//Run time info
memset(gWebCtrl.rt_info.wan4_ifname,0,sizeof(gWebCtrl.rt_info.wan4_ifname));
memset(gWebCtrl.rt_info.wan6_ifname,0,sizeof(gWebCtrl.rt_info.wan6_ifname));
return ICOS_SUCCESS;
}
web_change()
static void web_change(sWebConfig *new_cfg)
{
int i;
if(memcmp(new_cfg,&gWebCtrl.cfg,sizeof(*new_cfg)))
{
for(i=0; MAX_DAEMON_NUM>i; i++)
{
gWebCtrl.dmn_ctrl[i].flag=FLAG_DMN_RESTART;
}
memcpy(&gWebCtrl.cfg,new_cfg,sizeof(gWebCtrl.cfg));
}
}
可以發現這兩個 function 都需要跟 gWebCtrl
這個結構互動
看一下 gWebCtrl
這個結構
typedef struct webctrl_s
{
sWebConfig cfg;
DAEMON_CTRL_T dmn_ctrl[MAX_DAEMON_NUM]; //The native dual mode seems not easy tuning. so seperated to two daemon when in dual mode.
RT_INFO_T rt_info;
unsigned char mod_init_done; //icosconfig bootinit -> icoslib -> icospromsg
//Process icosconfig call lib icoslib and then pass message to another process icospromsg
//module init done means process icospromsg recevied icoslib message and init done.
//The purpose is prevent handle recevied notify message in notify_ddns before init done.
unsigned char conn_mgr; //Check if connection management is built in. Since connection management is in charge of
//switch wan interface and default route,and broadcast its specific message ICOS_WAN_GATEWAY_UPDATE
//instead of wan connection protocol(module) broadcast ICOS_WAN_IP_UPDATE.
//0 for not built in and listen ICOS_WAN_IP_UPDATE,1 for built in and listen ICOS_WAN_GATEWAY_UPDATE.
//However,it may not work when not built in connection management since connection proto(module)
//might not set route.
} WEBCTRL_T;
WEBCTRL_T gWebCtrl;
sWebConfig cfg;
這就是我們目前 web 的 configuration
DAEMON_CTRL_T dmn_ctrl[MAX_DAEMON_NUM];
DAEMON_CTRL_T
結構定義如下
typedef struct daemon_ctrl_s
{
unsigned char active; //Control daemon active or not,0 for off,1 for on.
//The purpose is to shutdown daemon for doing some test since active/deactive daemon
//is depend on config;When daemon be killed, it will restart automatically if config is actived
//and no way to stop it.Default MUST be on.
unsigned char status; //When kill daemon by ICOS_Kill API or system call, the daemon need short time to
//exit gracefully.ICOS_Kill API provide a feature callback to indicate daemon exit event.
//After received callback,restart daemon automatically if confg and run time info matched.
unsigned char flag; //Perform related action according to flag event.
unsigned char is_keyfile_ready; //Before deamon start we need to check if key file generated.
int pid; //-1 for uninitialized.
int retry_cnt; //Stop when count down to zero or negative.
//int ip_ver; //Specific the ip version for this daemon, 4 for ipv4,6 for ipv6,and 0 for dual.
int did; //Daemon ID,DID_HTTPD/DID_HTTPS
} DAEMON_CTRL_T;
MAX_DAEMON_NUM
目前為 2
一個 for httpd, 一個 for htts
notify_web() 的 switch case 後還有一部分的 code
static int notify_web(PRO_EVENT *pevent)
{
...
switch(pevent->event_id)
{
...
}
if(gWebCtrl.mod_init_done)
{
int has_restart=0;
int has_fw4_restart=0;
int has_fw6_restart=0;
for(i=0; MAX_DAEMON_NUM>i; i++)
{
if(gWebCtrl.dmn_ctrl[i].flag)
{
int iface_sel;
if (DID_HTTPD==gWebCtrl.dmn_ctrl[i].did)
{
iface_sel=WEB_ATTVAL_ACCESS_INTERFACE_DISABLE==cfg->httpdAccess?IPT_IFACE_DIS:
WEB_ATTVAL_ACCESS_INTERFACE_LAN==cfg->httpdAccess?IPT_IFACE_LAN:
WEB_ATTVAL_ACCESS_INTERFACE_WAN==cfg->httpdAccess?IPT_IFACE_WAN:
WEB_ATTVAL_ACCESS_INTERFACE_ALL==cfg->httpdAccess?IPT_IFACE_ALL:IPT_IFACE_DIS; //Default disable
}
else
{
iface_sel=WEB_ATTVAL_ACCESS_INTERFACE_DISABLE==cfg->httpsAccess?IPT_IFACE_DIS:
WEB_ATTVAL_ACCESS_INTERFACE_LAN==cfg->httpsAccess?IPT_IFACE_LAN:
WEB_ATTVAL_ACCESS_INTERFACE_WAN==cfg->httpsAccess?IPT_IFACE_WAN:
WEB_ATTVAL_ACCESS_INTERFACE_ALL==cfg->httpsAccess?IPT_IFACE_ALL:IPT_IFACE_DIS; //Default disable
}
if((FLAG_DMN_RESTART|FLAG_FW4_RESTART)&gWebCtrl.dmn_ctrl[i].flag)
{
int client_mode=WEB_ATTVAL_BTN_SELECTED==cfg->btnwww2?IPT_CLIENT_SPECIFIC_IP:
WEB_ATTVAL_BTN_ALL==cfg->btnwww2?IPT_CLIENT_ALL:IPT_CLIENT_ALL; //Default ALL
int active=((DID_HTTPD==gWebCtrl.dmn_ctrl[i].did && (ATTVAL_WEBMODE_HTTPD==cfg->mode || ATTVAL_WEBMODE_BOTH==cfg->mode)) ||
(DID_HTTPS==gWebCtrl.dmn_ctrl[i].did && (ATTVAL_WEBMODE_HTTPS==cfg->mode || ATTVAL_WEBMODE_BOTH==cfg->mode)))?1:0;
int port_id=(DID_HTTPS==gWebCtrl.dmn_ctrl[i].did)?cfg->httpsPort:cfg->httpdPort;
WEB_DBG("ipt_mgmt_rule_set[4]: iface_sel=%d, wan4_ifname=%s\n", iface_sel, rt_info->wan4_ifname);
ipt_mgmt_rule_set(4,active,WEB_FW_UCHAIN,iface_sel,IPT_PROTO_TCP,port_id,client_mode,cfg->serverWebClientIP,rt_info->wan4_ifname,
(0==has_fw4_restart++)?1:0);
}
if((FLAG_DMN_RESTART|FLAG_FW6_RESTART)&gWebCtrl.dmn_ctrl[i].flag)
{
int client_mode=WEB_ATTVAL_BTN_SELECTED==cfg->btnwww2?IPT_CLIENT_SPECIFIC_IP:
WEB_ATTVAL_BTN_ALL==cfg->btnwww2?IPT_CLIENT_ALL:IPT_CLIENT_ALL; //Default ALL
int active=((DID_HTTPD==gWebCtrl.dmn_ctrl[i].did && (ATTVAL_WEBMODE_HTTPD==cfg->mode || ATTVAL_WEBMODE_BOTH==cfg->mode)) ||
(DID_HTTPS==gWebCtrl.dmn_ctrl[i].did && (ATTVAL_WEBMODE_HTTPS==cfg->mode || ATTVAL_WEBMODE_BOTH==cfg->mode)))?1:0;
int port_id=(DID_HTTPS==gWebCtrl.dmn_ctrl[i].did)?cfg->httpsPort:cfg->httpdPort;
ipt_mgmt_rule_set(6,active,WEB_FW_UCHAIN,iface_sel,IPT_PROTO_TCP,port_id,client_mode,cfg->serverWebClientIP,rt_info->wan6_ifname,
(0==has_fw6_restart++)?1:0);
}
if(FLAG_DMN_RESTART & gWebCtrl.dmn_ctrl[i].flag)
{
gWebCtrl.dmn_ctrl[i].retry_cnt=MAX_DAEMON_RETRY_NUM;
if(DAEMON_STATUS_OFF!=gWebCtrl.dmn_ctrl[i].status)
{
WEB_DBG("Daemon is running,add one retry count...\n");
gWebCtrl.dmn_ctrl[i].retry_cnt+=1;
}
daemon_restart(&gWebCtrl.dmn_ctrl[i]);
has_restart++;
}
gWebCtrl.dmn_ctrl[i].flag&=~(FLAG_FW4_RESTART|FLAG_FW6_RESTART|FLAG_DMN_RESTART);
}
}
if(has_restart)
{
web_dump(DUMP_ALL,"After daemon restart");
}
}
return ICOS_SUCCESS;
}
先從外層來看
if(gWebCtrl.mod_init_done)
{
for(i=0; MAX_DAEMON_NUM>i; i++)
{
if(gWebCtrl.dmn_ctrl[i].flag)
{
...
}
}
...
}
gWebCtrl.mod_init_done
這個值唯一會被寫成 1 的地方只有一處
switch(pevent->event_id)
{
case ICOS_UCAST_MODULE_APPLY:
if(pevent->msg_len==sizeof(sWebConfig))
{
if(0==gWebCtrl.mod_init_done)
{
...
gWebCtrl.mod_init_done=1;
}
else
{
...
}
}
break;
...
}
再 review mod_init_done
的 comment
unsigned char mod_init_done; //icosconfig bootinit -> icoslib -> icospromsg
//Process icosconfig call lib icoslib and then pass message to another process icospromsg
//module init done means process icospromsg recevied icoslib message and init done.
//The purpose is prevent handle recevied notify message in notify_ddns before init done.
所以 notify_web() 的 switch case 後還有一部分的 code 用白話文來看外層的話是這樣
if( process icospromsg recevied icoslib message and init done )
{
for(i=0; MAX_DAEMON_NUM>i; i++)
{
if(gWebCtrl.dmn_ctrl[i].flag)
{
...
}
}
...
}
那 gWebCtrl.dmn_ctrl[i].flag
呢
稍微整理一下可以發現 處理 event 的 switch case 就是在設定正確的 flag
switch(pevent->event_id)
{
case ICOS_UCAST_MODULE_APPLY:
gWebCtrl.dmn_ctrl[i].flag=0; // in web_init()
gWebCtrl.dmn_ctrl[i].flag=FLAG_DMN_RESTART; // in web_change()
break;
case ICOS_UCAST_MODULE_EXIT:
break;
case ICOS_BOOTINIT_DONE:
gWebCtrl.dmn_ctrl[i].flag=FLAG_DMN_RESTART;
break;
case ICOS_WAN_GATEWAY_UPDATE:
case ICOS_WAN_IP_UPDATE:
gWebCtrl.dmn_ctrl[i].flag=FLAG_FW4_RESTART;
break;
case ICOS_WAN6_GATEWAY_UPDATE:
case ICOS_WAN6_IP_UPDATE:
gWebCtrl.dmn_ctrl[i].flag=FLAG_FW6_RESTART;
break;
case ICOS_WAN_LOST_CONNECTION:
gWebCtrl.dmn_ctrl[i].flag=FLAG_FW4_RESTART;
break;
case ICOS_WAN6_LOST_CONNECTION:
gWebCtrl.dmn_ctrl[i].flag=FLAG_FW6_RESTART;
break;
case ICOS_SYSTEM_UPDATE:
case ICOS_UCAST_DMN_RESTART:
gWebCtrl.dmn_ctrl[i].flag = FLAG_DMN_RESTART;
break;
default:
break;
}
然後後面那一部分就是看著 flag 在做事
if(gWebCtrl.dmn_ctrl[i].flag)
{
if((FLAG_DMN_RESTART|FLAG_FW4_RESTART)&gWebCtrl.dmn_ctrl[i].flag)
{
...
}
if((FLAG_DMN_RESTART|FLAG_FW6_RESTART)&gWebCtrl.dmn_ctrl[i].flag)
{
...
}
if(FLAG_DMN_RESTART & gWebCtrl.dmn_ctrl[i].flag)
{
...
}
}
繼續看 log 吧
1536650391[20180911 7:19:51] [notify_web:862]IN(E82|S44|D44)
1536650391[20180911 7:19:51] [notify_web:871]module init
switch(pevent->event_id)
{
case ICOS_UCAST_MODULE_APPLY:
WEB_INFO("module init\n");
web_init((sWebConfig *)pevent->msg);
break;
}
1536650397[20180911 7:19:57] [notify_web:862]IN(E73|S60|D00)
1536650406[20180911 7:20:6] [notify_web:862]IN(E77|S87|D00)
- ICOS_COM_UPDATE(73)
- ICOS_GRE_MODE_OFF(77)
這些都會走 switch 的 default case - 就是不處理的意思
switch(pevent->event_id)
{
...
default:
break;
}
再來的 log 就是一整串連續的了
1536650409[20180911 7:20:9] [notify_web:862]IN(E72|S00|D00)
1536650409[20180911 7:20:9] [notify_web:896]boot init done
1536650409[20180911 7:20:9] [web_dump:516]===init config===
1536650409[20180911 7:20:9] [web_dump:526][COM]conn_mgr=1,mod_init_done:1.
1536650409[20180911 7:20:9] [web_dump:554][CFG]mode=both,httpd_port=80,https_port=443,refreshperiod=2,sport=80,intf=lan,secure=all,clienip=0.0.0.0,httpd_access=lan,https_access=lan
1536650409[20180911 7:20:9] [web_dump:562][DMN0]active=1,pid=-1,status=0,flag=0x0,DID0
1536650409[20180911 7:20:9] [web_dump:562][DMN1]active=1,pid=-1,status=0,flag=0x0,DID1
1536650409[20180911 7:20:9] [web_dump:567][RTI]wan4_ifname=,wan6_ifname=.
1536650409[20180911 7:20:9] [notify_web:1039]ipt_mgmt_rule_set[4]: iface_sel=3, wan4_ifname=
1536650409[20180911 7:20:9] [daemon_restart:706][DID0] remain IP server retry for 6 times.
1536650409[20180911 7:20:9] [create_daemon_conf:605]IN
1536650409[20180911 7:20:9] [create_daemon_conf:616]cmd_buf=>dir=/
1536650409[20180911 7:20:9] [create_daemon_conf:621]cmd_buf=>cgipat=cgi-bin/**
1536650409[20180911 7:20:9] [create_daemon_conf:626]cmd_buf=>chroot
1536650409[20180911 7:20:9] [create_daemon_conf:631]cmd_buf=>user=root
1536650409[20180911 7:20:9] [create_daemon_conf:636]cmd_buf=>max_age=0
1536650409[20180911 7:20:9] [create_daemon_conf:641]cmd_buf=>debug
1536650409[20180911 7:20:9] [daemon_restart:748][DMN]Lanch=>/usr/sbin/iweb -p 80 -d /www
1536650409[20180911 7:20:9] [notify_web:1039]ipt_mgmt_rule_set[4]: iface_sel=1, wan4_ifname=
1536650409[20180911 7:20:9] [daemon_restart:706][DID1] remain IP server retry for 6 times.
1536650409[20180911 7:20:9] [gen_key_files:578]IN
1536650409[20180911 7:20:9] [gen_key_files:590]iweb genkey pid = 2198
1536650409[20180911 7:20:9] [gen_key_files:593]OUT
1536650409[20180911 7:20:9] [is_request_start:688][DMN]disabled cause key not ready.
1536650409[20180911 7:20:9] [web_dump:562][DMN0]active=1,pid=2195,status=1,flag=0x0,DID0
1536650409[20180911 7:20:9] [web_dump:562][DMN1]active=1,pid=-1,status=0,flag=0x1,DID1
1536650409[20180911 7:20:9] [web_dump:516]===After daemon restart===
1536650409[20180911 7:20:9] [web_dump:526][COM]conn_mgr=1,mod_init_done:1.
1536650409[20180911 7:20:9] [web_dump:554][CFG]mode=both,httpd_port=80,https_port=443,refreshperiod=2,sport=80,intf=lan,secure=all,clienip=0.0.0.0,httpd_access=lan,https_access=lan
1536650409[20180911 7:20:9] [web_dump:562][DMN0]active=1,pid=2195,status=1,flag=0x0,DID0
1536650409[20180911 7:20:9] [web_dump:562][DMN1]active=1,pid=-1,status=0,flag=0x0,DID1
1536650409[20180911 7:20:9] [web_dump:567][RTI]wan4_ifname=,wan6_ifname=.
switch(pevent->event_id)
{
case ICOS_BOOTINIT_DONE:
WEB_INFO("boot init done\n");
web_dump(DUMP_ALL,"init config");
for(i=0; MAX_DAEMON_NUM>i; i++)
{
gWebCtrl.dmn_ctrl[i].flag=FLAG_DMN_RESTART;
}
break;
}
if(gWebCtrl.mod_init_done)
{
for(i=0; MAX_DAEMON_NUM>i; i++)
{
if(gWebCtrl.dmn_ctrl[i].flag)
{
if((FLAG_DMN_RESTART|FLAG_FW4_RESTART)&gWebCtrl.dmn_ctrl[i].flag)
{
WEB_DBG("ipt_mgmt_rule_set[4]: iface_sel=%d, wan4_ifname=%s\n", iface_sel, rt_info->wan4_ifname);
}
...
if(FLAG_DMN_RESTART & gWebCtrl.dmn_ctrl[i].flag)
{
daemon_restart(&gWebCtrl.dmn_ctrl[i]);
}
}
}
}
觸發的兩次 daemon_restart()
for(i=0; MAX_DAEMON_NUM>i; i++)
{
daemon_restart(&gWebCtrl.dmn_ctrl[i]);
}
對應倒的 log 如下
daemon_restart(&gWebCtrl.dmn_ctrl[0])
1536650409[20180911 7:20:9] [daemon_restart:706][DID0] remain IP server retry for 6 times.
1536650409[20180911 7:20:9] [create_daemon_conf:605]IN
1536650409[20180911 7:20:9] [create_daemon_conf:616]cmd_buf=>dir=/
1536650409[20180911 7:20:9] [create_daemon_conf:621]cmd_buf=>cgipat=cgi-bin/**
1536650409[20180911 7:20:9] [create_daemon_conf:626]cmd_buf=>chroot
1536650409[20180911 7:20:9] [create_daemon_conf:631]cmd_buf=>user=root
1536650409[20180911 7:20:9] [create_daemon_conf:636]cmd_buf=>max_age=0
1536650409[20180911 7:20:9] [create_daemon_conf:641]cmd_buf=>debug
1536650409[20180911 7:20:9] [daemon_restart:748][DMN]Lanch=>/usr/sbin/iweb -p 80 -d /www
daemon_restart(&gWebCtrl.dmn_ctrl[1])
1536650409[20180911 7:20:9] [daemon_restart:706][DID1] remain IP server retry for 6 times.
1536650409[20180911 7:20:9] [gen_key_files:578]IN
1536650409[20180911 7:20:9] [gen_key_files:590]iweb genkey pid = 2198
1536650409[20180911 7:20:9] [gen_key_files:593]OUT
1536650409[20180911 7:20:9] [is_request_start:688][DMN]disabled cause key not ready.