20200312_jeffrey - silenceuncrio/diary GitHub Wiki

0910

M330 - bug - [0%] 切 WiFi only --> Bridge only from Web UI - console 顯示 sh: write error: Operation not permitted

ariel 的 mail 是這麼寫

Dear Jessy and jeffrey,

切 WiFi only --> Bridge only from Web UI

oot@Cellular Router:~# brctl show
bridge name     bridge id               STP enabled     interfaces
lan             8000.0003790665d6       no              eth0
root@Cellular Router:~# sh: write error: Operation not permitted

使用 VMware jjbox

profile 選擇 GENERIC/1_GENERIC_WIFI

1005

接連操作了幾次都複製不出問題

1030

M330 - task - [0%] need to tune for wifi bridge

  • (1) Please add (Bridge) for WiFi bridge mode like LTe (Bridge only).
  • (2) Please hide ipv4 address, ipv4 mask, default gateway for wifi bridge mode.
commit e56074d6a86132ee315f0cb7be5c82d9bf218b89
Refs: [release/v1.01], {origin/release/v1.01}
Author: jeffrey <[email protected]>
Date:   Thu Mar 12 11:41:43 2020 +0800

    refactoring status page - easy to maintain and understand

 proscend/prosrc/www/app/feature/status.js          | 151 +++-
 proscend/prosrc/www/app/feature/status.wandns.html |  23 -
 .../www/app/feature/status.wandns_second.html      |  23 -
 .../prosrc/www/app/feature/status_pannel_apn1.html |  54 ++
 .../prosrc/www/app/feature/status_pannel_apn2.html |  54 ++
 .../prosrc/www/app/feature/status_pannel_do.html   |  25 +
 .../prosrc/www/app/feature/status_pannel_gnss.html |  33 +
 .../www/app/feature/status_pannel_lan_eth.html     |  34 +
 .../prosrc/www/app/feature/status_pannel_vpn.html  |  35 +
 .../www/app/feature/status_pannel_wan_dns.html     |  23 +
 .../app/feature/status_pannel_wan_dns_second.html  |  23 +
 .../www/app/feature/status_pannel_wan_eth.html     |  30 +
 .../www/app/feature/status_pannel_wan_lte.html     |  88 +++
 .../www/app/feature/status_pannel_wan_wifi.html    |  52 ++
 .../www/app/feature/status_pannel_wifi_ap.html     |  26 +
 .../prosrc/www/src/app/feature/status.html.src     | 775 ++-------------------
 16 files changed, 654 insertions(+), 795 deletions(-)

1155

M330 - bug - [0%] 切 WiFi only --> Bridge only from Web UI - console 顯示 sh: write error: Operation not permitted

ariel 使用 dialy build 的 image 可以複製問題

1300

M330 - bug - [0%] 切 WiFi only --> Bridge only from Web UI - console 顯示 sh: write error: Operation not permitted

將自己的 local build 不要使用 debug mode


還是複製不出來

使用 daily build 的 image 吧

1355

在有插 SIM 卡的狀態下

WAN Priority 從 Auto 改成 WiFi Only

而且 WiFi Mode 選擇 Bridge Only

過一下 console 會顯示 sh: write error: Operation not permitted

bash-4.2# sh: write error: Operation not permitted

此時不要點按 reboot 按鈕

再將 WAN Priority 從 WiFi Only 改成 Auto

按 Apply

console 又出現 sh: write error: Operation not permitted


利用 tail -f /home/log/lte.log 可發現該字串出現的點都是固定的

...
1583995676[20200312 6:47:56] [NotifyLTE:5203]>>> event_id=2  src_id=56
1583995676[20200312 6:47:56] [NotifyLTE:5204]ndsts=<2> G_lte_connect_mode=9
1583995676[20200312 6:47:56] [NotifyLTE:5884]Receive ICOS_CHG_CONN_TYPE:
1583995676[20200312 6:47:56] [NotifyLTE:5893]WAN_AUTO / LTE_ONLY / LTE_FIRST: local_wan_conf.wan_conn_type=(0)
1583995676[20200312 6:47:56] [user_manual_connect_func:5057]User manually connect G_lte_connect_mode=9
1583995676[20200312 6:47:56] [user_manual_connect_func:5063]user_manual_connect_func(): PROTO_CONNECTED
1583995676[20200312 6:47:56] [NotifyLTE:6293]Leave<<< event_id=2  src_id=56
sh: write error: Operation not permitted
1583995678[20200312 6:47:58] [NotifyLTE:5203]>>> event_id=23  src_id=56
1583995678[20200312 6:47:58] [NotifyLTE:5204]ndsts=<2> G_lte_connect_mode=9
1583995678[20200312 6:47:58] [NotifyLTE:5874]Receive ICOS_NET_MODE_CHANGE
1583995678[20200312 6:47:58] [conf_lte_net:4752]lte_net=2  local_wan_conf.wan_conn_type=0
1583995678[20200312 6:47:58] [NotifyLTE:6293]Leave<<< event_id=23  src_id=56

...

1583995695[20200312 6:48:15] [NotifyLTE:5203]>>> event_id=2  src_id=56
1583995695[20200312 6:48:15] [NotifyLTE:5204]ndsts=<2> G_lte_connect_mode=9
1583995695[20200312 6:48:15] [NotifyLTE:5884]Receive ICOS_CHG_CONN_TYPE:
1583995695[20200312 6:48:15] [NotifyLTE:5893]WAN_AUTO / LTE_ONLY / LTE_FIRST: local_wan_conf.wan_conn_type=(0)
1583995695[20200312 6:48:15] [user_manual_connect_func:5057]User manually connect G_lte_connect_mode=9
1583995695[20200312 6:48:15] [user_manual_connect_func:5063]user_manual_connect_func(): PROTO_CONNECTED
1583995695[20200312 6:48:15] [NotifyLTE:6293]Leave<<< event_id=2  src_id=56
sh: write error: Operation not permitted
1583995697[20200312 6:48:17] [NotifyLTE:5203]>>> event_id=23  src_id=56
1583995697[20200312 6:48:17] [NotifyLTE:5204]ndsts=<2> G_lte_connect_mode=9
1583995697[20200312 6:48:17] [NotifyLTE:5874]Receive ICOS_NET_MODE_CHANGE
1583995697[20200312 6:48:17] [conf_lte_net:4752]lte_net=2  local_wan_conf.wan_conn_type=0
1583995697[20200312 6:48:17] [NotifyLTE:6293]Leave<<< event_id=23  src_id=56
...

已發信給 ariel 作後續處理

結案

1500

M330 - bug - [0%] factory_and_reboot 頁面應該和 reboot 頁面行為一致

commit 1dd4ee5b4d64714ba46c166496ff4478f9b155cd
Refs: [release/v1.01], {origin/release/v1.01}
Author: jeffrey <[email protected]>
Date:   Thu Mar 12 15:32:43 2020 +0800

    let the 'factory_and_reboot' has the same behaviour as 'reboot'
    - full layout
    - $window.location.href = '/'
    - polling per 8 seconds after 32 seconnds after invoke icos.config.load_factory_and_reboot()

 proscend/prosrc/www/app/app.controller.js             | 2 +-
 proscend/prosrc/www/app/feature/factory_and_reboot.js | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

1540

M360P - issue - [100%] - 0000908: sometimes first time modify LTE NET mode or APN on dual APN will apply fail

懷疑問題發生的當下 lighttpd 有重啟

root@M360-P:/home/admin# ps aux | grep ligh
root      2343  3.0  1.7   4428  2132 pts/1    Ss+  00:30   0:01 lighttpd -D -f /tmp/icos/web/lighttpd.conf
root      3877  0.0  0.3   2220   376 ttyS1    S+   00:31   0:00 grep ligh
root@M360-P:/home/admin# ps aux | grep ligh
root      4597  1.3  1.6   4324  2020 pts/5    Ss+  00:32   0:00 lighttpd -D -f /tmp/icos/web/lighttpd.conf
root      4731  0.0  0.3   2220   376 ttyS1    S+   00:32   0:00 grep ligh

真的有重啟

M360P 上 lighttpd 的版本是 1.4.30

切換到 VMware jubuntu

作以下修改

diff --git a/proscend/prosrc/webcgi/lte.c b/proscend/prosrc/webcgi/lte.c
index cbafb3c..8fa4bec 100644
--- a/proscend/prosrc/webcgi/lte.c
+++ b/proscend/prosrc/webcgi/lte.c
@@ -14,14 +14,25 @@

 static void _apply()
 {
-    lte_config _config;
-    int res = ICOS_GetSetting(MODULE_LTE, 0, 0, &_config, sizeof(_config));
-    if (res != ICOS_SUCCESS)
+
+
+
+    pid_t pid;
+    pid = fork();
+    if (pid != 0)
     {
-        jweb.http.status(500);
-        jweb.out.json.fail("ICOS_GetSetting fail");
+        sleep(1);
+        jweb.out.json.ok();
     }

+    fclose (stdin);
+    fclose (stdout);
+
+
+
+    lte_config _config;
+    int res = ICOS_GetSetting(MODULE_LTE, 0, 0, &_config, sizeof(_config));
+
     jweb.in.to_int("main_sim", &_config.main_sim);
     jweb.in.to_int("disable_roaming", &_config.disable_roaming);
     jweb.in.to_bool("roaming_switch", &_config.roaming_switch);
@@ -56,13 +67,9 @@ static void _apply()
     jweb.in.to_int("lte_down_times", &_config.lte_down_times);

     res = ICOS_Apply(MODULE_LTE, 0, 0, &_config, sizeof(_config));
-    if (res != ICOS_SUCCESS)
-    {
-        jweb.http.status(500);
-        jweb.out.json.fail("ICOS_Apply fail");
-    }

-    jweb.out.json.ok();
+    cgiFree (cgi);
+    exit(0);
 }


目前需要大量的測試來驗證該想法沒有錯誤

但缺點是前端不知道真正的 apply 結果

1620

john 發現 DMZ 的錯誤 並作了以下的修正

commit a847dac2d433e43b58218d64ef2fa52c6d6a0703  
Refs: [release/v0.02], {origin/release/v0.02}
Author:     john <[email protected]>
AuthorDate: Thu Mar 12 16:10:18 2020 +0800
Commit:     john <[email protected]>
CommitDate: Thu Mar 12 16:10:18 2020 +0800

    [DMZ]fix flush filter chain rule on nat table.
---
 proscend/prosrc/icos/icoslib/dmz/dmzcfg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proscend/prosrc/icos/icoslib/dmz/dmzcfg.c b/proscend/prosrc/icos/icoslib/dmz/dmzcfg.c
index 521c6b8..cbf5b14 100644
--- a/proscend/prosrc/icos/icoslib/dmz/dmzcfg.c
+++ b/proscend/prosrc/icos/icoslib/dmz/dmzcfg.c
@@ -247,7 +247,7 @@ static int _notify(PRO_EVENT *pevent)
                     IPTN_A("%s %s -p udp -j DNAT --to-destination %s",
                            IPT_UC_DMZ_PRER, act_wan, szDstIpAddr);

-                    IPTN_F(IPT_UC_DMZ_FWD);
+                    IPTF_F(IPT_UC_DMZ_FWD);
                     IPTF_A("%s -o lan+ -d %s -m state --state NEW -j ACCEPT",
                            IPT_UC_DMZ_FWD, szDstIpAddr); //lan+ support VLAN
                 }
@@ -255,7 +255,7 @@ static int _notify(PRO_EVENT *pevent)
                 {
                     CPRT("ATTVAL_MODE_OFF\n");
                     IPTN_F(IPT_UC_DMZ_PRER);
-                    IPTN_F(IPT_UC_DMZ_FWD);
+                    IPTF_F(IPT_UC_DMZ_FWD);
                 }

回頭看一下 M330 也有錯誤

而且我從頭到尾都沒有改過 DMZ 的 icos module

M360 也是錯的


M300 也是錯的

這樣的錯誤到底會造成什麼影響呢?

-                    IPTN_F(IPT_UC_DMZ_FWD);
+                    IPTF_F(IPT_UC_DMZ_FWD);

從以上的錯誤可知我該 flush filter table 裡的 IPT_UC_DMZ_FWD

但我卻去 flush nat table 裡的 IPT_UC_DMZ_FWD

造成的後果就是你一但 on 過一次 DMZ 就再也 off 不掉了

1735

M330 - bug - [0%] flush filter chain rule on nat table

使用 VMware jjbox

套用 john 先測一下

Firewall > DMZ

  • Mode = Enable
  • Host IP Address = 192.168.1.1

Apply 後從 shell 觀察到的 rule

root@Cellular Router:~# iptables -t nat -nvL DmzPreRouting
Chain DmzPreRouting (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           mark match 0x40000000/0x40000000 to:192.168.1.113
    0     0 DNAT       udp  --  *      *       0.0.0.0/0            0.0.0.0/0           mark match 0x40000000/0x40000000 to:192.168.1.113
root@Cellular Router:~# iptables -t filter -nvL DmzForward
Chain DmzForward (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  *      lan+    0.0.0.0/0            192.168.1.113       state NEW

想驗證效果可以作以下測試

Note: the testing verified at the following test scenario

+--------------------------+
| wan-side pc              |
| [iperf -c 192.168.2.1]   |
+---+----------------------+
    | 192.168.2.33
    |
    | 192.168.2.1(wan)
+---+----------------------+
| M300                     |
| DMZ                      |
|   * mode: enable         |
|   * host: 192.168.1.113  |
+---+----------------------+
    | 192.168.1.1(lan)
    |
    | 192.168.1.113
+---+----------------------+
| lan-side pc              |
| [iperf -s]               |
+--------------------------+

在把 DMZ 的 Mode = Disable

透過 shell 觀察

root@Cellular Router:~# iptables -t nat -nvL DmzPreRouting
Chain DmzPreRouting (1 references)
 pkts bytes target     prot opt in     out     source               destination
root@Cellular Router:~# iptables -t filter -nvL DmzForward
Chain DmzForward (1 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  *      lan+    0.0.0.0/0            192.168.1.113       state NEW

果然是 bug

套用 john 的修改並更新後已確認問題解決了

m330(release/v1.01) - [DMZ]fix flush filter chain rule on nat table.

commit 91842ec406f85bdf0a347bba5ca85a5a06c1e742
Refs: [release/v1.01], {origin/release/v1.01}
Author: john <[email protected]>
Date:   Thu Mar 12 16:10:18 2020 +0800

    [DMZ]fix flush filter chain rule on nat table.

 proscend/prosrc/icos/icoslib/dmz/dmzcfg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

看來可以放心套用了

回到 Vmware jubuntu

下班前來 compile m330