20190717_jeffrey - silenceuncrio/diary GitHub Wiki

0905

整理一下目前的進度

  • M300
    • survey - Layer 2 Encapsulation over GRE (L2oGRE)
    • develop - wanst.apply() need the information about the dns_static.apply()
    • develop - offer CGI for batch upload used by openvpn
  • M330
    • develop - add 'LTE > USSD' web page
    • develop - wanst.apply() need the information about the dns_static.apply()

負責的 task

  • M300 - Multiple upload files through web
    • 100%
  • M330 - USSD Web UI
    • 100%
  • M360P - DDNS
    • 0%

被指派但 priority 較低

  • M300 - Layer 2 Encapsulation over GRE (L2oGRE)
  • M330 - Wizard
    • 等待 WAN WiFi 完成後再規劃 Wizard 流程

0925

完全忘了 M360P - DDNS 這件事要做些什麼

接一台 M360P 起來看 Web UI

john 表示直接抄最新的 M330 的 DDNS 即可

依據 PROSRC_DDNSD 這個 compiler option

先 review M330 與 M360P 的 CGI

基本上從 M330 複製 ddns.c 即可


複製完的 git diff 如下

diff --git a/proscend/prosrc/webcgi/ddns.c b/proscend/prosrc/webcgi/ddns.c
index 08e042d..dd40c9b 100644
--- a/proscend/prosrc/webcgi/ddns.c
+++ b/proscend/prosrc/webcgi/ddns.c
@@ -32,6 +32,7 @@ static void _apply()
     jweb.in.to_nstring("password", &Ddns.password, STRING64_SIZE);
     jweb.in.to_int("updated_period", &Ddns.updated_period);
     jweb.in.to_nstring("planet_easy_hostname", &Ddns.planet_easy_hostname, STRING256_SIZE);
+    jweb.in.to_int("ipPolicy", &Ddns.ipPolicy);

     res = ICOS_Apply(MODULE_DDNS, 0, 0, &Ddns, sizeof(Ddns));
     if (res != ICOS_SUCCESS)
@@ -62,6 +63,7 @@ static json_object * _config_obj()
     json_object_object_add(obj, "password", json_object_new_string(Ddns.password));
     json_object_object_add(obj, "updated_period", json_object_new_int(Ddns.updated_period));
     json_object_object_add(obj, "planet_easy_hostname", json_object_new_string(Ddns.planet_easy_hostname));
+    json_object_object_add(obj, "ipPolicy", json_object_new_int(Ddns.ipPolicy));
     return obj;
 }

@@ -115,17 +117,17 @@ int main(void)
 {
     jweb.cgi.init();

-    if        (STRCMP(jweb.in.act, "config"))
+    if      (STRCMP(jweb.in.act, "config"))
     {
-        _config();
+        jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _config);
     }
     else if (STRCMP(jweb.in.act, "apply"))
     {
-        _apply();
+        jweb.access.filter(ATTVAL_SYSTEM_LEVEL2, _apply);
     }
     else if (STRCMP(jweb.in.act, "help"))
     {
-        _help();
+        jweb.access.filter(ATTVAL_SYSTEM_LEVEL1, _help);
     }
     else
     {

build 個 image 試試

M360P - develop

  • Products/Vendor = M360P/4_HYTEC_WIFI

透過 uboot upgrade sysupgrade.bin 後記得透過長按 reset button 來做 factory default

否則會被原本 PI 版本的登入帳密影響

左側選單已出現 Service > Dynamic DNS

參考 M330 的 commit - add 'IP Address Selection' field at 'Dynamic DNS' web page

再 build 一次 image 來驗證


驗證無誤

commit

M360P - develop - add 'IP Address Selection' field at 'Service > Dynamic DNS' web page

commit fa8cedd0688ca107a9570b249ad88b32b377bc7e
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jul 17 10:27:55 2019 +0800

    add 'IP Address Selection' field at 'Service > Dynamic DNS' web page

 proscend/prosrc/webcgi/ddns.c                   | 10 ++++++----
 proscend/prosrc/www/app/feature/dynamicDns.html | 10 ++++++++++
 proscend/prosrc/www/app/locale-en.json          |  4 ++++
 proscend/prosrc/www/app/locale-fr.json          |  4 ++++
 proscend/prosrc/www/app/locale-zh-tw.json       |  4 ++++
 5 files changed, 28 insertions(+), 4 deletions(-)

1030

M330 CLI - production set the production is done 需要移除

M330-W/mgmt#  help
  info          enter submenu info
  system        enter submenu system
  ssh           enter submenu ssh
  reset         reset the device to default configuration
  upgrade       upgrade the firmware throught TFTP
  reboot        reboot the device
  backup        backup the config to TFTP server
  restore       restore the config from TFTP server
  production    set the production is done
  exit          exit
M330-W/mgmt#

這是 M360P 專用的 command 而且是給生產階段用的

修改如下

diff --git a/proscend/prosrc/icos/clishell/cli.c b/proscend/prosrc/icos/clishell/cli.c
index fc6dcb6..02dadf4 100644
--- a/proscend/prosrc/icos/clishell/cli.c
+++ b/proscend/prosrc/icos/clishell/cli.c
@@ -554,13 +554,6 @@ int cli_reset(int id, int argc, char **argv)
     return 0;
 }

-int cli_production_done(int id, int argc, char **argv)
-{
-    system("fw_setenv production Yes");
-    CLI_OUTPUT("Set the production is done\n");
-    return 0;
-}
-
 int cli_upgrade(int id, int argc, char **argv)
 {
     if (is_exist_cli_help_entry(argc, argv))
diff --git a/proscend/prosrc/icos/clishell/cli.h b/proscend/prosrc/icos/clishell/cli.h
index af60fc9..951f577 100644
--- a/proscend/prosrc/icos/clishell/cli.h
+++ b/proscend/prosrc/icos/clishell/cli.h
@@ -97,7 +97,6 @@ int cli_upgrade(int id, int argc, char **argv);
 char* cli_get_password(const char* prompt, const char* confirm_prompt, const char* err_msg);
 void cli_write_ret_buf(const char *fmt, ...); //write output to caller's buffer.John20170704
 int cli_reset(int id, int argc, char **argv);
-int cli_production_done(int id, int argc, char **argv);

 int cli_AT_cmd(int id, int argc, char **argv);
 int cli_ping(int id, int argc, char **argv);
diff --git a/proscend/prosrc/icos/clishell/menutree.c b/proscend/prosrc/icos/clishell/menutree.c
index e43b09d..8aff763 100644
--- a/proscend/prosrc/icos/clishell/menutree.c
+++ b/proscend/prosrc/icos/clishell/menutree.c
@@ -386,7 +386,6 @@ sMenuItem menu_mgmt[] =

     ACTION_ITEM("backup",  "backup the config to TFTP server",    0, cli_config_backup),
     ACTION_ITEM("restore", "restore the config from TFTP server", 0, cli_config_restore),
-    ACTION_ITEM("production", "set the production is done", 0, cli_production_done),

     EXIT_MENU_ITEM,
     END_OF_ITEM

build 個 image 試試

M330-W/mgmt#  help
  info       enter submenu info
  system     enter submenu system
  ssh        enter submenu ssh
  reset      reset the device to default configuration
  upgrade    upgrade the firmware throught TFTP
  reboot     reboot the device
  backup     backup the config to TFTP server
  restore    restore the config from TFTP server
  exit       exit
M330-W/mgmt#

commit

M330 - develop - CLI - remove 'mgmt production'

commit 5d529b2e2dd6500b4db399f97881d3fcff6221f6
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jul 17 10:44:26 2019 +0800

    CLI - remove 'mgmt production'
    - this command is for M360P

 proscend/prosrc/icos/clishell/cli.c      | 7 -------
 proscend/prosrc/icos/clishell/cli.h      | 1 -
 proscend/prosrc/icos/clishell/menutree.c | 1 -
 3 files changed, 9 deletions(-)

1050

再 review 自己負責的 task

  • M300 - Multiple upload files through web
    • 100%
  • M330 - USSD Web UI
    • 100%
  • M360P - DDNS
    • 100%

low priority task - no schedule

  • M300 - Layer 2 Encapsulation over GRE (L2oGRE)
  • M330 - Wizard
    • 等待 WAN WiFi 完成後再規劃 Wizard 流程

看來只能繼續 survey - Layer 2 Encapsulation over GRE (L2oGRE)

google cisco eogre

找到 CUWN 8.1 WLC and FC AP - EoGRE Tunnel Gateway Deployment Guide

耐著性子看一下吧


名詞解釋

1140

今天看的這一篇
CUWN 8.1 WLC and FC AP - EoGRE Tunnel Gateway Deployment Guide
至少比前天挖到的
Layer 2 Ethernet over GRE
來的容易看一些

但還是很硬

很多術語都還要額外查詢

希望我能理解 EoGRE 是因為何種需求而存在

1305

M330 上 DQA 放了一些 issue

  • 0000591 - (CTCU) 2. COM Port 只有一組,GPS 選項有 COM1 & COM2
  • 0000599 - DUT doesn't reject broadcast, multicast or reserved IP in GRE local address, remote address, tunnel interface address
  • 0000604 - connected PPTP connections is always 0
  • 0000606 - DUT can establish over 2 pptp connections
  • 0000607 - DUT doesn't reject broadcast, multicast or reserved IP in PPTP server address, client address

0000591 - (CTCU) 2. COM Port 只有一組,GPS 選項有 COM1 & COM2

M330 - develop - remove 'COM 2' option from 'COM Port' field at 'LTE > GPS Config' web page

commit 3ba562c5bc0cdbc1df519b1c60f6470e55b92b39
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jul 17 13:24:15 2019 +0800

    remove 'COM 2' option from 'COM Port' field at 'LTE > GPS Config' web page

 proscend/prosrc/www/app/feature/lteGps.html | 3 ---
 1 file changed, 3 deletions(-)

0000599 - DUT doesn't reject broadcast, multicast or reserved IP in GRE local address, remote address, tunnel interface address

這個放後面一點再來解


0000604 - connected PPTP connections is always 0

參考自己寫過的 wiki 來測試一下

連線後 M330 利用 ifconfig 可以看到

ppp101    Link encap:Point-to-Point Protocol
          inet addr:192.168.10.1  P-t-P:192.168.10.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1280  Metric:1
          RX packets:216 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:23914 (23.3 KiB)  TX bytes:94 (94.0 B)

相關的 log 可以看到 /home/log/pptp.log - 19700101 0:3:11 的部分

191[19700101 0:3:11] [_notify:635][Info] Receive: { "type": "ip-up", "linkname": "pptpd", "device": "ppp101", "iplocal": "192.168.10.1", "ipremote": "192.168.10.2", "peername": "client" }
191[19700101 0:3:11] [_get_setting:461][Info] flag: 0
191[19700101 0:3:11] [_verify_setting:528][Info]
191[19700101 0:3:11] [_get_setting:477][Debug] Getting JSON data from /etc/icos/pptpd/pptpd.json
191[19700101 0:3:11] [_get_setting:485][Debug] jobj: { "mode": "on", "localip": "192.168.10.1", "remoteip_main": "192.168.10.2", "remoteip_end": 10, "clients": [ { "mode": "on", "username": "client", "password": "client" } ] }
191[19700101 0:3:11] [_json_2_setting_handle:262][Debug] mode: 1
191[19700101 0:3:11] [_json_2_setting_handle:270][Debug] localip: 192.168.10.1
191[19700101 0:3:11] [_json_2_setting_handle:278][Debug] remoteip_main: 192.168.10.2
191[19700101 0:3:11] [_json_2_setting_handle:285][Debug] remoteip_end: 10
191[19700101 0:3:11] [_json_2_setting_handle:298][Debug] client #1 json: { "mode": "on", "username": "client", "password": "client" }
191[19700101 0:3:11] [_json_2_setting_handle:306][Debug] mode: 1
191[19700101 0:3:11] [_json_2_setting_handle:314][Debug] username: client
191[19700101 0:3:11] [_json_2_setting_handle:322][Debug] password: client
191[19700101 0:3:11] [_notify:676][Info] Connection of client#1(client) established
191[19700101 0:3:11] [_notify:715][Info] Update the ICOS iface 36 to 'ppp101': 0
191[19700101 0:3:11] [_notify:727][Info] Update the number of PPTPD connection from 0 to 1

此時從 status 畫面便可以看到

image

剛剛在 DQA 那邊的確看到 Connected VPN Connections - PPTP Server 的部分的確為 0

去看一下他那邊的 console 確認一下 /home/log/pptp.log

1425

jason 那邊根本沒 log

那表示 pptpd icos module 的 NotifyHandler 根本沒被觸發

該版本是 P:\2_Projects\3_Wireless\M330\firmware\20190715_V0.04_phase_out

phase_out ???

我來測一下 P:\2_Projects\3_Wireless\M330\firmware\20190716_V0.04\GENERIC 下的

M330_v0.04_014A00000042E8FD.img

直接使用 web ui 來 upgrade

1505

找到原因了

四個月前兩支 shell script 的 mode 就被我從 0755 給成 0644

詭異的是我 local 端這兩個 script 都是 0755

殺掉再 checkout

修改權限

git diff

diff --git a/proscend/base_fs/default/rootfs/etc/ppp/ip-down.d/09pptpd b/proscend/base_fs/default/rootfs/etc/ppp/ip-down.d/09pptpd
old mode 100644
new mode 100755
diff --git a/proscend/base_fs/default/rootfs/etc/ppp/ip-up.d/09pptpd b/proscend/base_fs/default/rootfs/etc/ppp/ip-up.d/09pptpd
old mode 100644
new mode 100755

可以上 code 了

M330 - develop - chmod the following scrips to 755

commit b8093bbe898052fc14b8b4032b37cc456e94a4a6
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jul 17 15:10:00 2019 +0800

    chmod the following scrips to 755
    - /proscend/base_fs/default/rootfs/etc/ppp/ip-down.d/09pptpd
    - /proscend/base_fs/default/rootfs/etc/ppp/ip-up.d/09pptpd

 proscend/base_fs/default/rootfs/etc/ppp/ip-down.d/09pptpd | 0
 proscend/base_fs/default/rootfs/etc/ppp/ip-up.d/09pptpd   | 0
 2 files changed, 0 insertions(+), 0 deletions(-)

1515

M330 剩下的 issue

  • 0000599 - DUT doesn't reject broadcast, multicast or reserved IP in GRE local address, remote address, tunnel interface address
  • 0000606 - DUT can establish over 2 pptp connections
  • 0000607 - DUT doesn't reject broadcast, multicast or reserved IP in PPTP server address, client address

1655

M330 - develop - remove 'COM Port' field at 'LTE > GPS Config' web page

commit f0b42cd97c5a40b0d78e6089c7383444fedd6c47
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Jul 17 16:51:42 2019 +0800

    remove 'COM Port' field at 'LTE > GPS Config' web page
    - since only one COM can be used

 proscend/prosrc/www/app/feature/lteGps.html | 9 ---------
 1 file changed, 9 deletions(-)

1725

M330 - feature/wifi_sta - add WAN > WiFi STA

commit c14241e76ec8cef1092157e7890372be0a570423
Refs: [feature/wifi_sta], {origin/feature/wifi_sta}
Author: jeffrey <[email protected]>
Date:   Wed Jul 17 17:21:06 2019 +0800

    feature/wifi_sta - `add WAN > WiFi STA`
    - now we only have one field 'STA Enable' to set

 proscend/prosrc/webcgi/wifi_sta.c                | 34 +++++++++++++-
 proscend/prosrc/www/app/feature/wifi_sta.html    | 53 ++++++++++++++++++++++
 proscend/prosrc/www/app/feature/wifi_sta.js      | 56 ++++++++++++++++++++++++
 proscend/prosrc/www/app/locale-en.json           | 10 +++++
 proscend/prosrc/www/app/locale-fr.json           | 10 +++++
 proscend/prosrc/www/app/locale-zh-tw.json        | 10 +++++
 proscend/prosrc/www/app/services/icos.service.js | 14 ++++++
 proscend/prosrc/www/src/index.html.src           |  1 +
 proscend/prosrc/www/src/menu.html.src            |  3 ++
 9 files changed, 190 insertions(+), 1 deletion(-)

apply 成 enable 後再 get config 還是 diable

這需要 jessy 幫忙看一下了