20181008_jeffrey - silenceuncrio/diary GitHub Wiki

0900

review

0955

今年度的健康檢查順利結束

腹部超音波檢查順利 有中度脂肪肝

抽血的自費項目全選了 一年花一次買保險

1000

繼續 52XXZ 的 zebra

準備一個 debug 用的 zebra configuration - /tmp/zebra.conf

log file /tmp/zebra.log

啟動 zebra 並套用該 debug 用的 configuration - zebra -f /tmp/zebra.conf -u root

root@52XXZ:~# zebra -f /tmp/zebra.conf -u root
Multiple command installs to node 4 of command:
show ipv6 mroute vrf all

check log file - /tmp/zebra.log

2018/01/07 17:02:29 ZEBRA: Can't create pid lock file /var/run/quagga/zebra.pid (No such file or directory), exiting

既然 zebra 抱怨沒有 /var/run/quagga/ 那就準備給它

root@52XXZ:~# mkdir -p /var/run/quagga

再啟動 zebra

root@52XXZ:~# zebra -f /tmp/zebra.conf -u root -d
Multiple command installs to node 4 of command:
show ipv6 mroute vrf all

check log file - /tmp/zebra.log

root@52XXZ:~# cat /tmp/zebra.log
2018/01/07 17:02:29 ZEBRA: Can't create pid lock file /var/run/quagga/zebra.pid (No such file or directory), exiting
2018/01/07 17:02:51 ZEBRA: Zebra 1.1.0 starting: vty@2601

哈哈 成功了

看來只要把 mkdir -p /var/run/quagga 加在 zebra 啟動前即可

1045

修改 proscend/base_fs/default/rootfs/etc/rc.local

@@ -99,6 +99,9 @@ fi
 # Handle the reset/reboot button
 reset_btn_handler.sh &

+#quagga needed
+mkdir -p /var/run/quagga
+
 /usr/sbin/seqcmdd -C /var/run/seqcmdd/ipt_cmd &
 /usr/sbin/icospromsg &
 /usr/sbin/icosconfig bootinit -P /var/usock/event.us

修改 proscend/prosrc/icos/icoslib/zebra/zebra.c

@@ -22,7 +22,7 @@
 #define ZEBRA_DAEMON_PATH   "/usr/sbin/zebra"
 #define ZEBRA_DAEMON         "zebra"
 #define ZEBRA_ARGV           "-d -u root -f %s"
-#define ZEBRA_CONF_FILE      "/etc/quagga/zebra.conf"
+#define ZEBRA_CONF_FILE      "/etc/icos/zebra/quagga_zebra.conf"
 #define ZEBRA_CONF_FORMAT \
     "hostname %s\n" \
     "password %s\n"
@@ -53,7 +53,7 @@ static int _prepare_config(sZebraConfig *config)
 {
     CPRT("_prepare_config\n");

-    FILE *fp = fopen(ZEBRA_CONF_FILE, "w");
+    FILE *fp = fopen(ZEBRA_CONF_FILE, "w+");
     if (fp == 0)
     {
         CPRT("Failed to open file: '%s'\n", ZEBRA_CONF_FILE);
@@ -65,6 +65,10 @@ static int _prepare_config(sZebraConfig *config)
             config->password
            );

+#ifdef DEBUG
+    fprintf(fp, "log file /tmp/zebra.log\n");
+#endif
+
     fclose(fp);

     return ICOS_SUCCESS;
@@ -208,13 +212,13 @@ static int _apply(int flag, int index, void* pStruct, int structSize)

     if (ATTVAL_MODE_ON == config->mode)
     {
-        system("/usr/sbin/quagga.init stop zebra 1>/dev/null 2>&1");
+        system("killall zebra 1>/dev/null 2>&1");
         _prepare_config(config);
-        system("/usr/sbin/quagga.init start zebra 1>/dev/null 2>&1");
+        system("zebra -d -u root -f /etc/icos/zebra/quagga_zebra.conf 1>/dev/null 2>&1");
     }
     else
     {
-        system("/usr/sbin/quagga.init stop zebra 1>/dev/null 2>&1");
+        system("killall zebra 1>/dev/null 2>&1");
     }

     return ICOS_SUCCESS;

build image... ok

check

ps aux | grep zebra... PASS

root@52XXZ:~# ps aux | grep zebra
root      1070  0.0  0.7   2508   984 ?        Ss   09:33   0:00 zebra -d -u root -f /etc/icos/zebra/quagga_zebra.conf
root      2767  0.0  0.2   1812   364 ?        S    09:34   0:00 grep zebra

cat /var/run/quagga/zebra.pid... PASS

root@52XXZ:~# cat /var/run/quagga/zebra.pid
1070

1100

趁勝追擊

修改 proscend/prosrc/icos/icoslib/rip_2g/rip_2g.c

@@ -33,7 +33,7 @@
 #define RIP_2G_DAEMON_PATH          "/usr/sbin/ripd"
 #define RIP_2G_DAEMON               "ripd"
 #define RIP_2G_ARGV                 "-d -u root -f %s"
-#define RIP_2G_CONFIGURATION_FILE   "/etc/quagga/ripd.conf"
+#define RIP_2G_CONFIGURATION_FILE   "/etc/icos/rip_2g/quagga_ripd.conf"
 #define RIP_2G_DEBUG_LOG            "/tmp/ripd.log"


@@ -86,7 +86,7 @@ static int _make_configuration_file(rip_2g_t *setting)
 {
     _LOG_INFO("");

-    FILE *fp = fopen(RIP_2G_CONFIGURATION_FILE, "w");
+    FILE *fp = fopen(RIP_2G_CONFIGURATION_FILE, "w+");
     if (fp == 0)
     {
         _LOG_DEBUG("Failed to open file: '%s'", RIP_2G_CONFIGURATION_FILE);
@@ -465,7 +465,7 @@ static int _apply(int flag, int index, void* pStruct, int structSize)
     {
         system("killall ripd 1>/dev/null 2>&1");
         _make_configuration_file(setting);
-        system("ripd -d -u root");
+        system("ripd -d -u root -f /etc/icos/rip_2g/quagga_ripd.conf");
     }
     else
     {
@@ -555,8 +555,7 @@ static int _verify_setting(int flag, int index, void* pStruct, int structSize)
         return ICOS_FAILURE;
     }

-
-
+    return ICOS_SUCCESS;
 }

透過 web 啟動後沒有發現 ripd 的 process

直接在 shell 執行 - ripd -d -u root -f /etc/icos/rip_2g/quagga_ripd.conf

root@52XXZ:~# ripd -d -u root -f /etc/icos/rip_2g/quagga_ripd.conf
ripd: invalid option -- u
Try `ripd --help' for more information.
root@52XXZ:~#

沒有 -u 這個 option

check 一下 ripd 的版本

root@52XXZ:~# ripd -v
ripd version 0.94 (mips-openwrt-linux)
Copyright 1996-2001, Kunihiro Ishiguro

check 一下 zebra 的版本

root@52XXZ:~# zebra -v
zebra version 1.1.0
Copyright 1996-2005 Kunihiro Ishiguro, et al.
configured with:
        --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix= --program-suffix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --localstatedir=/var/run/quagga --sysconfdir=/etc/quagga/ --enable-shared --disable-static --enable-user=network --enable-group=network --enable-multipath=8 --disable-ospfclient --disable-capabilities --disable-doc --enable-zebra --disable-ospfd --disable-bgpd --disable-isisd --disable-ospf6d --disable-ripd --enable-ripngd --disable-vtysh

在 proscend 外層使用 make menuconfig 會發現 quagga-ripd 沒被選起來

image

直接修改 52xxz_defconfig

@@ -1129,15 +1129,15 @@ CONFIG_PACKAGE_miniupnpc=y
 #
 CONFIG_PACKAGE_ip=y
 CONFIG_PACKAGE_quagga=y
-# CONFIG_PACKAGE_quagga-bgpd is not set
+CONFIG_PACKAGE_quagga-bgpd=y
 # CONFIG_PACKAGE_quagga-isisd is not set
 # CONFIG_PACKAGE_quagga-libospf is not set
 CONFIG_PACKAGE_quagga-libzebra=y
 # CONFIG_PACKAGE_quagga-ospf6d is not set
 # CONFIG_PACKAGE_quagga-ospfd is not set
-# CONFIG_PACKAGE_quagga-ripd is not set
-CONFIG_PACKAGE_quagga-ripngd=y
-# CONFIG_PACKAGE_quagga-vtysh is not set
+CONFIG_PACKAGE_quagga-ripd=y
+# CONFIG_PACKAGE_quagga-ripngd is not set
+CONFIG_PACKAGE_quagga-vtysh=y
 # CONFIG_PACKAGE_relayd is not set

 #

直接在 proscend 外層 make distclean 後再 source proenv.sh

使用 time make 作 make 順便量一下時間

1140

不過那個 0.94 版的 ripd 是怎麼回事

root@52XXZ:~# ripd -v
ripd version 0.94 (mips-openwrt-linux)
Copyright 1996-2001, Kunihiro Ishiguro

將 52XXZ 的 quagga 升級成跟 M360P 的 quagga 版本一樣之前

也不是 0.94 而是 0.99

希望待會的 ripd 不會受影響才好

1300

build 好了 - 耗時 77m43.143s

user@8de9e3d5af60:~$ time make
 ...
 make[1] world
 make[2] tools/install
 make[3] -C tools/m4 compile
 ...
 make[3] -C package/base-files install
 make[2] target/install
 make[3] -C target/linux install
 make[2] package/index

real    77m43.143s
user    59m50.292s
sys     13m34.557s
user@8de9e3d5af60:~$

進 proscend make distclean

make menuconfig... 勾選 debug

make... ok

upgrade via uboot - run update_fullimage... ok

check

zebra - 1.1.0

root@52XXZ:~# zebra -v
zebra version 1.1.0
Copyright 1996-2005 Kunihiro Ishiguro, et al.
configured with:
        --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix= --program-suffix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --localstatedir=/var/run/quagga --sysconfdir=/etc/quagga/ --enable-shared --disable-static --enable-user=network --enable-group=network --enable-multipath=8 --disable-ospfclient --disable-capabilities --disable-doc --enable-zebra --disable-ospfd --enable-bgpd --disable-isisd --disable-ospf6d --enable-ripd --disable-ripngd --enable-vtysh

ripd - 1.1.0

root@52XXZ:~# ripd -v
ripd version 1.1.0
Copyright 1996-2005 Kunihiro Ishiguro, et al.
configured with:
        --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix= --program-suffix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --localstatedir=/var/run/quagga --sysconfdir=/etc/quagga/ --enable-shared --disable-static --enable-user=network --enable-group=network --enable-multipath=8 --disable-ospfclient --disable-capabilities --disable-doc --enable-zebra --disable-ospfd --enable-bgpd --disable-isisd --disable-ospf6d --enable-ripd --disable-ripngd --enable-vtysh
root@52XXZ:~#

bgpd - 1.1.0

root@52XXZ:~# bgpd -v
bgpd version 1.1.0
Copyright 1996-2005 Kunihiro Ishiguro, et al.
configured with:
        --target=mips-openwrt-linux --host=mips-openwrt-linux --build=x86_64-linux-gnu --program-prefix= --program-suffix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls --localstatedir=/var/run/quagga --sysconfdir=/etc/quagga/ --enable-shared --disable-static --enable-user=network --enable-group=network --enable-multipath=8 --disable-ospfclient --disable-capabilities --disable-doc --enable-zebra --disable-ospfd --enable-bgpd --disable-isisd --disable-ospf6d --enable-ripd --disable-ripngd --enable-vtysh

很好

跟 M360P 版本一致了

透過 web 啟動

ps aux... PASS

root@52XXZ:~# ps aux | grep ripd
root      7264  0.0  0.7   2160   872 ?        Ss   11:54   0:00 ripd -d -u root -f /etc/icos/rip_2g/quagga_ripd.conf
root      8169  0.0  0.2   1812   364 ?        S    11:55   0:00 grep ripd

cat /tmp/ripd.log... PASS

root@52XXZ:~# cat /tmp/ripd.log
2018/01/10 11:54:34 RIP: RIPd 1.1.0 starting: vty@2602
2018/01/10 11:54:34 RIP: Redistribute new prefix 192.0.0.0.0/24 with nexthop 0.0.0.0 on the interface lan
2018/01/10 11:54:34 RIP: triggered update!
2018/01/10 11:54:36 RIP: update timer fire!

cat /var/run/quagga/ripd.pid... PASS

root@52XXZ:~# cat /var/run/quagga/ripd.pid
7264

可以進行 ripd 的測試了

先 commit 目前的成果

commit 127fd50f3d2d2634fe065314c7362619c9e4961d
Refs: [develop], {origin/develop}, {origin/HEAD}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 13:33:16 2018 +0800

    about the quagga package:
    - rm version 0.99.20
      - rm package/feeds/open_applications/quagga/*
      - rm dl/quagga-0.99.20.tar.gz
    - use version 1.1.0
      - add package/net/quagga/*
      - add dl/quagga-1.1.0.tar.gz
    - modify linux configuration
      - CONFIG_PACKAGE_quagga=y
      - CONFIG_PACKAGE_quagga-bgpd=y
      - CONFIG_PACKAGE_quagga-libzebra=y
      - CONFIG_PACKAGE_quagga-ripd=y
      - CONFIG_PACKAGE_quagga-vtysh=y
    - modify /etc/rc.local
      - `mkdir -p /var/run/quagga` since quagga needed
    - modify `proscend/mconfig/configs/52XXZ/0_GENERIC/defconfig`
      - `PROSRC_RIP_2G=y` for icos RIP module
    - modify zebra icos module
      - move the configuration file of zebra since our file system is read-only
    - modify rip icos module
      - move the configuration file of ripd since our file system is read-only

 52xxz_defconfig                                    |    8 +-
 dl/quagga-0.99.20.tar.gz                           |  Bin 2232520 -> 0 bytes
 dl/quagga-1.1.0.tar.gz                             |  Bin 0 -> 2870278 bytes
 package/feeds/open_applications/quagga/Makefile    |  263 --
 .../feeds/open_applications/quagga/files/quagga    |  335 ---
 .../open_applications/quagga/files/quagga.conf     |    7 -
 .../open_applications/quagga/files/quagga.init     |   11 -
 .../quagga/patches/110-fix_ipctl_forwarding.patch  |   25 -
 .../quagga/patches/120-quagga_manet.patch          |  895 ------
 .../quagga/patches/130-fix_cpp.patch               |   11 -
 .../quagga/patches/140-holdtimer-set.patch         |   22 -
 .../quagga/patches/150-no-cross-fs-link.patch      |   40 -
 .../quagga/patches/160-pgbgp.patch                 | 3095 --------------------
 .../quagga/patches/161-pgbgp-addon.patch           |  318 --
 .../quagga/patches/170-use-supported-pagers.patch  |   29 -
 .../patches/180-fix-lib-connect-memleak.patch      |   61 -
 .../quagga/patches/181-ospf-null-ptr-fix.patch     |   51 -
 .../quagga/patches/182-fix-bgpd-memleak.patch      |   20 -
 package/net/quagga/Makefile                        |  283 ++
 package/net/quagga/files/quagga                    |  335 +++
 package/net/quagga/files/quagga.conf               |    7 +
 package/net/quagga/files/quagga.init               |   11 +
 package/net/quagga/patches/140-holdtimer-set.patch |   22 +
 .../net/quagga/patches/150-no-cross-fs-link.patch  |   40 +
 .../quagga/patches/170-use-supported-pagers.patch  |   29 +
 proscend/base_fs/default/rootfs/etc/rc.local       |    3 +
 proscend/mconfig/configs/52XXZ/0_GENERIC/defconfig |    2 +-
 proscend/prosrc/icos/icoslib/rip_2g/rip_2g.c       |    9 +-
 proscend/prosrc/icos/icoslib/zebra/zebra.c         |   14 +-
 29 files changed, 748 insertions(+), 5198 deletions(-)

1335

52XXZ 並沒有支援 OSPF

所以 RIP 的 web page 需做調整

image

拿掉 Redistribute OSPF routes

image

搞定

上 code

commit 66319dfd3b4cacc1164794d39ab7f6473cad7405
Refs: [develop], {origin/develop}, {origin/HEAD}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 13:42:26 2018 +0800

    about the 'IP Routing / RIP' web page:
    - rm 'Redistribute OSPF routes' field

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

可以開始測試了

同時來準備 52XXZ 的 wiki 吧

1440

RIP 測過了

wiki 也順便寫了

再盤一下 52XXZ 剩什麼

  • BGP
    • 已有 web ui
    • 待測
  • GRE
    • 已有 web ui
    • 待測

來作 BGP

BGP web page 一樣有個 Redistribute OSPF routes

image

拿掉

image

再來是要改 BGP 的 configuration 位置 - proscend/prosrc/icos/icoslib/bgp/bgp.c

@@ -39,7 +39,7 @@
 #define BGP_DAEMON_PATH         "/usr/sbin/bgpd"
 #define BGP_DAEMON              "ospfd"
 #define BGP_ARGV                "-d -u root -f %s"
-#define BGP_CONFIGURATION_FILE  "/etc/quagga/bgpd.conf"
+#define BGP_CONFIGURATION_FILE  "/etc/icos/bgp/quagga_bgpd.conf"
 #define BGP_DEBUG_LOG           "/tmp/bgpd.log"


@@ -90,7 +90,7 @@ static int _make_configuration_file(bgp_t *setting)
 {
     _LOG_INFO("");

-    FILE *fp = fopen(BGP_CONFIGURATION_FILE, "w");
+    FILE *fp = fopen(BGP_CONFIGURATION_FILE, "w+");
     if (fp == 0)
     {
         _LOG_DEBUG("Failed to open file: '%s'", BGP_CONFIGURATION_FILE);
@@ -521,7 +521,7 @@ static int _apply(int flag, int index, void* pStruct, int structSize)
     {
         system("killall bgpd 1>/dev/null 2>&1");
         _make_configuration_file(setting);
-        system("bgpd -d -u root");
+        system("bgpd -d -u root -f /etc/icos/bgp/quagga_bgpd.conf");
     }
     else
     {

1520

bgp 測試也 PASS 了

commit 5e8004b4d2e6f2775b3f7319eb4bfdf714d79382
Refs: [develop], {origin/develop}, {origin/HEAD}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 15:22:37 2018 +0800

    modify bgp:
    - move the configuration file of bgpd since our file system is read-only
    - rm 'Redistribute OSPF routes' field at web page

 proscend/prosrc/icos/icoslib/bgp/bgp.c   | 6 +++---
 proscend/prosrc/www/app/feature/bgp.html | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

1525

回到 M360P

pull latest code... ok

build image... ok

補一下 Lock LTE Bands 的 Hin

image

上 code

commit 03e7a2b3c5b2b0e90e3440706b7bf2844e8ddb8a
Refs: [release/v0.08], {origin/release/v0.08}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 15:42:47 2018 +0800

    add the 'Hint' field into 'LTE / Lock Bands' web page

 proscend/prosrc/www/app/feature/lock_bands.html | 2 ++
 1 file changed, 2 insertions(+)

1635

ariel 的 LTE / Lock Bands 還要改一下 design

commit 5a2da0ecb5c7cb7e9cef1b98c25d51713788bfe7
Refs: [release/v0.08], {origin/release/v0.08}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 16:35:45 2018 +0800

    re-design 'LTE / Lock Bands' requested by original designer

 proscend/prosrc/www/app/feature/lock_bands.html    | 35 +++++++++++-----------
 proscend/prosrc/www/app/feature/lock_bands.js      | 31 +++++--------------
 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 +
 proscend/prosrc/www/brand_nobrand/brand/custom.css |  3 ++
 .../prosrc/www/brand_proscend/brand/custom.css     |  3 ++
 7 files changed, 35 insertions(+), 40 deletions(-)

再小修一下

commit 88e7d423e8a175378076a663c19132604bb43c17
Refs: [release/v0.08], {origin/release/v0.08}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 16:45:19 2018 +0800

    - remove debug information from javascript
    - fine tune the checkbox behaviour

 proscend/prosrc/www/app/feature/lock_bands.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

1700

ariel 發現 lock band 的功能如果不 reboot device 的話功能都無法正常動作

web ui 幫忙加一下 reboot 機制吧

commit 02c2023e6c74a205249152e68f8f29ad7b998940
Refs: [release/v0.08], {origin/release/v0.08}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 17:01:21 2018 +0800

    remind user to reboot to take effect

 proscend/prosrc/www/app/feature/lock_bands.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

1705

關於 M360P web upgrade 會停在 98% 的問題

我想到一個爛招 - 禮多人不怪

修改 proscend/prosrc/icos/script/FirmwareUpgrade.sh

@@ -88,6 +88,12 @@ function finish {
   log "\nfirmware upgrade shell script succeeded"
   log "finished"
   progress_ok "firmware upgrade succeeded"
+  sleep 2
+  log "finished"
+  progress_ok "firmware upgrade succeeded"
+  sleep 2
+  log "finished"
+  progress_ok "firmware upgrade succeeded"
 }

實際測測看才知道有沒有副作用

1720

測了十次都沒問題

上 code 讓大家一起測吧

commit ac2c2457604173c5badbf8fa16a7b6837586f9c8
Refs: [release/v0.08], {origin/release/v0.08}
Author: jeffrey <[email protected]>
Date:   Mon Oct 8 17:17:29 2018 +0800

    use a stupid way to solve the 'forever 98%' problem while upgrading via web
    - issue occuring rate around once per 16 times

 proscend/prosrc/icos/script/FirmwareUpgrade.sh | 6 ++++++
 1 file changed, 6 insertions(+)