20200206_jeffrey - silenceuncrio/diary GitHub Wiki

0900

昨天 jubuntu 在 proscend 外層的 compile 發生 error

昨天用的是 build.sh

使用 make -j1 V=s 來看一下哪裡出了錯


過了五分鐘依然還在 compile...

先等等吧

一旦在出錯就先跳出 jubuntu - 下班前再繼續

畢竟 jubuntu 是為了以後鋪路所做的實驗

0925

還在 build... 先停掉好了 不要耽誤上班該負責的進度

關掉 Junbuntu 虛擬機

開啟 Ubuntu 64-bit (2) 虛擬機 - 也就是 jjbox - 192.168.217.129


m350[develop] 拉最新的 code

  • 進 proscend 目錄
  • make clean 再 make

m350 板子開機

透過 web ui 來 upgrade 剛剛 build 出來的 firmware.img


先用 shell 做 gre 的配置 跟 Cisco 測試

測試 m350 是否能靠 accept_local 來回應 gre keepalive


準備以下的環境

+-------+                                               +---------------+
|       |                   lan        fastEthernet 0/0 |               |
| m350  +-------------------+---------------------------+ CISCO 2811    |
|       | 192.168.1.104                  192.168.1.200  |               |
+-------+                                               +---------------+

參考 20200108_jeffrey

利用 ping 確認基本的環境配置


再參考 20200204_jeffrey

進行 gre keepalive 測試


*Nov 25 17:53:09.591: Tunnel0: sending keepalive, 192.168.1.104->192.168.1.200 (len=24 ttl=255), counter=1
*Nov 25 17:53:09.591: Tunnel0: keepalive received, 192.168.1.104->192.168.1.200 (len=24 ttl=253), resetting counter
*Nov 25 17:53:13.591: Tunnel0: sending keepalive, 192.168.1.104->192.168.1.200 (len=24 ttl=255), counter=1
*Nov 25 17:53:13.591: Tunnel0: keepalive received, 192.168.1.104->192.168.1.200 (len=24 ttl=253), resetting counter
*Nov 25 17:53:17.591: Tunnel0: sending keepalive, 192.168.1.104->192.168.1.200 (len=24 ttl=255), counter=1
*Nov 25 17:53:17.591: Tunnel0: keepalive received, 192.168.1.104->192.168.1.200 (len=24 ttl=253), resetting counter
...

非常好

m350 能夠回應來自 Cisco 2811 的 keepalive request

1015

開始來 porting 吧

跟幾天前 porting 到 m300 時的目標一樣

profile 只有 PROSRC_GRE 不要有 PROSRC_GRE_2G 或 PROSRC_GRE_3G

icos module 可以有 MODULE_GRE, MODULE_GRE_2G 和 MODULE_GRE_3G

內部軟體的實作我可以有自己的架構

但 profile 只能有一個 PROSRC_GRE 開關

不然很容易搞混

1300

中午來了急件

m330[release/v0.09] - add 'Diagnosis > TTY2TCP' for all profile

commit b878f7db2a514f673b4af865f268c2f7e2de7c93
Refs: [release/v0.09], {origin/release/v0.09}
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 12:32:49 2020 +0800

    add 'Diagnosis > TTY2TCP' for all profile

 proscend/prosrc/www/src/menu.html.src | 1 +
 1 file changed, 1 insertion(+)

m330[release/v0.09] - add online manual for 'Diagnosis > TTY2TCP'

commit c00e1d3262a289386e949a538114825c14857ad9
Refs: [release/v0.09], {origin/release/v0.09}
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 12:36:48 2020 +0800

    add online manual for 'Diagnosis > TTY2TCP'

 proscend/prosrc/www/src/manual.html.src       | 1 +
 proscend/prosrc/www/src/manual/sidebar.h.html | 3 +++
 2 files changed, 4 insertions(+)

1340

目前 M350 跟 Cisco 2811 的 GRE 測試 PASS

上 code 吧

m350[develop] - porting gre from m330

commit 11d80704edd79b7aeb153d81d4a2384f544f09d2
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 13:40:41 2020 +0800

    porting gre from m330
    - control by compile flag PROSRC_GRE
    - support gre tunnel keepalive

 .../rootfs/home/factory/icos/gre_3g/gre_3g.json    |  31 +
 proscend/mconfig/configs/CTCU/0_CTCU/defconfig     |   3 +-
 .../mconfig/configs/CTCU/1_CTCU_WIFI/defconfig     |   3 +-
 .../mconfig/configs/GENERIC/0_GENERIC/defconfig    |   3 +-
 .../configs/GENERIC/1_GENERIC_WIFI/defconfig       |   3 +-
 proscend/mconfig/configs/PI/0_PI/defconfig         |   3 +-
 proscend/prosrc/icos/Makefile                      |   2 +-
 proscend/prosrc/icos/clishell/cli.c                |   4 +-
 proscend/prosrc/icos/greK/greK.c                   | 321 ---------
 proscend/prosrc/icos/greK/main.c                   | 149 +++-
 proscend/prosrc/icos/icoslib/Makefile              |   2 +-
 proscend/prosrc/icos/icoslib/entry.c               |   6 +-
 proscend/prosrc/icos/icoslib/gre_3g/Makefile       |  14 +
 proscend/prosrc/icos/icoslib/gre_3g/gre_3g.c       | 751 +++++++++++++++++++++
 .../prosrc/icos/icoslib/ipc_utility/icos_ipc.c     |   9 +
 proscend/prosrc/icos/icoslib/pptpd/pptpd.c         |   4 +-
 proscend/prosrc/icos/include/icos_common.h         |   3 +-
 proscend/prosrc/icos/include/icos_module.h         |   1 +
 proscend/prosrc/icos/include/icos_shm.h            |  18 +
 proscend/prosrc/icos/include/module_gre_3g.h       |  43 ++
 proscend/prosrc/webcgi/Makefile                    |   6 +-
 proscend/prosrc/webcgi/gre_3g.c                    | 105 +++
 proscend/prosrc/webcgi/icos_shm.c                  |  30 +
 proscend/prosrc/www/Makefile                       |   1 +
 proscend/prosrc/www/app/feature/gre_3g.js          | 126 ++++
 proscend/prosrc/www/app/feature/gre_3g_edit.html   | 147 ++++
 .../prosrc/www/app/feature/gre_3g_summary.html     |  78 +++
 proscend/prosrc/www/app/locale-en.json             |  29 +
 proscend/prosrc/www/app/locale-fr.json             |  29 +
 proscend/prosrc/www/app/locale-zh-tw.json          |  29 +
 proscend/prosrc/www/app/services/icos.service.js   |  14 +
 .../prosrc/www/src/app/feature/gre_3g.html.src     |   3 +
 proscend/prosrc/www/src/index.html.src             |   3 +-
 proscend/prosrc/www/src/menu.html.src              |   5 +-
 34 files changed, 1609 insertions(+), 369 deletions(-)

這次的修改 grek 面臨到 htons 和 ntohs 的修改

我應該把這個修改套用到 m330 去

1335

m330 套用以下的修改

diff --git a/proscend/prosrc/icos/greK/main.c b/proscend/prosrc/icos/greK/main.c
index 1675118..b0577a7 100644
--- a/proscend/prosrc/icos/greK/main.c
+++ b/proscend/prosrc/icos/greK/main.c
@@ -137,7 +137,7 @@ void my_packet_handler(

     //printf("gre->protocol: 0x%04x\n", gre->protocol);

-    switch (gre->protocol)
+    switch (ntohs(gre->protocol))
     {
         case 0: // GRE Tunnel keepalive response
             //printf("GRE Tunnel keepalive response\n");
@@ -514,7 +514,7 @@ int main(int argc, char *argv[])
     struct grehdr *outer_greh = (struct grehdr *) Buffer;

     memset(outer_greh, 0, sizeof(struct grehdr));
-    outer_greh->protocol = 0x0800; // IP
+    outer_greh->protocol = htons(0x0800); // IP



@@ -526,7 +526,7 @@ int main(int argc, char *argv[])
     inner_ip->ihl       = 5; // the number of 32-bit words in the header
     inner_ip->version   = 4; // IPv4
     inner_ip->tos       = 16; // low delay
-    inner_ip->tot_len   = sizeof(struct iphdr) + sizeof(struct grehdr);
+    inner_ip->tot_len   = htons(sizeof(struct iphdr) + sizeof(struct grehdr));
     inner_ip->id        = htons(0);
     inner_ip->frag_off  = 0x00;
     inner_ip->ttl       = 64;
@@ -548,7 +548,7 @@ int main(int argc, char *argv[])

     // calculate the checksum for integrity

-    inner_ip->check = csum((unsigned short *) (Buffer + sizeof(struct grehdr)), sizeof(struct iphdr) + sizeof(struct grehdr));
+    inner_ip->check = csum((unsigned short *) (Buffer + sizeof(struct grehdr)), sizeof(struct iphdr));

     printf("checksum: 0x%04x\n", inner_ip->check);

(END)

來跟 Cisco 對測一下... PASS

上 code

m330[release/v0.09] - use ntohs and htons correctly to ignore the Big/Little-Endian effect

commit dbb96ffaf70a2b7fc4d5ff5ed398dbf51c7e04e1
Refs: [release/v0.09], {origin/release/v0.09}
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 14:09:30 2020 +0800

    use ntohs and htons correctly to ignore the Big/Little-Endian effect

 proscend/prosrc/icos/greK/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

1415

回到 m350

新案子的開始

投資點時間來整理一下 web - 參考 20200130_jeffrey

來升級 Font Awesome

目前版本 4.6.3 來升級成最新的的 5.12.1

利用 fit flow 開個 branch 以避免緊急的狀況需要切回 develop

➜  m350 git:(develop) ✗ git flow feature start new_fontAwesome
Switched to a new branch 'feature/new_fontAwesome'

Summary of actions:
- A new branch 'feature/new_fontAwesome' was created, based on 'develop'
- You are now on branch 'feature/new_fontAwesome'

Now, start committing on your feature. When done, use:

     git flow feature finish new_fontAwesome

➜  m350 git:(feature/new_fontAwesome) ✗

1605

m350[feature/new_fontAwesome] - update Font Awesome from version 4.6.3 to 5.12.1

commit 82e649185e58ba9ade9870808113977a94469933
Refs: [feature/new_fontAwesome]
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 15:58:11 2020 +0800

    update Font Awesome from version 4.6.3 to 5.12.1

    some care should be taken
    - fa-exchange to fa-exchange-alt
    - fa-shield to fa-shield-alt
    - fa-sign-in to fa-sign-in-alt
    - fa-sign-out to fa-sign-out-alt

 proscend/prosrc/www/app/feature/basicRules.html    |    2 +-
 proscend/prosrc/www/app/feature/dmz.html           |    2 +-
 .../prosrc/www/app/feature/ipfilter_summary.html   |    2 +-
 proscend/prosrc/www/app/feature/ips.html           |    2 +-
 proscend/prosrc/www/app/feature/lanIpv4.html       |    2 +-
 proscend/prosrc/www/app/feature/lanIpv6.html       |    2 +-
 proscend/prosrc/www/app/feature/login.html         |    2 +-
 proscend/prosrc/www/app/feature/logout.html        |    2 +-
 .../prosrc/www/app/feature/macfilter_summary.html  |    2 +-
 .../www/app/feature/portForwarding_summary.html    |    2 +-
 proscend/prosrc/www/app/feature/snat.html          |    2 +-
 .../prosrc/www/app/feature/urlfilter_summary.html  |    2 +-
 proscend/prosrc/www/app/feature/vlan.html          |    2 +-
 .../prosrc/www/app/feature/vlanSubnet_summary.html |    2 +-
 proscend/prosrc/www/app/feature/wanEthernet.html   |    2 +-
 .../prosrc/www/app/feature/wan_health_check.html   |    2 +-
 proscend/prosrc/www/app/feature/wifi_sta.html      |    2 +-
 .../prosrc/www/brand_ctcu/src/brand/top.html.src   |    4 +-
 .../prosrc/www/brand_hytec/src/brand/top.html.src  |    4 +-
 .../www/brand_hytec_korea/src/brand/top.html.src   |    4 +-
 .../www/brand_nobrand/src/brand/top.html.src       |    4 +-
 .../www/brand_proscend/src/brand/top.html.src      |    4 +-
 .../libs/fontawesome-free-5.12.1-web/LICENSE.txt   |   34 +
 .../libs/fontawesome-free-5.12.1-web/css/all.css   | 4463 ++++++++++++++++++++
 .../webfonts/fa-brands-400.woff2                   |  Bin 0 -> 76548 bytes
 .../webfonts/fa-solid-900.woff2                    |  Bin 0 -> 76120 bytes
 .../prosrc/www/src/app/feature/dnsDhcp6c.html.src  |    2 +-
 .../www/src/app/feature/wanPriority.html.src       |    2 +-
 proscend/prosrc/www/src/index.html.src             |    5 +
 proscend/prosrc/www/src/menu.html.src              |    6 +-
 30 files changed, 4534 insertions(+), 32 deletions(-)

比想像的簡單

先併回 develop

➜  m350 git:(feature/new_fontAwesome) ✗ git flow feature finish
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.
Merge made by the 'recursive' strategy.
 proscend/prosrc/www/app/feature/basicRules.html                                   |    2 +-
 proscend/prosrc/www/app/feature/dmz.html                                          |    2 +-
 ...
Deleted branch feature/new_fontAwesome (was 82e6491).

Summary of actions:
- The feature branch 'feature/new_fontAwesome' was merged into 'develop'
- Feature branch 'feature/new_fontAwesome' has been locally deleted
- You are now on branch 'develop'

➜  m350 git:(develop) ✗ 

push 上去吧

m350[develop] - update Font Awesome from version 4.6.3 to 5.12.1

commit 1e6ad7543bdbf8a12aef329c93c782779ce6b75f
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 15:58:11 2020 +0800

    update Font Awesome from version 4.6.3 to 5.12.1

    some care should be taken
    - fa-exchange to fa-exchange-alt
    - fa-shield to fa-shield-alt
    - fa-sign-in to fa-sign-in-alt
    - fa-sign-out to fa-sign-out-alt

 proscend/prosrc/www/app/feature/basicRules.html    |    2 +-
 proscend/prosrc/www/app/feature/dmz.html           |    2 +-
 ...
 30 files changed, 4534 insertions(+), 32 deletions(-)

參考 Upgrading from Version 4

prefix fas or fa 都是表示 Font Awesome Solid

還好不用把 fa 改成 fas

不過這篇寫的還真詳細

另外 Hosting Font Awesome Yourself

說到我剛剛瞎子摸象過程

看來我摸象的功力還不錯 基本都做對了

不過 webfont 我只留 woff2 這個 type

雖然沒看到什麼問題

不過有人問一樣的問題而且也有人回答


發現用 IE 開網頁時 啥 icon 都看不到

趕緊把其他的 type 補上

  • eot
  • svg
  • ttf
  • woff

用 IE 開 online manual 時 icon 也 show 不出來

放上去後就正常了

m350[develop] - give all types of webfonts for fontawsome

commit 648b77fc8e5c9318a28f387b7e42a108f4a51226
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 16:42:43 2020 +0800

    give all types of webfonts for fontawsome

 .../webfonts/fa-brands-400.eot                     |  Bin 0 -> 133034 bytes
 .../webfonts/fa-brands-400.svg                     | 3570 +++++++++++++++
 .../webfonts/fa-brands-400.ttf                     |  Bin 0 -> 132728 bytes
 .../webfonts/fa-brands-400.woff                    |  Bin 0 -> 89824 bytes
 .../webfonts/fa-solid-900.eot                      |  Bin 0 -> 194078 bytes
 .../webfonts/fa-solid-900.svg                      | 4700 ++++++++++++++++++++
 .../webfonts/fa-solid-900.ttf                      |  Bin 0 -> 193792 bytes
 .../webfonts/fa-solid-900.woff                     |  Bin 0 -> 99004 bytes
 8 files changed, 8270 insertions(+)

讓 online manual 也能吃到相同的 font awesome 資源

m350[develop] - at online manual, use the same source of font awesome as main application

commit 932863fab746aa2f22943b2eee0e97f403c49321
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Thu Feb 6 16:58:10 2020 +0800

    at online manual, use the same source of font awesome as main application

 proscend/prosrc/www/manual/css/fontawesome.css     | 3983 --------------------
 proscend/prosrc/www/manual/css/solid.css           |   15 -
 .../prosrc/www/manual/webfonts/fa-solid-900.woff2  |  Bin 73852 -> 0 bytes
 proscend/prosrc/www/src/manual.html.src            |    4 +-
 4 files changed, 2 insertions(+), 4000 deletions(-)

1700

jubuntu 時間

開機後記得做一次

sudo mount UUID="7e970ddc-986b-4246-bbcf-f6eb90ed93b5" /home/jeffrey/m350
sudo chown -R jeffrey:jeffrey /home/jeffrey/m350

不過進了 build-m350 container 卻發現 /home/user 下是空的

看來要注意以下的用法

docker run --name build-m350 \
           -e LOCAL_USER_ID=`id -u $USER` \
           -v `pwd`:/home/user \
           -it --restart=always -d build-m350 /bin/bash

這個 container 會在一開機就被叫起來

但 volume 的掛載一定要在 /home/jeffrey/m350 準備好之後

今天先繼續把 proscend 外層 build 完


jessy 提到以下這個較花時間的動作應該只需要做一次就好了

sudo chown -R jeffrey:jeffrey /home/jeffrey/m350

先收集情情報再逐步驗證