Giter Club home page Giter Club logo

changtimwu.github.com's People

Contributors

changtimwu avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

changtimwu.github.com's Issues

tools

ssh -L 9000:192.168.1.120:80 [email protected]
or
ssh -p 2222 -L 9000:192.168.1.120:80 timac
or
ssh -p 2222 -L 9322:192.168.1.3:22 -L 9142:vbox:22 timac

then
http://localhost:9000

vnc over ssh
ssh -p 2222 -L 9000:localhost:5900 timac

then
using remote desk connect to localhost:9000

typhoon day

swixcore js

  • account sync
  • IP access support range
  • fix UI mispelling

peridot

  • save initial script on EEPROM
  • trace why no response on RMGMT
  • create libperidot and put some C code of basic reg read/write

WLAN

  • take a look how tomato physicially works
  • need to buy a new AP?
  • glibc openwrt

GO & WEB & RPC

  • net/rpc is too cumbersome
  • anyway to avoid repack args on both sides?

govreport hsrprot


Study the Protocol
High-availability Seamless Redundancy Protocol (HSR)

HSR is a Layer 2 redundancy protocol for Ethernet. HSR adds a header to each frame, and duplicates the frame, sending it along two directions of a ring. Nodes in the ring pass the frame along the ring, using the header to discard duplicates.

Example traffic

Ethernet II, Src: ZurichUn_15:77:84 (00:15:12:15:77:84), Dst: IntelCor_5c:22:42 (00:1b:21:5c:22:42)
...
High-availability Seamless Redundancy (IEC62439 Part 3 Chapter 5)
0001 .... .... .... = Path: 1
000. .... .... .... = Network id: 0
...1 .... .... .... = Lane id: Lane B (1)
LSDU size: 52 [correct]
Sequence number: 6679
Type: ARP (0x0806)
Address Resolution Protocol (reply)
...
Wireshark

The HSR dissector is fully functional. Supervision frames have the same format as in the related Parallel Redundancy Protocol, so they share a common dissector. The HSR dissector only handles the actual HSR header.

Example capture file

SampleCaptures/HSR-simple-supervision-and-1vdan-appearing.pcap
External links

HSR Wikipedia article.
Discussion


quite a lot running processes

 2139 ?        Ss     0:00 /bin/sh -e /usr/sbin/lcd-manager --daemon
 2237 ?        Ss     0:00 /usr/sbin/fcmd -l /usr/lib/fcmd -f -d /etc/fcmd -r
 2243 ?        Ssl    0:00 /usr/sbin/interface_manager -f -m switching_module ip_module ether
 2251 ?        Ssl    0:00 /usr/sbin/xr7_monitor -f
 2258 ?        Rs    12:15 /usr/sbin/flx_redundancy_supervision -f
 2264 ?        Ss     0:00 /usr/sbin/xr7_fwud -f -p dpd.ctrl
 2270 ?        Ss     0:00 /usr/sbin/xr7ptp -f
 2280 ?        Ssl    0:00 /usr/sbin/host_clock_adj -f

fcm related programs

root@xr7:/etc/rc2.d# ldd /usr/bin/fcm_manager 
    libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x76dbd000)
    /lib/ld-linux.so.3 (0x76ef9000)

root@xr7:/etc/rc2.d# ldd /usr/sbin/fcmd
    libfcmd.so.0 => /usr/lib/libfcmd.so.0 (0x76f26000)
    libxml2.so.2 => /usr/lib/arm-linux-gnueabi/libxml2.so.2 (0x76df4000)
    libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x76cbd000)
    libxslt.so.1 => /usr/lib/arm-linux-gnueabi/libxslt.so.1 (0x76c7d000)
    librt.so.1 => /lib/arm-linux-gnueabi/librt.so.1 (0x76c6e000)
    libdl.so.2 => /lib/arm-linux-gnueabi/libdl.so.2 (0x76c63000)
    libz.so.1 => /lib/arm-linux-gnueabi/libz.so.1 (0x76c45000)
    liblzma.so.5 => /lib/arm-linux-gnueabi/liblzma.so.5 (0x76c1c000)
    libm.so.6 => /lib/arm-linux-gnueabi/libm.so.6 (0x76b73000)
    /lib/ld-linux.so.3 (0x76f4b000)
    libpthread.so.0 => /lib/arm-linux-gnueabi/libpthread.so.0 (0x76b53000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabi/libgcc_s.so.1 (0x76b29000)

command arguments

root@xr7:/etc/rc2.d# fcm_manager -h
fcm_manager [-q] -h [-r <file>] [-n <node>] [-w <file>] -s
    -r  Send contents of <file>
    -n  Send to <node>
    -w  Write reply to <file>
    -s  Use SSL
    -q  Quiet (use first)
    -h  This help

root@xr7:/etc/rc2.d# fcmd -h
fcmd [-d <dir>] [-c <file>] [-h] -f
    -d <dir>    Use config dir <dir>
    -l <dir>    Use library dir <dir>
    -c <file>   fcmd config file
    -f      fork as daemon
    -r      validate also replies
    -h      This help
Signals
    USR1        Enable logging debug messages


  • config file and current config
root@xr7:/etc/rc2.d# ls /etc/fcmd/
XMLSchema.xsd              ip                 switching_module.xsd
catalog.xml            ip_module.xsd              sync
clk_config.xsd             managers.conf              sync_module.xsd
clk_config_order.xslt          netconf.xsd            sync_order.xslt
config_order.xslt          ptp_common.xsd             sync_status.xsd
ethernet               ptp_config.xsd             vlan
ethernet_module.xsd        ptp_config_order.xslt          vlan_config.xsd
flexibilis_common.xsd          redundancy_supervision         vlan_module.xsd
flexibilis_config.xsd          redundancy_supervision_module.xsd  xml.xsd
flexibilis_config_default.xsd  redundancy_supervision_status.xsd  xr7_fwud
flexibilis_config_order.xslt   routing                xr7_monitor
fwud_config.xsd            routing_module.xsd         xr7_monitor_module.xsd
fwud_module.xsd            switching              xr7_monitor_status.xsd
root@xr7:/etc/rc2.d# ls /etc/fcmd/switching/
candidate  factory  rollback  running  startup

ls -al /var/run/fcmd/     
total 0
drwxr-xr-x 10 root root 200 Jan  1 02:00 .
drwxr-xr-x 10 root root 400 Jan  1 02:00 ..
drwxr-xr-x  5 root root 100 Jan  1 02:00 ethernet
drwxr-xr-x  5 root root 100 Jan  1 02:00 ip
drwxr-xr-x  5 root root 100 Jan  1 02:00 redundancy_supervision
drwxr-xr-x  5 root root 100 Jan  1 02:00 routing
drwxr-xr-x  5 root root 100 Jan  1 02:00 switching
drwxr-xr-x  5 root root 100 Jan  1 02:00 sync
drwxr-xr-x  5 root root 100 Jan  1 02:00 vlan
drwxr-xr-x  5 root root 100 Jan  1 02:00 xr7_fwud


start up scripts

root@xr7:/etc/rc2.d# ls
README       S02cron         S03xr7-system   S80fcmd            S99xr7-boot-finished
S01bootlogs  S02virtual-xr7  S04lcd-manager  S82xr7ptp
S01motd      S03rc.local     S16ssh      S85flx-host-clock-adj
S01rsyslog   S03rmnologin    S75sudo         S92tomcat7

quite a lot sockets

root@xr7:/etc/init.d# netstat --all --program        
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost:5454          *:*                     LISTEN      2237/fcmd       
tcp        0      0 *:ssh                   *:*                     LISTEN      2160/sshd       
tcp        0      0 localhost:8005          *:*                     LISTEN      2313/java       
tcp        0      0 192.168.7.2:ssh         192.168.7.111:57801     ESTABLISHED 2514/0          
tcp        0      0 localhost:5454          localhost:39742         ESTABLISHED 2237/fcmd       
tcp        0      0 localhost:39742         localhost:5454          ESTABLISHED 2313/java       
tcp6       0      0 [::]:http               [::]:*                  LISTEN      2313/java       
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      2160/sshd       
tcp6       0      0 [::]:https              [::]:*                  LISTEN      2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58201         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58179         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58180         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58178         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58198         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58166         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58200         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58202         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58190         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58181         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58199         ESTABLISHED 2313/java       
udp        0      0 *:319                   *:*                                 2270/xr7ptp     
udp        0      0 *:320                   *:*                                 2270/xr7ptp     

check linux domain socket

Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
unix  7      [ ]         DGRAM                    806      1976/rsyslogd       /dev/log
unix  2      [ ACC ]     SEQPACKET  LISTENING     3749     2237/fcmd           @fcm_socket
unix  2      [ ACC ]     SEQPACKET  LISTENING     244      660/udevd           /run/udev/control
unix  3      [ ]         SEQPACKET  CONNECTED     3851     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     4275     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     3848     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     3831     2243/interface_mana 
unix  3      [ ]         DGRAM                    2966     660/udevd           
unix  3      [ ]         SEQPACKET  CONNECTED     4273     2264/xr7_fwud       
unix  2      [ ]         DGRAM                    4257     2251/xr7_monitor    
unix  3      [ ]         SEQPACKET  CONNECTED     3885     2270/xr7ptp         
unix  3      [ ]         SEQPACKET  CONNECTED     3832     2237/fcmd           @fcm_socket
unix  3      [ ]         DGRAM                    2965     660/udevd           
unix  3      [ ]         SEQPACKET  CONNECTED     4274     2264/xr7_fwud       
unix  3      [ ]         SEQPACKET  CONNECTED     3843     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     3856     2237/fcmd           @fcm_socket
unix  2      [ ]         DGRAM                    3894     2258/flx_redundancy 
unix  3      [ ]         SEQPACKET  CONNECTED     4272     2264/xr7_fwud       
unix  3      [ ]         SEQPACKET  CONNECTED     4285     2237/fcmd           @fcm_socket
unix  2      [ ]         DGRAM                    3952     2514/0              
unix  2      [ ]         DGRAM                    4312     2270/xr7ptp         
unix  3      [ ]         SEQPACKET  CONNECTED     3842     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     4252     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     3867     2258/flx_redundancy 
unix  3      [ ]         SEQPACKET  CONNECTED     3852     2237/fcmd           @fcm_socket
unix  2      [ ]         DGRAM                    3830     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     4259     2251/xr7_monitor    
unix  3      [ ]         SEQPACKET  CONNECTED     3847     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     3864     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     4268     2237/fcmd           @fcm_soc

  • total files
root@xr7:~# ls /proc/driver/flx_frs/
device00_adapter_registers  device00_ipo_registers   device00_vlan_config_registers
device00_common_registers   device00_port_registers  statistic_device00
root@xr7:~# ls /proc/driver/flx_time/
component_00_registers

  • /proc/driver/flx_frs/device00_adapter_registers
Adapter registers of device 0      (REG):   PORT0   PORT1   PORT2   PORT3

ID              (0x0000):   0x0000  0x01b2  0x01b2  0x01b2
Link status         (0x0001):   0x4000  0x0001  0x0000  0x0001
GMII transmit clock     (0x0002):     -       -       -       -   
PCS control         (0x0020):     -     0x1140  0x1140  0x1140
PCS status          (0x0021):     -     0x00ad  0x0089  0x00ad
PCS dev_ability         (0x0024):     -     0x4020  0x0020  0x4020
PCS partner_ability     (0x0025):     -     0x4020  0x0000  0x4020
PCS if_mode         (0x0034):     -     0x0000  0x0000  0x0000

  • /proc/driver/flx_frs/device00_common_registers
Common Registers of device 0:
FRS ID0             (0x0000): 0x0000
FRS ID1             (0x0001): 0x4000
FRS configuration ID        (0x0002):    206
FRS configuration SVN ID    (0x0003):  38661
FRS body SVN version        (0x0004):  38631
FRS General         (0x0008): 0x1602
FRS FRS_REG_CMEM_FILL_LEVEL (0x000a):      0
FRS FRS_REG_DMEM_FILL_LEVEL (0x000b):    119
FRS FRS_REG_SEQ_MEM_FILL_LEVEL  (0x000c):    248
FRS FRS_REG_SEQ_MEM_DEALLOC_ERR (0x000c):      0
FRS Aging           (0x0010): 0x0103
FRS AGING_BASE_TIME_LO      (0x0011): 0xa11f
FRS AGING_BASE_TIME_HI      (0x0012): 0x0007
FRS_REG_AUTH_STATUS     (0x0013): 0x006f
FRS_REG_TS_CTRL_TX      (0x0014): 0x0000
FRS_REG_TS_CTRL_RX      (0x0015): 0x000f
FRS_REG_INTMASK         (0x0016): 0x0003
FRS_REG_INTSTAT         (0x0017): 0x0000

FRS_TX_TS_0 [s ns]   (0x1002 0x1000): 0x00000000 0x00000000
FRS_TX_TS_1 [s ns]   (0x1042 0x1040): 0x00000000 0x00000000
FRS_TX_TS_2 [s ns]   (0x1082 0x1080): 0x00000000 0x00000000
FRS_TX_TS_3 [s ns]   (0x10c2 0x10c0): 0x00000000 0x00000000

FRS_RX_TS_0 [s ns]   (0x1102 0x1100): 0x000001ba 0x04ddcb30
FRS_RX_TS_1 [s ns]   (0x1142 0x1140): 0x000001ba 0x15191018
FRS_RX_TS_2 [s ns]   (0x1182 0x1180): 0x000001b9 0x3567e880
FRS_RX_TS_3 [s ns]   (0x11c2 0x11c0): 0x000001ba 0x04ca1068

  • /proc/driver/flx_frs/device00_ipo_registers
IPO registers of device 0   (REG):      PORT0   PORT1   PORT2   PORT3

ETH_ADDR_CFG( 0)        (0x4000):   0x00c1  0x00c1  0x00c1  0x00c1
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4001):   0x0006  0x0007  0x0007  0x0000
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4002):   0x0000  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_0     (0x4004):   0x1501  0x1501  0x1501  0x1501
PORT_REG_ETH_ADDR_1     (0x4005):   0x004e  0x004e  0x004e  0x004e
PORT_REG_ETH_ADDR_2     (0x4006):   0x0001  0x0001  0x0001  0x0001

ETH_ADDR_CFG( 1)        (0x4010):   0x0000  0x20c1  0x20c1  0x20c1
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4011):   0x0000  0xffff  0xffff  0xffff
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4012):   0x0000  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_0     (0x4014):   0x0000  0x1b01  0x1b01  0x1b01
PORT_REG_ETH_ADDR_1     (0x4015):   0x0000  0x0019  0x0019  0x0019
PORT_REG_ETH_ADDR_2     (0x4016):   0x0000  0x0000  0x0000  0x0000

ETH_ADDR_CFG( 2)        (0x4020):   0x0cc1  0x00c1  0x00c1  0x00c1
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4021):   0xffff  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4022):   0x0000  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_0     (0x4024):   0x8001  0x8001  0x8001  0x8001
PORT_REG_ETH_ADDR_1     (0x4025):   0x00c2  0x00c2  0x00c2  0x00c2
PORT_REG_ETH_ADDR_2     (0x4026):   0x0e00  0x0e00  0x0e00  0x0e00

ETH_ADDR_CFG( 3)        (0x4030):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4031):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4032):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_0     (0x4034):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_1     (0x4035):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_2     (0x4036):   0x0000  0x0000  0x0000  0x0000

port registers

  • /proc/driver/flx_frs/device00_port_registers
Port registers of device 0     (REG):   PORT0   PORT1   PORT2   PORT3

State               (0x0000):   0x0204  0x0120  0x0002  0x0120
VLAN                (0x0008):   0x8fff  0x8fff  0x8fff  0x8fff
VLAN0_MAP           (0x0009):   0x0000  0x0000  0x0000  0x0000
FWD_PORT_MASK           (0x000a):   0x0000  0x0000  0x0000  0x0000
VLAN_PRIO           (0x000b):   0xfa50  0xfa50  0xfa50  0xfa50
HSR_PORT_CFG            (0x1000):   0x0000  0x0001  0x0401  0x0000
PORT_REG_PTP_DELAY_SN       (0x2000):   0x0000  0x0000  0x0000  0x0000
PORT_REG_PTP_DELAY_NSL      (0x2001):   0x0000  0x01c9  0x0000  0x0000
PORT_REG_PTP_DELAY_NSH      (0x2002):   0x0000  0x0000  0x0000  0x0000

  • /proc/driver/flx_frs/device00_vlan_config_registers
VLAN config Registers of device 0:
FRS VLAN(0) (0x2000): 0x000f
FRS VLAN(1) (0x2001): 0x000f
FRS VLAN(2) (0x2002): 0x000f
FRS VLAN(3) (0x2003): 0x000f
FRS VLAN(4) (0x2004): 0x000f
FRS VLAN(5) (0x2005): 0x000f
FRS VLAN(6) (0x2006): 0x000f
FRS VLAN(7) (0x2007): 0x000f
FRS VLAN(8) (0x2008): 0x000f
FRS VLAN(9) (0x2009): 0x000f
FRS VLAN(10)    (0x200a): 0x000f
FRS VLAN(11)    (0x200b): 0x000f

  • /proc/driver/flx_frs/statistic_device00
Statistic of device 0:
RX tstamp:  0x0000079a
TX tstamp:  0x00000000
RX error:   0x00000000
Congested:  0x00000000

Port statistics                (REG):        PORT0       PORT1       PORT2       PORT3

RX good octets          (0x3100):   0x00000077  0x00000158  0x00000000  0x00000000
RX bad octets           (0x3102):   0x00000000  0x00000000  0x00000000  0x00000000
RX unicast frames       (0x3104):   0x00000001  0x00000002  0x00000000  0x00000000
RX broadcast frames     (0x3106):   0x00000000  0x00000000  0x00000000  0x00000000
RX multicast frames     (0x3108):   0x00000000  0x00000002  0x00000000  0x00000000
RX undersize frames     (0x310a):   0x00000000  0x00000000  0x00000000  0x00000000
RX fragment frames      (0x310c):   0x00000000  0x00000000  0x00000000  0x00000000
RX oversize frames      (0x310e):   0x00000000  0x00000000  0x00000000  0x00000000
RX error frames         (0x3112):   0x00000000  0x00000000  0x00000000  0x00000000
RX CRC error frames     (0x3114):   0x00000000  0x00000000  0x00000000  0x00000000

RX good HSR/PRP frames      (0x3122):   0x00000000  0x00000002  0x00000000  0x00000000
RX PRP wrong LAN frames     (0x3124):   0x00000000  0x00000000  0x00000000  0x00000000
RX HSR/PRP duplicate drop   (0x3126):   0x00000000  0x00000000  0x00000000  0x00000000

TX octets           (0x3140):   0x000000be  0x000000c4  0x00000000  0x00000000
TX unicast frames       (0x3142):   0x00000002  0x00000001  0x00000000  0x00000000
TX broadcast frames     (0x3144):   0x00000000  0x00000000  0x00000000  0x00000000
TX multicast frames     (0x3146):   0x00000000  0x00000001  0x00000000  0x00000000

TX HSR/PRP frames       (0x3148):   0x00000000  0x00000001  0x00000000  0x00000000

TX priority queue full drop (0x3160):   0x00000000  0x00000000  0x00000000  0x00000000

protocol stack
2014-12-29 9 26 47


2014-12-29 9 43 31


2014-12-29 9 43 00

2014-12-29 9 41 44

2014-12-29 9 40 43

2014-12-29 9 42 17

2014-12-29 9 42 10

2014-12-29 9 44 00

2014-12-29 9 44 41

2014-12-29 9 45 05

2014-12-29 9 45 27

UCI, LUCI, WEB

better get familiar with uci before luci
http://wiki.openwrt.org/doc/techref/uci

the following items should be covered

  • GO-UCI -- Go bindings of libuci. APIs should be like luci model APIs
  • jUCI -- uci structure <-> json conversion.
  • rest-UCI -- web apis for UCI making UCI rewrite as web service. general UCI read/write would be represented in REST sematics.

govreport hsrprot


Study the Protocol
High-availability Seamless Redundancy Protocol (HSR)

HSR is a Layer 2 redundancy protocol for Ethernet. HSR adds a header to each frame, and duplicates the frame, sending it along two directions of a ring. Nodes in the ring pass the frame along the ring, using the header to discard duplicates.

Example traffic

Ethernet II, Src: ZurichUn_15:77:84 (00:15:12:15:77:84), Dst: IntelCor_5c:22:42 (00:1b:21:5c:22:42)
...
High-availability Seamless Redundancy (IEC62439 Part 3 Chapter 5)
0001 .... .... .... = Path: 1
000. .... .... .... = Network id: 0
...1 .... .... .... = Lane id: Lane B (1)
LSDU size: 52 [correct]
Sequence number: 6679
Type: ARP (0x0806)
Address Resolution Protocol (reply)
...
Wireshark

The HSR dissector is fully functional. Supervision frames have the same format as in the related Parallel Redundancy Protocol, so they share a common dissector. The HSR dissector only handles the actual HSR header.

Example capture file

SampleCaptures/HSR-simple-supervision-and-1vdan-appearing.pcap
External links

HSR Wikipedia article.
Discussion


quite a lot running processes

 2139 ?        Ss     0:00 /bin/sh -e /usr/sbin/lcd-manager --daemon
 2237 ?        Ss     0:00 /usr/sbin/fcmd -l /usr/lib/fcmd -f -d /etc/fcmd -r
 2243 ?        Ssl    0:00 /usr/sbin/interface_manager -f -m switching_module ip_module ether
 2251 ?        Ssl    0:00 /usr/sbin/xr7_monitor -f
 2258 ?        Rs    12:15 /usr/sbin/flx_redundancy_supervision -f
 2264 ?        Ss     0:00 /usr/sbin/xr7_fwud -f -p dpd.ctrl
 2270 ?        Ss     0:00 /usr/sbin/xr7ptp -f
 2280 ?        Ssl    0:00 /usr/sbin/host_clock_adj -f

fcm related programs

root@xr7:/etc/rc2.d# ldd /usr/bin/fcm_manager 
    libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x76dbd000)
    /lib/ld-linux.so.3 (0x76ef9000)

root@xr7:/etc/rc2.d# ldd /usr/sbin/fcmd
    libfcmd.so.0 => /usr/lib/libfcmd.so.0 (0x76f26000)
    libxml2.so.2 => /usr/lib/arm-linux-gnueabi/libxml2.so.2 (0x76df4000)
    libc.so.6 => /lib/arm-linux-gnueabi/libc.so.6 (0x76cbd000)
    libxslt.so.1 => /usr/lib/arm-linux-gnueabi/libxslt.so.1 (0x76c7d000)
    librt.so.1 => /lib/arm-linux-gnueabi/librt.so.1 (0x76c6e000)
    libdl.so.2 => /lib/arm-linux-gnueabi/libdl.so.2 (0x76c63000)
    libz.so.1 => /lib/arm-linux-gnueabi/libz.so.1 (0x76c45000)
    liblzma.so.5 => /lib/arm-linux-gnueabi/liblzma.so.5 (0x76c1c000)
    libm.so.6 => /lib/arm-linux-gnueabi/libm.so.6 (0x76b73000)
    /lib/ld-linux.so.3 (0x76f4b000)
    libpthread.so.0 => /lib/arm-linux-gnueabi/libpthread.so.0 (0x76b53000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabi/libgcc_s.so.1 (0x76b29000)

command arguments

root@xr7:/etc/rc2.d# fcm_manager -h
fcm_manager [-q] -h [-r <file>] [-n <node>] [-w <file>] -s
    -r  Send contents of <file>
    -n  Send to <node>
    -w  Write reply to <file>
    -s  Use SSL
    -q  Quiet (use first)
    -h  This help

root@xr7:/etc/rc2.d# fcmd -h
fcmd [-d <dir>] [-c <file>] [-h] -f
    -d <dir>    Use config dir <dir>
    -l <dir>    Use library dir <dir>
    -c <file>   fcmd config file
    -f      fork as daemon
    -r      validate also replies
    -h      This help
Signals
    USR1        Enable logging debug messages


  • config file and current config
root@xr7:/etc/rc2.d# ls /etc/fcmd/
XMLSchema.xsd              ip                 switching_module.xsd
catalog.xml            ip_module.xsd              sync
clk_config.xsd             managers.conf              sync_module.xsd
clk_config_order.xslt          netconf.xsd            sync_order.xslt
config_order.xslt          ptp_common.xsd             sync_status.xsd
ethernet               ptp_config.xsd             vlan
ethernet_module.xsd        ptp_config_order.xslt          vlan_config.xsd
flexibilis_common.xsd          redundancy_supervision         vlan_module.xsd
flexibilis_config.xsd          redundancy_supervision_module.xsd  xml.xsd
flexibilis_config_default.xsd  redundancy_supervision_status.xsd  xr7_fwud
flexibilis_config_order.xslt   routing                xr7_monitor
fwud_config.xsd            routing_module.xsd         xr7_monitor_module.xsd
fwud_module.xsd            switching              xr7_monitor_status.xsd
root@xr7:/etc/rc2.d# ls /etc/fcmd/switching/
candidate  factory  rollback  running  startup

ls -al /var/run/fcmd/     
total 0
drwxr-xr-x 10 root root 200 Jan  1 02:00 .
drwxr-xr-x 10 root root 400 Jan  1 02:00 ..
drwxr-xr-x  5 root root 100 Jan  1 02:00 ethernet
drwxr-xr-x  5 root root 100 Jan  1 02:00 ip
drwxr-xr-x  5 root root 100 Jan  1 02:00 redundancy_supervision
drwxr-xr-x  5 root root 100 Jan  1 02:00 routing
drwxr-xr-x  5 root root 100 Jan  1 02:00 switching
drwxr-xr-x  5 root root 100 Jan  1 02:00 sync
drwxr-xr-x  5 root root 100 Jan  1 02:00 vlan
drwxr-xr-x  5 root root 100 Jan  1 02:00 xr7_fwud


start up scripts

root@xr7:/etc/rc2.d# ls
README       S02cron         S03xr7-system   S80fcmd            S99xr7-boot-finished
S01bootlogs  S02virtual-xr7  S04lcd-manager  S82xr7ptp
S01motd      S03rc.local     S16ssh      S85flx-host-clock-adj
S01rsyslog   S03rmnologin    S75sudo         S92tomcat7

quite a lot sockets

root@xr7:/etc/init.d# netstat --all --program        
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost:5454          *:*                     LISTEN      2237/fcmd       
tcp        0      0 *:ssh                   *:*                     LISTEN      2160/sshd       
tcp        0      0 localhost:8005          *:*                     LISTEN      2313/java       
tcp        0      0 192.168.7.2:ssh         192.168.7.111:57801     ESTABLISHED 2514/0          
tcp        0      0 localhost:5454          localhost:39742         ESTABLISHED 2237/fcmd       
tcp        0      0 localhost:39742         localhost:5454          ESTABLISHED 2313/java       
tcp6       0      0 [::]:http               [::]:*                  LISTEN      2313/java       
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      2160/sshd       
tcp6       0      0 [::]:https              [::]:*                  LISTEN      2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58201         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58179         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58180         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58178         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58198         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58166         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58200         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58202         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58190         ESTABLISHED 2313/java       
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58181         TIME_WAIT   -               
getnameinfo failed
getnameinfo failed
tcp6       0      0 [UNKNOWN]:https         [UNKNOWN]:58199         ESTABLISHED 2313/java       
udp        0      0 *:319                   *:*                                 2270/xr7ptp     
udp        0      0 *:320                   *:*                                 2270/xr7ptp     

check linux domain socket

Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
unix  7      [ ]         DGRAM                    806      1976/rsyslogd       /dev/log
unix  2      [ ACC ]     SEQPACKET  LISTENING     3749     2237/fcmd           @fcm_socket
unix  2      [ ACC ]     SEQPACKET  LISTENING     244      660/udevd           /run/udev/control
unix  3      [ ]         SEQPACKET  CONNECTED     3851     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     4275     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     3848     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     3831     2243/interface_mana 
unix  3      [ ]         DGRAM                    2966     660/udevd           
unix  3      [ ]         SEQPACKET  CONNECTED     4273     2264/xr7_fwud       
unix  2      [ ]         DGRAM                    4257     2251/xr7_monitor    
unix  3      [ ]         SEQPACKET  CONNECTED     3885     2270/xr7ptp         
unix  3      [ ]         SEQPACKET  CONNECTED     3832     2237/fcmd           @fcm_socket
unix  3      [ ]         DGRAM                    2965     660/udevd           
unix  3      [ ]         SEQPACKET  CONNECTED     4274     2264/xr7_fwud       
unix  3      [ ]         SEQPACKET  CONNECTED     3843     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     3856     2237/fcmd           @fcm_socket
unix  2      [ ]         DGRAM                    3894     2258/flx_redundancy 
unix  3      [ ]         SEQPACKET  CONNECTED     4272     2264/xr7_fwud       
unix  3      [ ]         SEQPACKET  CONNECTED     4285     2237/fcmd           @fcm_socket
unix  2      [ ]         DGRAM                    3952     2514/0              
unix  2      [ ]         DGRAM                    4312     2270/xr7ptp         
unix  3      [ ]         SEQPACKET  CONNECTED     3842     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     4252     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     3867     2258/flx_redundancy 
unix  3      [ ]         SEQPACKET  CONNECTED     3852     2237/fcmd           @fcm_socket
unix  2      [ ]         DGRAM                    3830     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     4259     2251/xr7_monitor    
unix  3      [ ]         SEQPACKET  CONNECTED     3847     2243/interface_mana 
unix  3      [ ]         SEQPACKET  CONNECTED     3864     2237/fcmd           @fcm_socket
unix  3      [ ]         SEQPACKET  CONNECTED     4268     2237/fcmd           @fcm_soc

  • total files
root@xr7:~# ls /proc/driver/flx_frs/
device00_adapter_registers  device00_ipo_registers   device00_vlan_config_registers
device00_common_registers   device00_port_registers  statistic_device00
root@xr7:~# ls /proc/driver/flx_time/
component_00_registers

  • /proc/driver/flx_frs/device00_adapter_registers
Adapter registers of device 0      (REG):   PORT0   PORT1   PORT2   PORT3

ID              (0x0000):   0x0000  0x01b2  0x01b2  0x01b2
Link status         (0x0001):   0x4000  0x0001  0x0000  0x0001
GMII transmit clock     (0x0002):     -       -       -       -   
PCS control         (0x0020):     -     0x1140  0x1140  0x1140
PCS status          (0x0021):     -     0x00ad  0x0089  0x00ad
PCS dev_ability         (0x0024):     -     0x4020  0x0020  0x4020
PCS partner_ability     (0x0025):     -     0x4020  0x0000  0x4020
PCS if_mode         (0x0034):     -     0x0000  0x0000  0x0000

  • /proc/driver/flx_frs/device00_common_registers
Common Registers of device 0:
FRS ID0             (0x0000): 0x0000
FRS ID1             (0x0001): 0x4000
FRS configuration ID        (0x0002):    206
FRS configuration SVN ID    (0x0003):  38661
FRS body SVN version        (0x0004):  38631
FRS General         (0x0008): 0x1602
FRS FRS_REG_CMEM_FILL_LEVEL (0x000a):      0
FRS FRS_REG_DMEM_FILL_LEVEL (0x000b):    119
FRS FRS_REG_SEQ_MEM_FILL_LEVEL  (0x000c):    248
FRS FRS_REG_SEQ_MEM_DEALLOC_ERR (0x000c):      0
FRS Aging           (0x0010): 0x0103
FRS AGING_BASE_TIME_LO      (0x0011): 0xa11f
FRS AGING_BASE_TIME_HI      (0x0012): 0x0007
FRS_REG_AUTH_STATUS     (0x0013): 0x006f
FRS_REG_TS_CTRL_TX      (0x0014): 0x0000
FRS_REG_TS_CTRL_RX      (0x0015): 0x000f
FRS_REG_INTMASK         (0x0016): 0x0003
FRS_REG_INTSTAT         (0x0017): 0x0000

FRS_TX_TS_0 [s ns]   (0x1002 0x1000): 0x00000000 0x00000000
FRS_TX_TS_1 [s ns]   (0x1042 0x1040): 0x00000000 0x00000000
FRS_TX_TS_2 [s ns]   (0x1082 0x1080): 0x00000000 0x00000000
FRS_TX_TS_3 [s ns]   (0x10c2 0x10c0): 0x00000000 0x00000000

FRS_RX_TS_0 [s ns]   (0x1102 0x1100): 0x000001ba 0x04ddcb30
FRS_RX_TS_1 [s ns]   (0x1142 0x1140): 0x000001ba 0x15191018
FRS_RX_TS_2 [s ns]   (0x1182 0x1180): 0x000001b9 0x3567e880
FRS_RX_TS_3 [s ns]   (0x11c2 0x11c0): 0x000001ba 0x04ca1068

  • /proc/driver/flx_frs/device00_ipo_registers
IPO registers of device 0   (REG):      PORT0   PORT1   PORT2   PORT3

ETH_ADDR_CFG( 0)        (0x4000):   0x00c1  0x00c1  0x00c1  0x00c1
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4001):   0x0006  0x0007  0x0007  0x0000
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4002):   0x0000  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_0     (0x4004):   0x1501  0x1501  0x1501  0x1501
PORT_REG_ETH_ADDR_1     (0x4005):   0x004e  0x004e  0x004e  0x004e
PORT_REG_ETH_ADDR_2     (0x4006):   0x0001  0x0001  0x0001  0x0001

ETH_ADDR_CFG( 1)        (0x4010):   0x0000  0x20c1  0x20c1  0x20c1
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4011):   0x0000  0xffff  0xffff  0xffff
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4012):   0x0000  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_0     (0x4014):   0x0000  0x1b01  0x1b01  0x1b01
PORT_REG_ETH_ADDR_1     (0x4015):   0x0000  0x0019  0x0019  0x0019
PORT_REG_ETH_ADDR_2     (0x4016):   0x0000  0x0000  0x0000  0x0000

ETH_ADDR_CFG( 2)        (0x4020):   0x0cc1  0x00c1  0x00c1  0x00c1
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4021):   0xffff  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4022):   0x0000  0x0001  0x0001  0x0001
PORT_REG_ETH_ADDR_0     (0x4024):   0x8001  0x8001  0x8001  0x8001
PORT_REG_ETH_ADDR_1     (0x4025):   0x00c2  0x00c2  0x00c2  0x00c2
PORT_REG_ETH_ADDR_2     (0x4026):   0x0e00  0x0e00  0x0e00  0x0e00

ETH_ADDR_CFG( 3)        (0x4030):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_FWD_ALLOW (0x4031):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_FWD_MIRROR    (0x4032):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_0     (0x4034):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_1     (0x4035):   0x0000  0x0000  0x0000  0x0000
PORT_REG_ETH_ADDR_2     (0x4036):   0x0000  0x0000  0x0000  0x0000

port registers

  • /proc/driver/flx_frs/device00_port_registers
Port registers of device 0     (REG):   PORT0   PORT1   PORT2   PORT3

State               (0x0000):   0x0204  0x0120  0x0002  0x0120
VLAN                (0x0008):   0x8fff  0x8fff  0x8fff  0x8fff
VLAN0_MAP           (0x0009):   0x0000  0x0000  0x0000  0x0000
FWD_PORT_MASK           (0x000a):   0x0000  0x0000  0x0000  0x0000
VLAN_PRIO           (0x000b):   0xfa50  0xfa50  0xfa50  0xfa50
HSR_PORT_CFG            (0x1000):   0x0000  0x0001  0x0401  0x0000
PORT_REG_PTP_DELAY_SN       (0x2000):   0x0000  0x0000  0x0000  0x0000
PORT_REG_PTP_DELAY_NSL      (0x2001):   0x0000  0x01c9  0x0000  0x0000
PORT_REG_PTP_DELAY_NSH      (0x2002):   0x0000  0x0000  0x0000  0x0000

  • /proc/driver/flx_frs/device00_vlan_config_registers
VLAN config Registers of device 0:
FRS VLAN(0) (0x2000): 0x000f
FRS VLAN(1) (0x2001): 0x000f
FRS VLAN(2) (0x2002): 0x000f
FRS VLAN(3) (0x2003): 0x000f
FRS VLAN(4) (0x2004): 0x000f
FRS VLAN(5) (0x2005): 0x000f
FRS VLAN(6) (0x2006): 0x000f
FRS VLAN(7) (0x2007): 0x000f
FRS VLAN(8) (0x2008): 0x000f
FRS VLAN(9) (0x2009): 0x000f
FRS VLAN(10)    (0x200a): 0x000f
FRS VLAN(11)    (0x200b): 0x000f

  • /proc/driver/flx_frs/statistic_device00
Statistic of device 0:
RX tstamp:  0x0000079a
TX tstamp:  0x00000000
RX error:   0x00000000
Congested:  0x00000000

Port statistics                (REG):        PORT0       PORT1       PORT2       PORT3

RX good octets          (0x3100):   0x00000077  0x00000158  0x00000000  0x00000000
RX bad octets           (0x3102):   0x00000000  0x00000000  0x00000000  0x00000000
RX unicast frames       (0x3104):   0x00000001  0x00000002  0x00000000  0x00000000
RX broadcast frames     (0x3106):   0x00000000  0x00000000  0x00000000  0x00000000
RX multicast frames     (0x3108):   0x00000000  0x00000002  0x00000000  0x00000000
RX undersize frames     (0x310a):   0x00000000  0x00000000  0x00000000  0x00000000
RX fragment frames      (0x310c):   0x00000000  0x00000000  0x00000000  0x00000000
RX oversize frames      (0x310e):   0x00000000  0x00000000  0x00000000  0x00000000
RX error frames         (0x3112):   0x00000000  0x00000000  0x00000000  0x00000000
RX CRC error frames     (0x3114):   0x00000000  0x00000000  0x00000000  0x00000000

RX good HSR/PRP frames      (0x3122):   0x00000000  0x00000002  0x00000000  0x00000000
RX PRP wrong LAN frames     (0x3124):   0x00000000  0x00000000  0x00000000  0x00000000
RX HSR/PRP duplicate drop   (0x3126):   0x00000000  0x00000000  0x00000000  0x00000000

TX octets           (0x3140):   0x000000be  0x000000c4  0x00000000  0x00000000
TX unicast frames       (0x3142):   0x00000002  0x00000001  0x00000000  0x00000000
TX broadcast frames     (0x3144):   0x00000000  0x00000000  0x00000000  0x00000000
TX multicast frames     (0x3146):   0x00000000  0x00000001  0x00000000  0x00000000

TX HSR/PRP frames       (0x3148):   0x00000000  0x00000001  0x00000000  0x00000000

TX priority queue full drop (0x3160):   0x00000000  0x00000000  0x00000000  0x00000000

protocol stack
2014-12-29 9 26 47


functionality

2014-12-29 9 31 14


2014-12-29 9 32 28


2014-12-29 9 33 04


2014-12-29 9 33 39


gitlab and CI

gitlab

  • documents: http://doc.gitlab.com/ce/
  • oauth github for migration
    • user association with github git history
  • an new user should
  • basic concepts: member, group, project, menu convention

gitlab in docker

  • 1G memory required. DigitalOcean $10/mo not enough memory. Add swap.
fallocate -l 4G /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile   none    swap    sw    0   0" >> /etc/fstab
free -m
  • follow steps here. Now it's 8.5.1.
  • master docker-compose
    • up -d and down
  • docker-compose.yml
  • docker-compose logs
  • mail by mailgun. Creating new mail account gitadmin without google.
  • caddy for virtual hosting
  • backup directory

gitlab-ci

smartadmin

https://wrapbootstrap.com/theme/smartadmin-responsive-webapp-WB0573SK0

Tasks:

server

  • create program to add sample devices to db
  • create program to add sample users to db
  • write get handler for user/device query
  • JWT session
  • Koa

client

  • navigation menu item
  • hide/remove unused
  • device list page(page splitted)
  • big icon based aside menu
  • devices on google map
  • user list page(page splitted)
  • users on google map
  • trace login part
  • integrate JWT
  • restructure directory
  • rewrite with jade/coffee
  • reorg plugins with bower/npm

hosting

  • firebase always fail when too many files

koajs

koa source code 很短,

  • app.use 註冊進去的 middleware 都會記錄到 middleware array, ref1, ref2
  • middleware 必須是一個 generator
  • middleware invoke: 主要用到 koa-compose & co, ref
  • co 有個神奇效果, 把 callback function 直接變成用類似block function的觀念來運作
    • 轉換出來的 function, 每次 call 前面要加 yield, 原理就是 yield 會先 return 到上層, 上層會看真的 callback 結束後 resume 進來繼續執行, 所以用的人感覺好像自動會block住有結果才 return

manage build envs with docker

https://eng.erisindustries.com/tutorials/2015/06/17/docker-persistence/
#12

This works but i'd like to launch a xterm or x-desktop first.

FROM ubuntu:14.04

RUN apt-get update && apt-get install -y firefox

# Replace 1000 with your user / group id
RUN export uid=1000 gid=1000 && \
    mkdir -p /home/developer && \
    echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \
    echo "developer:x:${uid}:" >> /etc/group && \
    echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \
    chmod 0440 /etc/sudoers.d/developer && \
    chown ${uid}:${gid} -R /home/developer

USER developer
ENV HOME /home/developer
CMD /usr/bin/firefox
 socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
docker run -it --rm  -e DISPLAY=192.168.59.3:0 firefox

most interactive

docker run -it -e DISPLAY=192.168.59.3 firefox /bin/bash

create a CLI server

common way

CLI is a standalone terminal program. It communicates main program with IPC and manipulate the terminal( arrow key, tab key) by itself.
Running an instance(process) of CLI program is necessary to create a CLI session.
That means every client is coming with a well-prepared terminal before launching the CLI program.

I want

Implement CLI as a standard network server(tcp or unixsocket). Each client is a connection.

All terminal logic ( history, completion, hotkey) are handled at server side.
quagga's vtysh is similar .

Pros:

  • network centric
  • CLI can be built with main program(no IPC overhead)
  • no process/tty overhead at client side

Cons:

  • don't know how to handle terminal I/O at server side. Few examples show how to redirect libreadline to a network fd.

docker/kubernetes notes

--rm 可以讓 container exits 後就 rm 掉

docker run -it  busybox --rm 

exec 可以在現有container 執行程式

docker exec -it <container id> bash

本來在container 在background跑, 用 attach 把它移到foreground, 按 ^C 會導致 container stop

docker attach <container id>

detach hot-key: ctrl-p, ctrl-q, reference

show container 內的程式訊息

docker logs -f <container id>

看起來好像很好懂, 請注意細節當我們說 run 一個 container , 其實是 prepare 好一個 filesystem 並且 run 某個 fs 內的一支程式.

postgresql

psql to a postgresql host

psql -h remote.host.com -U username mydb

psql command list

  • \l -- list all database
  • \connect <db> -- connect to a database
  • \dt -- list all tables in current databse
  • \di -- list all indexes in current databse
  • \d <table> -- describe a table
  • \d <index> -- describe an index
  • select all gmail users and sort by created_at
select * from users where email like '%@gmail.com' order by created_at;

http://massive-js.readthedocs.org/en/latest/quick_start/
要有 id 當 primary key 的table才能用 db.tablename 這種語法存取

http://developer.olery.com/blog/goodbye-mongodb-hello-postgresql/
http://it-ebooks.info/book/4879/

peridot notes

/* RMU Mode: R28.10:8=00 choose P0 for Peridot */
RW U1 P27 R28 H00C0   /* switch global registers, global control 2 */
/* R4.9:8=01(std DSA) Port0*/
RW U1 P0 R4 H017f     /* switch registers, port 0, port control */

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.