20180907_jeffrey - silenceuncrio/diary GitHub Wiki

0910

昨天的修改

diff --git a/proscend/mconfig/lxdialog/lxdialog b/proscend/mconfig/lxdialog/lxdialog
index 91dcca2..405bfea 100755
Binary files a/proscend/mconfig/lxdialog/lxdialog and b/proscend/mconfig/lxdialog/lxdialog differ
diff --git a/proscend/prosrc/icos/iweb/iweb.c b/proscend/prosrc/icos/iweb/iweb.c
index e6606d7..3914f8b 100644
--- a/proscend/prosrc/icos/iweb/iweb.c
+++ b/proscend/prosrc/icos/iweb/iweb.c
@@ -106,7 +106,7 @@ static struct session *get_session(struct http_message *hm)
     {
         if (s_sessions[i].id == sid)
         {
-            s_sessions[i].last_used = mg_time();
+            s_sessions[i].last_used = (double)SysGetUpTime();
             _save_session();
             return &s_sessions[i];
         }
@@ -153,7 +153,7 @@ void check_sessions(void)
         return;
     }

-    double threshold = mg_time() - Icos_user_root.session_ttl;
+    double threshold = (double)SysGetUpTime() - Icos_user_root.session_ttl;
     for (int i = 0; i < NUM_SESSIONS; i++)
     {
         struct session *s = &s_sessions[i];
@@ -198,7 +198,7 @@ static struct session *create_session(const char *user, const struct http_messag
     }

     /* Initialize new session. */
-    s->created = s->last_used = mg_time();
+    s->created = s->last_used = (double)SysGetUpTime();
     snprintf(s->user, sizeof(s->user), "%s", user);
     s->lucky_number = rand();

@@ -264,7 +264,7 @@ static void _handler_noauth(struct mg_connection *nc, int ev, void *ev_data)
         case MG_EV_TIMER:
             /* Perform session maintenance. */
             check_sessions();
-            mg_set_timer(nc, mg_time() + SESSION_CHECK_INTERVAL);
+            mg_set_timer(nc, (double)SysGetUpTime() + SESSION_CHECK_INTERVAL);
             break;
     }
 }
@@ -962,7 +962,7 @@ int main(int argc, char *argv[])
                s_http_port, s_http_server_opts.document_root);
     }

-    mg_set_timer(nc, mg_time() + SESSION_CHECK_INTERVAL);
+    mg_set_timer(nc, (double)SysGetUpTime() + SESSION_CHECK_INTERVAL);


     for (;;)

應該是 mg_set_timer() 也用了 (double)SysGetUpTime() 取代 mg_time() 的關係

-    mg_set_timer(nc, mg_time() + SESSION_CHECK_INTERVAL);
+    mg_set_timer(nc, (double)SysGetUpTime() + SESSION_CHECK_INTERVAL);

導致 mg_set_timer() 沒有在預期的時間發送 MG_EV_TIMER event

再修一次 proscend/prosrc/icos/iweb/iweb.c

@@ -106,7 +106,7 @@ static struct session *get_session(struct http_message *hm)
     {
         if (s_sessions[i].id == sid)
         {
-            s_sessions[i].last_used = mg_time();
+            s_sessions[i].last_used = (double)SysGetUpTime();
             _save_session();
             return &s_sessions[i];
         }
@@ -153,7 +153,7 @@ void check_sessions(void)
         return;
     }

-    double threshold = mg_time() - Icos_user_root.session_ttl;
+    double threshold = (double)SysGetUpTime() - Icos_user_root.session_ttl;
     for (int i = 0; i < NUM_SESSIONS; i++)
     {
         struct session *s = &s_sessions[i];
@@ -198,7 +198,7 @@ static struct session *create_session(const char *user, const struct http_messag
     }

     /* Initialize new session. */
-    s->created = s->last_used = mg_time();
+    s->created = s->last_used = (double)SysGetUpTime();
     snprintf(s->user, sizeof(s->user), "%s", user);
     s->lucky_number = rand();

root@M360-P:~# tail -f /home/log/web.log
Icos_user_root.user: root
Icos_user_root.pass: $1$$2Dg0uARUa9gcTJ9I5/iKb/
Starting SSL iweb on port 443, cert from /tmp/icos/web/iweb_cert.pem, key from /tmp/icos/web/iweb_key.pem, serving /www
-->
1536228758[20180906 10:12:38] [notify_web:858]IN(E01|S56|D00)
1536228763[20180906 10:12:43] [notify_web:858]IN(E20|S55|D00)
1536228764[20180906 10:12:44] [notify_web:858]IN(E51|S55|D00)
1536228764[20180906 10:12:44] [notify_web:908]Ignore due to conn_mgr is on.
1536228765[20180906 10:12:45] [notify_web:858]IN(E51|S58|D00)
1536228765[20180906 10:12:45] [notify_web:908]Ignore due to conn_mgr is on.
1536228767[20180906 10:12:47] [notify_web:858]IN(E57|S56|D00)
1536228767[20180906 10:12:47] [notify_web:911]WAN IP UPDATE
1536228767[20180906 10:12:47] [notify_web:1035]ipt_mgmt_rule_set[4]: iface_sel=3, wan4_ifname=eth1
1536228767[20180906 10:12:47] [notify_web:1035]ipt_mgmt_rule_set[4]: iface_sel=1, wan4_ifname=eth1
1536228771[20180906 10:12:51] [notify_web:858]IN(E60|S07|D00)
1536228773[20180906 10:12:53] [notify_web:858]IN(E54|S54|D00)
1536228773[20180906 10:12:53] [notify_web:934]Ignore due to conn_mgr is on.
1536228775[20180906 10:12:55] [notify_web:858]IN(E58|S56|D00)
1536228775[20180906 10:12:55] [notify_web:937]WAN6 IP UPDATE
1536228778[20180906 10:12:58] [notify_web:858]IN(E53|S50|D00)
1536283791[20180907 1:29:51] [msgcb_web:1205]IN(DID0,pid 3556)
<--
_handler_auth: /cgi-bin/dns.cgi
sid: 1032224869
root logged in, sid 10caa8a73d868065
-->
1536283799[20180907 1:29:59] [msgcb_web:1205]IN(DID0,pid 3556)
<--
_handler_auth: /cgi-bin/syslog.cgi
sid: 1032224869
root logged in, sid 10caa8a73d868065
-->
1536283799[20180907 1:29:59] [msgcb_web:1205]IN(DID0,pid 3556)
<--
_handler_auth: /cgi-bin/syslog.cgi
sid: 1032224869
root logged in, sid 10caa8a73d868065
-->

注意到以下的時間躍進

...
1536228778[20180906 10:12:58] [notify_web:858]IN(E53|S50|D00)
1536283791[20180907 1:29:51] [msgcb_web:1205]IN(DID0,pid 3556)
...

該時間點後續對需要 authentication 的 CGI 的存取並沒有再觸發 login

等個五分鐘觀察正常的 session timeout 有沒有啟動

root@M360-P:~# tail -f /home/log/web.log
_handler_auth: /cgi-bin/syslog.cgi
sid: 1032224869
root logged in, sid 10caa8a73d868065
-->
1536283799[20180907 1:29:59] [msgcb_web:1205]IN(DID0,pid 3556)
<--
_handler_auth: /cgi-bin/syslog.cgi
sid: 1032224869
root logged in, sid 10caa8a73d868065
-->
1536284100[20180907 1:35:0] [msgcb_web:1205]IN(DID0,pid 3556)
<--
Session 10caa8a73d868065 (root) closed due to idleness.
-->

成功了

可以上 code 囉

commit befee85512ab4607c71e0d96fab4d4210502c5dd
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 09:48:18 2018 +0800

    use SysGetUpTime() instead of mg_time() except within mg_set_timer():

    if you login via web ui before sntp client get the time,
    after sntp client get the time, your web session will timeout immediately.

    Because the difference between the lasted login timestamp and the current timestamp exceeds our threshhold.

    So we use SysGetUpTime() to get rid of impact of the time updating.

    We can not use SysGetUpTime() within mg_set_timer(), or mg_set_timer() will not trigger MG_EV_TIMER event in the correct time

 proscend/prosrc/icos/iweb/iweb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

再多測一下

確認沒問題就可以套到 M300 去

1115

web ui 有新的工作

  • System / Ethernet Ports
  • LAN / VLAN

先參考一下 john 寫的 wiki

由於 M360 只有一個 lan port

我想就從 CGI 來重構一下好了

switch.cgi?act=config 開始看

chrome 拿到該 API 的 response 目前如下

image

對應的 source code

static json_object * _get_config()
{
    int res = ICOS_GetSetting(MODULE_SWITCH, 0, 0, &SwitchConfig, sizeof(SwitchConfig));
    if (res != ICOS_SUCCESS)
    {
        jweb.http.status(500);
        jweb.out.json.fail("ICOS_GetSetting fail");
    }

    json_object *mediaMode = json_object_new_array();
    for (int i = 0; i < SWITCH_PORT_NUM; i ++)
    {
        json_object_array_add(mediaMode, json_object_new_int(SwitchConfig.mediaMode[i]));
    }

    json_object *config = json_object_new_object();
    json_object_object_add(config, "mediaMode", mediaMode);

    return config;
}



static void _config()
{
    json_object *config = _get_config();
    jweb.out.json.data("config", config);
}

john 的 wiki 指出 lan port 為 mediaMode[1]

因應這個來修改 CGI

@@ -63,14 +63,8 @@ static json_object * _get_config()
         jweb.out.json.fail("ICOS_GetSetting fail");
     }

-    json_object *mediaMode = json_object_new_array();
-    for (int i = 0; i < SWITCH_PORT_NUM; i ++)
-    {
-        json_object_array_add(mediaMode, json_object_new_int(SwitchConfig.mediaMode[i]));
-    }
-
     json_object *config = json_object_new_object();
-    json_object_object_add(config, "mediaMode", mediaMode);
+    json_object_object_add(config, "mediaMode", json_object_new_int(SwitchConfig.mediaMode[1]));

     return config;
 }

效果

image

commit 但不 push

commit 247a6fee6dffd634b26d2ad14ef73d8cf8c2ee90
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 11:55:04 2018 +0800

    re-design 'System / Ethernet Ports':
    - modify `switch.cgi?act=config`: use only lan port

 proscend/prosrc/webcgi/switch.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

1300

再來是 switch.cgi?act=config 開始看

image

修改 CGI

@@ -111,14 +111,8 @@ static json_object * _get_status()
         jweb.out.json.fail("ICOS_GetSetting fail");
     }

-    json_object *mediaMode = json_object_new_array();
-    for (int i = 0; i < SWITCH_PORT_NUM; i ++)
-    {
-        json_object_array_add(mediaMode, json_object_new_int(SwitchStatus.mediaStatus[i]));
-    }
-
     json_object *config = json_object_new_object();
-    json_object_object_add(config, "mediaMode", mediaMode);
+    json_object_object_add(config, "mediaMode", json_object_new_int(SwitchStatus.mediaStatus[1]));

     return config;
 }

效果

image

commit

commit 5b2e04187e5d2fef5c7424a1eb985b310ee590b0
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 13:07:13 2018 +0800

    re-design 'System / Ethernet Ports':
    - modify `switch.cgi?act=`status: use only lan port

 proscend/prosrc/webcgi/switch.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

1315

CGI 的 apply 也要修一下

@@ -27,14 +27,7 @@ static void _apply()
         jweb.out.json.fail("ICOS_GetSetting fail");
     }

-    json_object *mediaMode;
-    jweb.in.to_raw("mediaMode", &mediaMode);
-
-    for (int i = 0; i < SWITCH_PORT_NUM; i ++)
-    {
-        json_object *obj = json_object_array_get_idx(mediaMode, i);
-        SwitchConfig.mediaMode[i] = json_object_get_int(obj);
-    }
+    jweb.in.to_int("mode", &SwitchConfig.mediaMode[1]);

     res = ICOS_Apply(MODULE_SWITCH, 0, 0, &SwitchConfig, sizeof(SwitchConfig));

commit

commit 48c7d1e43ed1a82574dfbec85472c238b14aee39
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 13:18:39 2018 +0800

    re-design 'System / Ethernet Ports':
    - modify `switch.cgi?act=apply`: use only lan port

 proscend/prosrc/webcgi/switch.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

可以先修一下 web

+++ b/proscend/prosrc/www/app/feature/switch.js

@@ -20,11 +20,6 @@
               return result.data.config;
             });
           },
-          total_ports: function(icos) {
-            return icos._switch.total_ports().then(function(result) {
-              return result.data.total_ports;
-            });
-          },
           status: function(icos) {
             return icos._switch.status().then(function(result) {
               return result.data.status;
@@ -53,7 +48,7 @@
     }
   }

-  function switchController($route, $location, $timeout, $scope, icos, config, total_ports, status) {
+  function switchController($route, $location, $timeout, $scope, icos, config, status) {^M
     var vm = this;

     vm.status_mediaMode_to_string = status_mediaMode_to_string;
@@ -63,9 +58,6 @@

     vm.config_previous = angular.copy(vm.config);

-    vm.total_ports = total_ports;
-    //vm.total_ports = 4; // manual test
-
     vm.reset = function() {
       $route.reload();
     }

total_ports 的 information 已經不需要了

commit 1443d9e2e58ad3fcdee674c7c7ba91ae43bff661
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 13:21:28 2018 +0800

    re-design 'System / Ethernet Ports':
    - 'total_ports' information is not needed any more

 proscend/prosrc/www/app/feature/switch.js | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

先改 status 部分的網頁

diff --git a/proscend/prosrc/www/app/feature/switch.html b/proscend/prosrc/www/app/feature/switch.html
index 3ab7628..d495fca 100644
--- a/proscend/prosrc/www/app/feature/switch.html
+++ b/proscend/prosrc/www/app/feature/switch.html
@@ -18,38 +18,10 @@
   <fieldset>
   <legend>{{ 'SWITCH_LEGEND_STATUS' | translate }}</legend>

-  <div class="form-group" ng-show="vm.total_ports == 4">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN_1' | translate }}</label>
-    <div class="col-sm-9">
-      <p class="form-control-static">{{ vm.status_mediaMode_to_string(vm.status.mediaMode[1]) }}</p>
-    </div>
-  </div>
-
-  <div class="form-group" ng-show="vm.total_ports == 4">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN_2' | translate }}</label>
-    <div class="col-sm-9">
-      <p class="form-control-static">{{ vm.status_mediaMode_to_string(vm.status.mediaMode[2]) }}</p>
-    </div>
-  </div>
-
-  <div class="form-group" ng-show="vm.total_ports == 4">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN_3' | translate }}</label>
-    <div class="col-sm-9">
-      <p class="form-control-static">{{ vm.status_mediaMode_to_string(vm.status.mediaMode[3]) }}</p>
-    </div>
-  </div>
-
-  <div class="form-group" ng-show="vm.total_ports == 2">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN' | translate }}</label>
-    <div class="col-sm-9">
-      <p class="form-control-static">{{ vm.status_mediaMode_to_string(vm.status.mediaMode[1]) }}</p>
-    </div>
-  </div>
-
   <div class="form-group">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_WAN' | translate }}</label>
+    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN' | translate }}</label>^M
     <div class="col-sm-9">
-      <p class="form-control-static">{{ vm.status_mediaMode_to_string(vm.status.mediaMode[0]) }}</p>
+      <p class="form-control-static">{{ vm.status_mediaMode_to_string(vm.status.mediaMode) }}</p>^M
     </div>
   </div>

diff --git a/proscend/prosrc/www/app/feature/switch.js b/proscend/prosrc/www/app/feature/switch.js
index 220016b..bb835c2 100644
--- a/proscend/prosrc/www/app/feature/switch.js
+++ b/proscend/prosrc/www/app/feature/switch.js
@@ -44,6 +44,8 @@
       case 3: return  "10M Full";
       case 4: return  "10M Half";
       case 5: return  "Disable";
+      case 6: return  "1000M Full";^M
+      case 7: return  "1000M Half";^M
       default: return "NA";
     }
   }

image

不過怎麼是 off 呢

john 表示應該需要再 pull 一下 code

這待會再作

我繼續作 config 的部分

commit 先

commit 4d147df1e39b96c10d1a6eafc0e4a08c811e3087
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 13:40:08 2018 +0800

    re-design 'System / Ethernet Ports':
    - status

 proscend/prosrc/www/app/feature/switch.html | 32 ++---------------------------
 proscend/prosrc/www/app/feature/switch.js   |  2 ++
 2 files changed, 4 insertions(+), 30 deletions(-)

config 的部分只需要動到 html

diff --git a/proscend/prosrc/www/app/feature/switch.html b/proscend/prosrc/www/app/feature/switch.html
index d495fca..1645d2f 100644
--- a/proscend/prosrc/www/app/feature/switch.html
+++ b/proscend/prosrc/www/app/feature/switch.html
@@ -32,63 +32,17 @@
   <fieldset>
   <legend>{{ 'SWITCH_LEGEND_CONFIGURATIONS' | translate }}</legend>

-  <div class="form-group" ng-show="vm.total_ports == 4">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN_1' | translate }}</label>
-    <div class="col-sm-9">
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="0">Auto</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="1">100M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="2">100M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="3">10M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="4">10M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="5">Disable</label>
-    </div>
-  </div>
-
-  <div class="form-group" ng-show="vm.total_ports == 4">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN_2' | translate }}</label>
-    <div class="col-sm-9">
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[2]" ng-value="0">Auto</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[2]" ng-value="1">100M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[2]" ng-value="2">100M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[2]" ng-value="3">10M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[2]" ng-value="4">10M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[2]" ng-value="5">Disable</label>
-    </div>
-  </div>
-
-  <div class="form-group" ng-show="vm.total_ports == 4">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN_3' | translate }}</label>
-    <div class="col-sm-9">
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[3]" ng-value="0">Auto</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[3]" ng-value="1">100M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[3]" ng-value="2">100M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[3]" ng-value="3">10M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[3]" ng-value="4">10M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[3]" ng-value="5">Disable</label>
-    </div>
-  </div>
-
   <div class="form-group">
     <label class="col-sm-3 control-label">{{ 'SWITCH_LAN' | translate }}</label>
     <div class="col-sm-9">
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="0">Auto</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="1">100M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="2">100M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="3">10M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="4">10M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[1]" ng-value="5">Disable</label>
-    </div>
-  </div>
-
-  <div class="form-group">
-    <label class="col-sm-3 control-label">{{ 'SWITCH_WAN' | translate }}</label>
-    <div class="col-sm-9">
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[0]" ng-value="0">Auto</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[0]" ng-value="1">100M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[0]" ng-value="2">100M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[0]" ng-value="3">10M Full</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[0]" ng-value="4">10M Half</label>
-<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode[0]" ng-value="5">Disable</label>
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="0">Auto</label>^M
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="1">100M Full</label>^M
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="2">100M Half</label>^M
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="3">10M Full</label>^M
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="4">10M Half</label>^M
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="5">Disable</label>^M
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="6">100M Full</label>^M
+<label class="radio-inline"><input type="radio" ng-model="vm.config.mediaMode" ng-value="7">100M Half</label>^M
     </div>
   </div>

網頁

image

不過用 radio 的話一行已經不夠放了

改成 select option

image

commit 63f04d4975d22c059ed39d6430da3156d4d84e2a
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 13:57:31 2018 +0800

    re-design 'System / Ethernet Ports':
    - configuration

 proscend/prosrc/webcgi/switch.c             |   2 +-
 proscend/prosrc/www/app/feature/switch.html | 191 +++++++++++-----------------
 2 files changed, 75 insertions(+), 118 deletions(-)

push code 吧

順便 build 一版來測

image

LAN 設定成 10M Full 後沒多久 status 就顯示出正確狀態了

1415

來作 flow control 的部分

CGI - proscend/prosrc/webcgi/switch.c

@@ -28,6 +28,7 @@ static void _apply()
     }

     jweb.in.to_int("mediaMode", &SwitchConfig.mediaMode[1]);
+    jweb.in.to_int("flow_ctrl", &SwitchConfig.flow_ctrl[1]);

     res = ICOS_Apply(MODULE_SWITCH, 0, 0, &SwitchConfig, sizeof(SwitchConfig));

@@ -58,6 +59,7 @@ static json_object * _get_config()

     json_object *config = json_object_new_object();
     json_object_object_add(config, "mediaMode", json_object_new_int(SwitchConfig.mediaMode[1]));
+    json_object_object_add(config, "flow_ctrl", json_object_new_int(SwitchConfig.flow_ctrl[1]));

     return config;
 }

html - proscend/prosrc/www/app/feature/switch.html

@@ -53,6 +53,23 @@



+  <fieldset>
+  <legend>{{ 'SWITCH_LEGEND_FLOW_CTRL' | translate }}</legend>
+
+  <div class="form-group">
+    <label class="col-sm-3 control-label">{{ 'SWITCH_LAN' | translate }}</label>
+    <div class="col-sm-9">
+      <label class="radio-inline">
+        <input type="radio" ng-model="vm.config.flow_ctrl" ng-value="0">{{ 'OFF' | translate }}</label>
+      <label class="radio-inline">
+        <input type="radio" ng-model="vm.config.flow_ctrl" ng-value="1">{{ 'ON' | translate }}</label>
+    </div>
+  </div>
+
+  </fieldset>
+
+
+
 </form>

   </div>

網頁

image

上 code

commit 27c82963c9fa29f08297ea88a6d7b93b76e4faa5
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 14:34:30 2018 +0800

    re-design 'System / Ethernet Ports':
    - flow control

 proscend/prosrc/webcgi/switch.c             |  2 ++
 proscend/prosrc/www/app/feature/switch.html | 17 +++++++++++++++++
 proscend/prosrc/www/app/locale-en.json      |  1 +
 proscend/prosrc/www/app/locale-fr.json      |  1 +
 proscend/prosrc/www/app/locale-zh-tw.json   |  1 +
 5 files changed, 22 insertions(+)

john 的 wiki 還有寫著 CRC error

不過早上開會決定還要再改變 api

這邊先 hold 一下

1440

來看一下 vlan 的部分

目前沒有任何內容

image

那是因為 mode 欄位被隱藏的關係

而且因為目前的 mode 是 off 所以連 configuration 部分也被隱藏了

proscend/prosrc/www/app/feature/vlan.html

@@ -12,7 +12,7 @@



-  <div class="form-group" ng-show="false">
+  <div class="form-group">
     <label class="col-sm-3 control-label">{{ 'VLAN_MODE' | translate }}</label>
     <div class="col-sm-9">
       <label class="radio-inline">

vlan - mode: off image

vlan - mode: tag base image

commit 先

commit e16477a1516c1e23ab6a70f08256143dfef8d8d2
Refs: [develop]
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 14:46:48 2018 +0800

    re-design 'LAN / VLAN':
    - display the 'Mode' field

 proscend/prosrc/www/app/feature/vlan.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

第二組的 subnet 也要可選 proscend/prosrc/www/app/feature/vlan.html

@@ -133,7 +133,7 @@

       <select class="form-control" ng-model="e.subnet_id"
         ng-options="x.val as x.label for x in vm.help.subnet_id_options[$index]"
-        ng-disabled="($index == 0) || ($index == 1)"
+        ng-disabled="$index == 0"
       ></select>

     </td>

上 code

commit fe50555da3f69b73e61141f3103691c3098e38fa
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 15:24:50 2018 +0800

    re-design 'LAN / VLAN':
    - user can select the subnet of #2 entry

 proscend/prosrc/www/app/feature/vlan.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

1530

john 表示還要 sync m300 的 time server

image

參考 M300 當次的 commit 紀錄再作一次吧

image

上 code

commit b847e742a6637118e33924179cf81a8b10b7e094
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 15:42:13 2018 +0800

    add 'Timer Server' field at 'System / Time and Date' web page

 proscend/prosrc/webcgi/sntp.c                    |  6 +++++-
 proscend/prosrc/www/app/feature/timeAndDate.html | 27 ++++++++++++++++++++++++
 proscend/prosrc/www/app/locale-en.json           |  3 +++
 proscend/prosrc/www/app/locale-fr.json           |  3 +++
 proscend/prosrc/www/app/locale-zh-tw.json        |  3 +++
 5 files changed, 41 insertions(+), 1 deletion(-)

1600

寫週報

1700

john 的 crc errors api 已經做好了

幫忙加到 web ui

image

上 code

commit 31f9dffb27e21ec5375d9a3914321d4e7adb41c0
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Fri Sep 7 16:59:45 2018 +0800

    add 'Rx CRC Errors' attribute at 'System / Ethernet Ports' web page

 proscend/prosrc/webcgi/switch.c             | 1 +
 proscend/prosrc/www/app/feature/switch.html | 7 +++++++
 proscend/prosrc/www/app/locale-en.json      | 1 +
 proscend/prosrc/www/app/locale-fr.json      | 1 +
 proscend/prosrc/www/app/locale-zh-tw.json   | 1 +
 5 files changed, 11 insertions(+)
⚠️ **GitHub.com Fallback** ⚠️