目前分類:Ralink SDK (36)

瀏覽方式: 標題列表 簡短摘要

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

ip route add table 2 10.10.10.0/24 dev ppp0 src 10.10.10.173
ip route add table 2 default via 10.10.10.1 dev ppp0
ip rule add table 2 from 10.10.10.173/32
ip rule add table 2 from 192.168.180.0/24
ip route add table 2 192.168.180.0/24 dev br1 src 192.168.180.1
ip route add table 2 255.255.255.255 dev br1

參考


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

問題1

01:41:28 info pptp[23234]: Plugin pptp.so loaded.
01:41:28 info pptp[23234]: PPTP plugin version 2.4.2 compiled for pppd-2.4.2
01:41:28 notice pptp[23235]: pppd 2.4.2 started by admin, uid 0
01:41:28 warn pptp[23235]: PPTP: failed to setsockopt PPTP_SO_TIMEOUT (Operation not supported)
01:41:28 notice pptp[23236]: anon log[callmgr_main:pptp_callmgr.c:132]: IP: 178.162.193.233
01:41:28 notice pptp[23236]: anon log[callmgr_main:pptp_callmgr.c:136]: control connection
01:41:28 notice pptp[23236]: anon log[callmgr_main:pptp_callmgr.c:140]: unix_sock
01:41:28 notice pptp[23237]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 1 'Start-Control-Connection-Request'
01:41:29 notice pptp[23237]: anon log[ctrlp_disp:pptp_ctrl.c:737]: Received Start Control Connection Reply
01:41:29 notice pptp[23237]: anon log[ctrlp_disp:pptp_ctrl.c:771]: Client connection established.
01:41:29 notice pptp[23237]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 7 'Outgoing-Call-Request'
01:41:30 notice pptp[23237]: anon log[ctrlp_disp:pptp_ctrl.c:856]: Received Outgoing Call Reply.
01:41:30 notice pptp[23237]: anon log[ctrlp_disp:pptp_ctrl.c:895]: Outgoing call established (call ID 6, peer's call ID 768).
01:41:30 info pptp[23235]: Using interface ppp0
01:41:30 notice pptp[23235]: Connect: ppp0 <--> pptp (178.162.193.233)
01:41:31 info pptp[23235]: LCP terminated by peer (MPPE required but peer negotiation failed)
01:41:31 notice pptp[23237]: anon log[pptp_read_some:pptp_ctrl.c:542]: read returned zero, peer has closed
01:41:31 notice pptp[23237]: anon log[callmgr_main:pptp_callmgr.c:269]: Closing connection (shutdown)
01:41:31 notice pptp[23237]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 12 'Call-Clear-Request'
01:41:31 notice pptp[23237]: anon log[pptp_read_some:pptp_ctrl.c:542]: read returned zero, peer has closed
01:41:31 notice pptp[23237]: anon log[call_callback:pptp_callmgr.c:79]: Closing connection (call state)
01:41:31 info pptp[23235]: Terminating on signal 15.
01:41:34 notice pptp[23235]: Connection terminated.
01:41:34 info pptp[23235]: Exit.

解法

# echo "require-mppe" >> /etc/options.pptp

問題2

02:27:13 info pptp[4381]: Plugin pptp.so loaded.
02:27:13 info pptp[4381]: PPTP plugin version 2.4.2 compiled for pppd-2.4.2
02:27:13 notice pptp[4382]: pppd 2.4.2 started by admin, uid 0
02:27:13 warn pptp[4382]: PPTP: failed to setsockopt PPTP_SO_TIMEOUT (Operation not supported)
02:27:13 notice pptp[4383]: anon log[callmgr_main:pptp_callmgr.c:132]: IP: 178.162.193.233
02:27:13 notice pptp[4383]: anon log[callmgr_main:pptp_callmgr.c:136]: control connection
02:27:13 notice pptp[4383]: anon log[callmgr_main:pptp_callmgr.c:140]: unix_sock
02:27:13 notice pptp[4384]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 1 'Start-Control-Connection-Request'
02:27:13 notice pptp[4384]: anon log[ctrlp_disp:pptp_ctrl.c:737]: Received Start Control Connection Reply
02:27:13 notice pptp[4384]: anon log[ctrlp_disp:pptp_ctrl.c:771]: Client connection established.
02:27:14 notice pptp[4384]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 7 'Outgoing-Call-Request'
02:27:14 notice pptp[4384]: anon log[ctrlp_disp:pptp_ctrl.c:856]: Received Outgoing Call Reply.
02:27:14 notice pptp[4384]: anon log[ctrlp_disp:pptp_ctrl.c:895]: Outgoing call established (call ID 4, peer's call ID 34560).
02:27:14 info pptp[4382]: Using interface ppp0
02:27:14 notice pptp[4382]: Connect: ppp0 <--> pptp (178.162.193.233)
02:27:18 err pptp[4382]: MPPE required, but kernel has no support.
02:27:18 notice pptp[4382]: Connection terminated.
02:27:22 notice pptp[4384]: anon log[pptp_read_some:pptp_ctrl.c:542]: read returned zero, peer has closed
02:27:22 notice pptp[4384]: anon log[callmgr_main:pptp_callmgr.c:269]: Closing connection (shutdown)
02:27:22 notice pptp[4384]: anon log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 12 'Call-Clear-Request'
02:27:22 notice pptp[4384]: anon log[pptp_read_some:pptp_ctrl.c:542]: read returned zero, peer has closed
02:27:22 notice pptp[4384]: anon log[call_callback:pptp_callmgr.c:79]: Closing connection (call state)
02:27:22 info pptp[4382]: Terminating on signal 15.
02:27:22 info pptp[4382]: Exit.

解法

修改 source/user/ppp-2.4.2/pppd/ccp.c
static void
ccp_init(unit)
    int unit;
{
    fsm *f = &ccp_fsm[unit];

    f->unit = unit;
    f->protocol = PPP_CCP;
    f->callbacks = &ccp_callbacks;
    fsm_init(f);

    memset(&ccp_wantoptions[unit],  0, sizeof(ccp_options));
    memset(&ccp_gotoptions[unit],   0, sizeof(ccp_options));
    memset(&ccp_allowoptions[unit], 0, sizeof(ccp_options));
    memset(&ccp_hisoptions[unit],   0, sizeof(ccp_options));

    ccp_wantoptions[0].deflate = 1;
    ccp_wantoptions[0].deflate_size = DEFLATE_MAX_SIZE;
    ccp_wantoptions[0].deflate_correct = 1;
    ccp_wantoptions[0].deflate_draft = 1;
    ccp_allowoptions[0].deflate = 1;
    ccp_allowoptions[0].deflate_size = DEFLATE_MAX_SIZE;
    ccp_allowoptions[0].deflate_correct = 1;
    ccp_allowoptions[0].deflate_draft = 1;

    ccp_wantoptions[0].bsd_compress = 1;
    ccp_wantoptions[0].bsd_bits = BSD_MAX_BITS;
    ccp_allowoptions[0].bsd_compress = 1;
    ccp_allowoptions[0].bsd_bits = BSD_MAX_BITS;

    ccp_allowoptions[0].predictor_1 = 1;

    ccp_wantoptions[0].lzs = 0; /* Stac LZS  - will be enabled in the future */
    ccp_wantoptions[0].lzs_mode = LZS_MODE_SEQ;
    ccp_wantoptions[0].lzs_hists = 1;
    ccp_allowoptions[0].lzs = 0; /* Stac LZS  - will be enabled in the future */
    ccp_allowoptions[0].lzs_mode = LZS_MODE_SEQ;
    ccp_allowoptions[0].lzs_hists = 1;

#ifdef MPPE
    /* by default allow and request MPPC... */
    ccp_wantoptions[0].mppc = ccp_allowoptions[0].mppc = 1;

    /* ... and allow but don't request MPPE */
    ccp_allowoptions[0].mppe = 1;
    ccp_allowoptions[0].mppe_40 = 1;
    ccp_allowoptions[0].mppe_56 = 1;
    ccp_allowoptions[0].mppe_128 = 1;
    ccp_allowoptions[0].mppe_stateless = 1;
-    ccp_wantoptions[0].mppe = 0;
-    ccp_wantoptions[0].mppe_40 = 0;
-    ccp_wantoptions[0].mppe_56 = 0;
-    ccp_wantoptions[0].mppe_128 = 0;
-    ccp_wantoptions[0].mppe_stateless = 1;
+    ccp_wantoptions[0].mppe = 1;
+    ccp_wantoptions[0].mppe_40 = 1;
+    ccp_wantoptions[0].mppe_56 = 1;
+    ccp_wantoptions[0].mppe_128 = 1;
+    ccp_wantoptions[0].mppe_stateless = 1;
#endif /* MPPE */
}
結果是 router crash

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

問題1

# iptables -L -n -v
iptables v1.4.10: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

解法

[*] Networking support —->
          Networking options —->
          [*] Network packet filtering framework (Netfilter) —> 
                    IP: Netfilter Configuration —> 
                    [*] Packet filtering 
                    [*]     REJECT target support

問題2

# iptables -t mangle -L -v -n
iptables v1.4.10: can't initialize iptables table `mangle': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

解法

[*] Networking support —->
          Networking options —->
          [*] Network packet filtering framework (Netfilter) —> 
                    IP: Netfilter Configuration —> 
                    [*] Packet mangling

參考


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • emmc pconf 0x48 : 設定後可以從 emmc 開機,不需要 sd card。
  • tftp 84000000 uImage
  • mmc dev 0
  • mmc write 84000000 1000 5800

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • $ make menuconfig 
    config/mkconfig > config.in
    make -C /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/config/scripts/lxdialog all
    make[1]: Entering directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/config/scripts/lxdialog'
    /usr/bin/ld: cannot find -lncurses
    collect2: ld returned 1 exit status
    -e 
    >> Unable to find the Ncurses libraries.
    >>
    >> You must have Ncurses installed in order
    >> to use 'make menuconfig'
    
    make[1]: *** [ncurses] Error 1
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/config/scripts/lxdialog'
    make: *** [menuconfig] Error 2
    
    #sudo apt-get install libncurses5-dev
  • $ make
    ............
    ............
    checking dlfcn.h presence... yes
    checking for dlfcn.h... yes
    checking how to run the C++ preprocessor... /lib/cpp
    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details.
    make[2]: *** [Makefile] Error 1
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/lib/libgmp'
    make[1]: *** [_dir_libgmp] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/lib'
    make: *** [lib_only] Error 2
    
    #sudo apt-get install g++
  • $ make
    ............
    ............
    checking whether vsnprintf works... probably
    configure: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok
    checking whether sscanf needs writable input... no
    checking for struct pst_processor.psp_iticksperclktick... no
    checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin (see config.log for reasons).
    make[2]: *** [Makefile] Error 1
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/lib/libgmp'
    make[1]: *** [_dir_libgmp] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/lib'
    make: *** [lib_only] Error 2
    
    #sudo apt-get install m4
  • $ make
    ............
    ............
    bison -g --verbose  -v -d /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/lib/libipsecconf/parser.y
    /bin/bash: bison: command not found
    make[6]: *** [parser.tab.h] Error 127
    make[6]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/OBJ.linux.arm/lib/libipsecconf'
    make[5]: *** [programs] Error 1
    make[5]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/OBJ.linux.arm/lib'
    make[4]: *** [programs] Error 1
    make[4]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/OBJ.linux.arm'
    make[3]: *** [programs] Error 2
    make[3]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38'
    make[2]: *** [openswan-2.6.38] Error 2
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make: *** [user_only] Error 2
    
    #sudo apt-get install bison
  • $ make
    ............
    ............
    flex /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/lib/libipsecconf/parser.l
    /bin/bash: flex: command not found
    make[6]: *** [lex.yy.c] Error 127
    make[6]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/OBJ.linux.arm/lib/libipsecconf'
    make[5]: *** [programs] Error 1
    make[5]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/OBJ.linux.arm/lib'
    make[4]: *** [programs] Error 1
    make[4]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38/OBJ.linux.arm'
    make[3]: *** [programs] Error 2
    make[3]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/openswan-2.6.38'
    make[2]: *** [openswan-2.6.38] Error 2
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make: *** [user_only] Error 2
    
    #sudo apt-get install flex
  • $ make
    ............
    ............
    creating /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24/source3/exports/libnetapi.syms
    /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24/source3/script/mksyms.sh: 37: /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24/source3/script/mksyms.sh: gawk: not found
    Linking shared library bin/libnetapi.so.0
    /opt/buildroot-gcc483_arm/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.8.3/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld:/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24/source3/exports/libnetapi.syms:1: syntax error in VERSION script
    collect2: error: ld returned 1 exit status
    make[4]: *** [bin/libnetapi.so.0] Error 1
    make[4]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24/source3'
    make[3]: *** [all] Error 2
    make[3]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24'
    make[2]: *** [samba-4.0.24] Error 2
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make: *** [user_only] Error 2
    
    #sudo apt-get install gawk
  • $ make
    ............
    ............
    Linking shared library bin/libnetapi.so.0
    /opt/buildroot-gcc483_arm/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.8.3/../../../../arm-buildroot-linux-uclibcgnueabi/bin/ld:/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24/source3/exports/libnetapi.syms:1: syntax error in VERSION script
    collect2: error: ld returned 1 exit status
    make[4]: *** [bin/libnetapi.so.0] Error 1
    make[4]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24/source3'
    make[3]: *** [all] Error 2
    make[3]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/samba-4.0.24'
    make[2]: *** [samba-4.0.24] Error 2
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user'
    make: *** [user_only] Error 2
    
    ?????????
  • $ make
    ............
    ............
    WARNING: modpost: Found 12 section mismatch(es).
    To see full details build your kernel with:
    'make CONFIG_DEBUG_SECTION_MISMATCH=y'
      GEN     .version
      CHK     include/generated/compile.h
      UPD     include/generated/compile.h
      CC      init/version.o
      LD      init/built-in.o
    drivers/built-in.o: In function `fence_wait':
    hid-quirks.c:(.text+0x7849c): undefined reference to `sync_fence_wait'
    drivers/built-in.o: In function `timeline_destroy':
    hid-quirks.c:(.text+0x784b0): undefined reference to `sync_timeline_destroy'
    drivers/built-in.o: In function `fence_merge':
    hid-quirks.c:(.text+0x78514): undefined reference to `sync_fence_fdget'
    hid-quirks.c:(.text+0x78524): undefined reference to `sync_fence_fdget'
    hid-quirks.c:(.text+0x78544): undefined reference to `sync_fence_merge'
    hid-quirks.c:(.text+0x78554): undefined reference to `sync_fence_install'
    hid-quirks.c:(.text+0x7855c): undefined reference to `sync_fence_put'
    hid-quirks.c:(.text+0x78564): undefined reference to `sync_fence_put'
    hid-quirks.c:(.text+0x78580): undefined reference to `sync_fence_put'
    hid-quirks.c:(.text+0x7859c): undefined reference to `sync_fence_put'
    make[1]: *** [vmlinux] Error 1
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/linux-3.10.20.x'
    make: *** [linux] Error 1
    
    ?????????
  • $ make
    ............
    ............
    make[2]: Entering directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors/Mediatek/MT7623'
    cc  -DUSE_HOSTCC -o mkimage -I/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/mkimage/include /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/mkimage/crc32.c /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/mkimage/mkimage.c
    /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/user/mkimage/crc32.c:15:18: fatal error: zlib.h: No such file or directory
    compilation terminated.
    make[2]: *** [mkimage] Error 1
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors/Mediatek/MT7623'
    make[1]: *** [image] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors'
    make: *** [image] Error 2
    
    #sudo apt-get install zlib1g-dev
  • $ make
    ............
    ............
    touch /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/images/fake_ramdisk
    /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors/Mediatek/MT7623/flashtool/mkimage /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/images/fake_ramdisk ROOTFS > /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/images/fake_ramdisk.img
    /bin/sh: /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors/Mediatek/MT7623/flashtool/mkimage: No such file or directory
    make[2]: *** [image] Error 127
    make[2]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors/Mediatek/MT7623'
    make[1]: *** [image] Error 2
    make[1]: Leaving directory `/home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors'
    make: *** [image] Error 2
    
    #cp /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors/Mediatek/MT7623/mkimage /home/enos/workspace/fgn1000/MTK_APSoC_SDK/source/vendors/Mediatek/MT7623/flashtool

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • iptables -A FORWARD -m physdev --physdev-in ra0 -d 203.205.128.0/19 -j ACCEPT
  • iptables -A FORWARD -m physdev --physdev-in ra0 -d 203.205.160.0/21 -j ACCEPT
  • iptables -A FORWARD -m physdev --physdev-in ra0 -d 203.205.168.0/21 -j ACCEPT
  • iptables -A FORWARD -m physdev --physdev-in ra0 -d 203.205.176.0/20 -j ACCEPT
  • iptables -A FORWARD -m physdev --physdev-in ra0 -d any/0 -j DROP

-m physdev --physdev-in 是限制實體裝置


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

設定關鍵字

  • struct config_files 用來存放 config 檔案結構,fileHeader 用來存放檔案名,不包含 .conf。
  • struct config_line 用來存放 config 檔內的指令結構,config_token 為指令名,parse_line 為處理函數。
  • internal_register_config_handler 用來加入指令,static function 不對外。
  • snmplib/read_config.c,register_prenetsnmp_mib_handler,register_config_handler,register_const_config_handler,直接呼叫 internal_register_config_handler。
  • snmplib/read_config.c,register_app_config_handler 是對外函數,直接呼叫 register_config_handler 再呼叫 internal_register_config_handler。
  • agent/agent_read_config.c,snmpd_register_config_handler,snmpd_register_const_config_handler 是對外函數,直接呼叫 register_app_config_handler 再呼叫 register_config_handler 最後呼叫 internal_register_config_handler。
  • mibgroup/agentx/agentx_config.c,agentx_register_config_handler 是對外函數,直接呼叫 register_config_handler 再呼叫 internal_register_config_handler。使用 ":agentx" 做檔案名,所以會先設定 snmpd.conf 再設定 agentx.conf 的關鍵字。
  • ltmp = &((*ltmp)->next) 會直接把記憶體位址傳給 ltmp,一般寫法是會宣告 struct config_line *ltmp 而不是 struct config_line **ltmp,ltmp->next=calloc() 來設定 next 指標,而它是用 *ltmp=calloc() 來設定 next 指標。
  • agent/agent_read_config.c,init_agent_read_config() 設定關鍵字。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

  • snmplib/default_store.c(說明),主要設計來儲存全域變數。
  • 參數 m: 用來設定環境變數 MIBS,snmplib/mib.c 的 netsnmp_init_mib() 會使用,如果 MIBS 沒設定則使用 NETSNMP_DEFAULT_MIBS 放在 include/net-snmp/net-snmp-config.h。
  • 參數 M: 用來設定環境變數 MIBDIRS, snmplib/mib.c 的 netsnmp_get_mib_directory() 會用到,函數有點複雜,有空在整理。
  • init_agent() 用來初始化一個 agent,原始碼在 agent/snmp_vars.c,函數有點複雜,有空在整理。
  • init_mib_modules() 只是用來執行 netsnmp_access_interface_init() 跟註冊 shutdown 機制,有點怪怪,再研究。

snmplib/callback.c

  • snmp_call_callbacks: 用來執行 callback 函數。
  • snmp_register_callback: 用來註冊 callback 函數。
  • snmp_unregister_callback: 用來移除 callback 函數。

snmplib/parse.c

  • parse -> parse_compliance ->read_module_internal -> parse()。
  • parse -> parse_imports ->read_module_internal -> parse()。
  • main -> init_snmp -> netsnmp_init_mib -> netsnmp_read_module ->read_module_internal -> parse()

snmplib/read_config.c

  • read_configs() -> read_configs_optional() ->read_config_with_type_when() -> read_config()。
  • init_agent() -> init_agent_read_config() -> register_app_config_handler() -> register_config_handler() -> internal_register_config_handler() -> (*ltmp)->parse_line = parser;
  • init_agent() -> agent_module_inits.h -> init_vacm_conf() -> init_vacm_config_tokens() -> register_app_config_handler() -> .......

snmplib/mib.c(netsnmp_init_mib)

  • netsnmp_init_mib_internals: 初始化變數。
  • netsnmp_fixup_mib_directory: 修正 mib 目錄,把環境變數 HOME 替換掉 $HOME 字串。
  • netsnmp_mibindex_load: 載入 mib index,這個不知作用。
  • add_mibdir 待寫。

NETSNMP_DS_LIB_MIBDIRS

  • netsnmp_set_mib_directory: 設定 MIB 目錄。
  • snmpd 使用參數 M 用來設定 MIB 目錄。
  • netsnmp_get_mib_directory: 用來讀取 MIB 目錄。
  • 沒有使用參數 M 用來設定 MIB 目錄,則讀取環境變數 MIBDIRS。
  • 沒有環境變數 MIBDIRS,就使用 confmibdir 變數(由handle_mibs_conf()設定)。
  • 沒有confmibdir 變數,最後就使用 NETSNMP_DEFAULT_MIBDIRS($HOME/.snmp/mibs:/usr/share/snmp/mibs)。

snmplib/snmp_api.c (_init_snmp)

  • snmp_res_init(): 用來初始化 mutex 變數。

讀取 config 檔案

檔案 函數 執行
+agent/snmpd.c main init_snmp(app_name)
++snmplib/snmp_api.c init_snmp read_premib_configs
+++snmplib/read_config.c read_premib_configs read_config_files(PREMIB_CONFIG)
++++snmplib/read_config.c read_config_files read_config_files_of_type
+++++snmplib/read_config.c read_config_files_of_type read_config_files_in_path
++++++snmplib/read_config.c read_config_files_in_path read_config
+++snmplib/read_config.c read_premib_configs read_configs_optional
++++snmplib/read_config.c read_configs_optional read_config_with_type_when
+++++snmplib/read_config.c read_config_with_type_when read_config
++snmplib/snmp_api.c init_snmp read_configs
以下都相同,只差在 snmp_call_callbacks 函數,參數 SNMP_CALLBACK_PRE_READ_CONFIG 及 SNMP_CALLBACK_PRE_PREMIB_READ_CONFIG 不同。
  • read_config_files_of_type 如果 netsnmp_getenv("SNMPCONFPATH") 有值則只讀取這個目錄下的 config 檔,不然會透過 get_configuration_directory() 來讀取 config 檔。
  • read_config_files_in_path 根據 ctmp->fileHeader 來決定要讀取的 config 檔案。
  • snmpd -C 會取消搜尋預設目錄下的 config 檔案,設定 NETSNMP_DS_LIB_DONT_READ_CONFIGS 為 1,在 read_config_files_of_type 讀取 NETSNMP_DS_LIB_DISABLE_CONFIG_LOAD 判斷,二者值皆為 6。
  • snmpd -c 會讀取自建的 config 檔案,可用分隔符號 "," 來輸入多個 config 檔案。在 read_premib_configs 內 改成 read_configs_optional() -> read_config_with_type_when() -> read_config()。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

snmptrap -M /usr/share/snmp/mibs \
-m /usr/share/snmp/mibs/SNMPv2-MIB.txt \
-v 2c -c public 192.168.150.11:162 "" 1.3.6.1.6.3.1.1.5.1
  • -M 指定 mibs 存放的位置
  • -m 載入的 mib 檔案
  • -v specifies SNMP version to use
  • -c set the community string
  • 192.168.150.11:162 snmp server ip
  • "" up-time,使用 "" 會自動抓取系統值,不然就輸入數字。
  • 1.3.6.1.6.3.1.1.5.1 oid
snmptrap -M /usr/share/snmp/mibs \
-m /usr/share/snmp/mibs/IF-MIB.txt \
-v 2c -c public 192.168.150.11 "" linkDown linkDown i 3
  • -M 指定 mibs 存放的位置
  • -m 載入的 mib 檔案
  • -v specifies SNMP version to use
  • -c set the community string
  • 192.168.150.11 snmp server ip
  • "" up-time,使用 "" 會自動抓取系統值,不然就輸入數字。
  • linkDown oid
  • linkDown i 3 輸出的值,linkDown 為 oid,i 為 integer,3 為輸出值。

參考資料


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

原始 MTK 設計 NoForwarding(IsolateInterStaTraffic) 是用來做同一個 SSID 內的 client 不能互相溝通,NoForwardingBTNBSSID(IsolateInterStaTrafficBTNBSSID) 是用來做不同 SSID 的 client 不能互相溝通。

修改 rt2860v2/ap/ap_data.c
BOOLEAN APFowardWirelessStaToWirelessSta(
......
......
  if (pEntry && (pEntry->Sst == SST_ASSOC) && IS_ENTRY_CLIENT(pEntry))
  {
    bDirectForward = TRUE;
    bAnnounce = FALSE;
#if 0
    if (FromWhichBSSID == pEntry->apidx)
    {/* STAs in same SSID */
      if ((pAd->ApCfg.MBSSID[pEntry->apidx].IsolateInterStaTraffic == 1))
      {
        bDirectForward = FALSE;
        bAnnounce = FALSE;
      }
    }
    else
    {/* STAs in different SSID */
      if (pAd->ApCfg.IsolateInterStaTrafficBTNBSSID == 1 ||
        ((FromWhichBSSID < MAX_MBSSID_NUM(pAd)) &&
        (FromWhichBSSID < HW_BEACON_MAX_NUM) &&
        (pAd->ApCfg.MBSSID[pEntry->apidx].VLAN_VID != pAd->ApCfg.MBSSID[FromWhichBSSID].VLAN_VID)))
        /* destination VLAN ID != source VLAN ID */
      {
        bDirectForward = FALSE;
        bAnnounce = FALSE;
      }
    }
#else
    if ((pAd->ApCfg.MBSSID[FromWhichBSSID].IsolateInterStaTraffic == 1) || (pAd->ApCfg.MBSSID[pEntry->apidx].IsolateInterStaTraffic == 1))
    {
      bDirectForward = FALSE;
      bAnnounce = FALSE;
    }
#endif
  }
......
......

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

修改 Makefile

  • CFLAGS:=-Wall -Wunused -Werror 改成 CFLAGS:=-Wall -Wunused
  • CC:=gcc 改成 CC:=/opt/buildroot-gcc342/bin/mipsel-linux-gcc
  • KERNEL_INCLUDES?=include/ 改成 KERNEL_INCLUDES?=../../linux-2.6.36.x/include/

build code

  • 修改 Makefile
  • 修改 extensions/ebt_ip6.c 把 EBT_IP6_ICMP6 相關程式碼移除
  • make
  • make static

install

  • 把 ethertypes 拷貝到 /etc/ethertypes
  • make static 後會產生一個 static 的執行檔,可以直接執行不用其它 .so 檔。
  • ebtables 為另一個執行檔,需要 .so 檔,把 extensions/*.so 拷貝到 /lib 即可。

問題排解

/opt/buildroot-gcc342/bin/mipsel-linux-gcc -Wall -Wunused -Werror -fPIC -O3 -DPROGVERSION=\"2.0.10-4\" -DPROGNAME=\"ebtables\" -DPROGDATE=\"December\ 2011\" -D_PATH_ETHERTYPES=\"/etc/ethertypes\" -DEBTD_ARGC_MAX=50 -DEBTD_CMDLINE_MAXLN=2048 -DLOCKFILE=\"/var/lib/ebtables/lock\" -DLOCKDIR=\"/var/lib/ebtables/\" -c -o extensions/ebt_nat.o extensions/ebt_nat.c -I/home/enos/FGN-R3/RT288x_SDK/source/linux-2.6.36.x/include/
extensions/ebt_nat.c: In function `parse_s':
extensions/ebt_nat.c:95: warning: 'tmp' might be used uninitialized in this function
make: *** [extensions/ebt_nat.o] Error 1
CFLAGS:=-Wall -Wunused -Werror 改成 CFLAGS:=-Wall -Wunused
/opt/buildroot-gcc342/bin/mipsel-linux-gcc -Wall -Wunused -fPIC -O3 -DPROGVERSION=\"2.0.10-4\" -DPROGNAME=\"ebtables\" -DPROGDATE=\"December\ 2011\" -D_PATH_ETHERTYPES=\"/etc/ethertypes\" -DEBTD_ARGC_MAX=50 -DEBTD_CMDLINE_MAXLN=2048 -DLOCKFILE=\"/var/lib/ebtables/lock\" -DLOCKDIR=\"/var/lib/ebtables/\" -c -o extensions/ebt_ip6.o extensions/ebt_ip6.c -I/home/enos/FGN-R3/RT288x_SDK/source/linux-2.6.36.x/include/
extensions/ebt_ip6.c: In function `parse':
extensions/ebt_ip6.c:369: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c:369: error: (Each undeclared identifier is reported only once
extensions/ebt_ip6.c:369: error: for each function it appears in.)
extensions/ebt_ip6.c:373: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:373: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c: In function `final_check':
extensions/ebt_ip6.c:430: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c: In function `print':
extensions/ebt_ip6.c:488: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c:492: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:492: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c: In function `compare':
extensions/ebt_ip6.c:536: error: `EBT_IP6_ICMP6' undeclared (first use in this function)
extensions/ebt_ip6.c:537: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:537: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:538: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:538: error: structure has no member named `icmpv6_type'
extensions/ebt_ip6.c:539: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c:539: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c:540: error: structure has no member named `icmpv6_code'
extensions/ebt_ip6.c:540: error: structure has no member named `icmpv6_code'
make: *** [extensions/ebt_ip6.o] Error 1
由於 linux-2.6.36.x 不支援 EBT_IP6_ICMP6,所以必須把 EBT_IP6_ICMP6 相關程式碼移除。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

其實很簡單,只要把 wanif 加入 bridge 再把 ipv4 protocol 全擋掉即可。

如果只是單純把 wanif 加入 bridge 會造成 ipv6 通,但 ipv4 不通。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

iwpriv rai0 set AutoChannelSel=1

rlt_wifi/common/scan.c scan_ch_restore APStartUp()
rlt_wifi/ap/ap.c APStartUp mt76x2_calibration
rlt_wifi/chips/mt76x2.c mt76x2_calibration
rlt_wifi/ap/ap_autoChSel.c SelectBestChannel SelectClearChannelApCnt()
rlt_wifi/ap/ap_autoChSel.c SelectClearChannelApCnt ...

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

RT288x_SDK\source\linux-2.6.36.x\drivers\net\raeth\raether.c,esw_link_status_changed()←esw_interrupt()←request_irq(SURFBOARDINT_ESW, esw_interrupt, IRQF_DISABLED, "Ralink_ESW", dev)。


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

下載檔案

環境設定

  • export PKG_CONFIG_PATH=/opt/wget/lib/pkgconfig/
  • export PATH=/opt/buildroot-gcc342/bin:$PATH
  • export CC=/opt/buildroot-gcc342/bin/mipsel-linux-gcc
  • export CXX=/opt/buildroot-gcc342/bin/mipsel-linux-g++
  • export AR=/opt/buildroot-gcc342/bin/mipsel-linux-ar
  • export AS=/opt/buildroot-gcc342/bin/mipsel-linux-as
  • export NM=/opt/buildroot-gcc342/bin/mipsel-linux-nm
  • export LD=/opt/buildroot-gcc342/bin/mipsel-linux-ld
  • export STRIP=/opt/buildroot-gcc342/bin/mipsel-linux-strip
  • export RANLIB=/opt/buildroot-gcc342/bin/mipsel-linux-ranlib

編譯 zlib-1.2.8

  • ./configure --static --prefix=/opt/wget
  • make
  • sudo make install

編譯 openssl-1.0.2d

  • single-threading
    ./Configure dist no-asm no-shared --prefix=/opt/wget
  • multi-threading

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

iperf 2.0.5

  • configure 沒問題
    ac_cv_func_malloc_0_nonnull=yes \
    ./configure --build=i686-linux --host=mipsel-linux \
    CFLAGS=-static CXXFLAGS=-static \
    CC=/opt/buildroot-gcc342/bin/mipsel-linux-gcc \
    CXX=/opt/buildroot-gcc342/bin/mipsel-linux-g++ \
    STRIP=/opt/buildroot-gcc342/bin/mipsel-linux-strip \
    RANLIB=/opt/buildroot-gcc342/bin/mipsel-linux-ranlib
           
    
  • make 沒問題
    $make
    
  • make 出錯是因為少做了 ac_cv_func_malloc_0_nonnull=yes
    $make
    make  all-recursive
    make[1]: Entering directory `/home/enos/iperf-2.0.5'
    Making all in compat
    .... 略
    .... 略
    .... 略
    /opt/buildroot-gcc342/bin/mipsel-linux-g++ -Wall -O2    -o iperf -O2  -pthread  -DHAVE_CONFIG_H Client.o Extractor.o Launch.o List.o Listener.o Locale.o PerfSocket.o ReportCSV.o ReportDefault.o Reporter.o Server.o Settings.o SocketAddr.o gnu_getopt.o gnu_getopt_long.o main.o service.o sockets.o stdio.o tcp_window_size.o ../compat/libcompat.a 
    ReportCSV.o: In function `CSV_peer':ReportCSV.c:(.text+0x28): undefined reference to `rpl_malloc'
    Reporter.o: In function `InitMulti':Reporter.c:(.text+0x7c): undefined reference to `rpl_malloc'
    :Reporter.c:(.text+0x128): undefined reference to `rpl_malloc'
    Reporter.o: In function `InitReport':Reporter.c:(.text+0x834): undefined reference to `rpl_malloc'
    :Reporter.c:(.text+0xa34): undefined reference to `rpl_malloc'
    Reporter.o:Reporter.c:(.text+0xe18): more undefined references to `rpl_malloc' follow
    collect2: ld returned 1 exit status
    make[2]: *** [iperf] Error 1
    make[2]: Leaving directory `/home/enos/iperf-2.0.5/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/enos/iperf-2.0.5'
    make: *** [all] Error 2
           
    

iperf 3.0.11

  • 修改 src/Makefile.in
    --- iperf-3.0.11-old/src/Makefile.in    2015-01-10 01:44:11.000000000 +0800
    +++ iperf-3.0.11-new/src/Makefile.in    2015-08-18 11:40:03.619391694 +0800
    @@ -593,9 +593,9 @@
     iperf3_profile_SOURCES = main.c \
                                                      $(libiperf_la_SOURCES)
    -iperf3_profile_CFLAGS = -pg -g
    +iperf3_profile_CFLAGS = -g
     iperf3_profile_LDADD = libiperf.la
    -iperf3_profile_LDFLAGS = -pg -g
    +iperf3_profile_LDFLAGS = -g
     # Specify the sources and various flags for the test cases
     t_timer_SOURCES = t_timer.c
           
    
  • configure 沒問題
    ./configure --build=i686-linux --host=mipsel-linux \
    --disable-shared --enable-static \
    CC=/opt/buildroot-gcc342/bin/mipsel-linux-gcc \
    CXX=/opt/buildroot-gcc342/bin/mipsel-linux-g++ \
    STRIP=/opt/buildroot-gcc342/bin/mipsel-linux-strip \
    RANLIB=/opt/buildroot-gcc342/bin/mipsel-linux-ranlib \
    OBJDUMP=/opt/buildroot-gcc342/bin/mipsel-linux-objdump \
    AR=/opt/buildroot-gcc342/bin/mipsel-linux-ar
           
    
  • 修改 src/iperf_api.c,由於 Ralink SDK 不支援 affinity,所以直接取消這個功能。
    --- iperf-3.0.11-old/src/iperf_api.c     2015-01-10 01:44:11.000000000 +0800
    +++ iperf-3.0.11-new/src/iperf_api.c    2015-08-18 11:29:33.067193354 +0800
    @@ -2614,7 +2614,7 @@
     int
     iperf_setaffinity(int affinity)
     {
    -#ifdef linux
    +#if 0
         cpu_set_t cpu_set;
         CPU_ZERO(&cpu_set);
    @@ -2633,7 +2633,7 @@
     int
     iperf_clearaffinity(void)
     {
    -#ifdef linux
    +#if 0
         cpu_set_t cpu_set;
         int i;
           
    
  • 修改 src/tcp_info.c。
    --- iperf-3.0.11-old/src/tcp_info.c     2015-01-10 01:44:11.000000000 +0800
    +++ iperf-3.0.11-new/src/tcp_info.c     2015-08-18 11:51:54.431410178 +0800
    @@ -46,7 +46,6 @@
     #include 
            
            #include 
            #include 
            -#include 
            #include 
            #include 
            #include
    
  • make 沒問題
    $make
    
  • make 出錯,請修正 src/iperf_api.c。
    $ make
    Making all in src
    make[1]: Entering directory `/home/enos/iperf-3.0.11/src'
    make  all-am
    make[2]: Entering directory `/home/enos/iperf-3.0.11/src'
    /bin/sh ../libtool  --tag=CC   --mode=compile /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c -o cjson.lo cjson.c
    libtool: compile:  /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT cjson.lo -MD -MP -MF .deps/cjson.Tpo -c cjson.c -o cjson.o
    mv -f .deps/cjson.Tpo .deps/cjson.Plo
    /bin/sh ../libtool  --tag=CC   --mode=compile /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I.     -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c -o iperf_api.lo iperf_api.c
    libtool: compile:  /opt/buildroot-gcc342/bin/mipsel-linux-gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c iperf_api.c -o iperf_api.o
    iperf_api.c: In function `iperf_setaffinity':
    iperf_api.c:2618: error: `cpu_set_t' undeclared (first use in this function)
    iperf_api.c:2618: error: (Each undeclared identifier is reported only once
    iperf_api.c:2618: error: for each function it appears in.)
    iperf_api.c:2618: error: parse error before "cpu_set"
    iperf_api.c:2620: warning: implicit declaration of function `CPU_ZERO'
    iperf_api.c:2620: error: `cpu_set' undeclared (first use in this function)
    iperf_api.c:2621: warning: implicit declaration of function `CPU_SET'
    iperf_api.c:2622: warning: implicit declaration of function `sched_setaffinity'
    iperf_api.c: In function `iperf_clearaffinity':
    iperf_api.c:2637: error: `cpu_set_t' undeclared (first use in this function)
    iperf_api.c:2637: error: parse error before "cpu_set"
    iperf_api.c:2640: error: `cpu_set' undeclared (first use in this function)
    iperf_api.c:2641: error: `CPU_SETSIZE' undeclared (first use in this function)
    make[2]: *** [iperf_api.lo] Error 1
    make[2]: Leaving directory `/home/enos/iperf-3.0.11/src'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/iperf-3.0.11/src'
    make: *** [all-recursive] Error 1
           
    
  • make 出錯,請修正 src/Makefile.in。
    $ make
    Making all in src
    make[1]: Entering directory `/home/enos/iperf-3.0.11-new/src'
    make  all-am
    make[2]: Entering directory `/home/enos/iperf-3.0.11-new/src'
    .... 略
    .... 略
    .... 略
    libtool: link: /opt/buildroot-gcc342/bin/mipsel-linux-gcc -pg -g -g -O2 -Wall -pg -g -o iperf3_profile iperf3_profile-main.o iperf3_profile-cjson.o iperf3_profile-iperf_api.o iperf3_profile-iperf_error.o iperf3_profile-iperf_client_api.o iperf3_profile-iperf_locale.o iperf3_profile-iperf_server_api.o iperf3_profile-iperf_tcp.o iperf3_profile-iperf_udp.o iperf3_profile-iperf_util.o iperf3_profile-net.o iperf3_profile-tcp_info.o iperf3_profile-tcp_window_size.o iperf3_profile-timer.o iperf3_profile-units.o  ./.libs/libiperf.a
    /opt/buildroot-gcc342/bin/../lib/gcc/mipsel-linux-uclibc/3.4.2/../../../../mipsel-linux-uclibc/bin/ld: gcrt1.o: No such file: No such file or directory
    collect2: ld returned 1 exit status
    make[2]: *** [iperf3_profile] Error 1
    make[2]: Leaving directory `/home/enos/iperf-3.0.11-new/src'
    make[1]: *** [all] Error 2
    make[1]: Leaving directory `/home/enos/iperf-3.0.11-new/src'
    make: *** [all-recursive] Error 1
           
    
  • make 出錯,請修正 src/Makefile.in,去掉 -pg。
    $ make
    .... 略
    .... 略
    .... 略
    libtool: link: msdk-linux-gcc -pg -g -I/home/enos/workspace/fgn-r4-3.4.11C/rtl819x/target/tmpfs/include -I/home/enos/workspace/fgn-r4-3.4.11C/rtl819x/target/tmpfs/include -Wall -pg -g -o iperf3_profile iperf3_profile-main.o iperf3_profile-cjson.o iperf3_profile-iperf_api.o iperf3_profile-iperf_error.o iperf3_profile-iperf_client_api.o iperf3_profile-iperf_locale.o iperf3_profile-iperf_server_api.o iperf3_profile-iperf_tcp.o iperf3_profile-iperf_udp.o iperf3_profile-iperf_sctp.o iperf3_profile-iperf_util.o iperf3_profile-net.o iperf3_profile-tcp_info.o iperf3_profile-tcp_window_size.o iperf3_profile-timer.o iperf3_profile-units.o  ./.libs/libiperf.a -lm
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/toolchain/msdk-4.4.7-mips-EL-3.10-u0.9.33-m32t-140827/bin/../lib/gcc/mips-linux-uclibc/4.4.7/../../../../mips-linux-uclibc/lib/gcrt1.o: In function `__gmon_start__':
    (.text+0x8c): undefined reference to `__monstartup'
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/toolchain/msdk-4.4.7-mips-EL-3.10-u0.9.33-m32t-140827/bin/../lib/gcc/mips-linux-uclibc/4.4.7/../../../../mips-linux-uclibc/lib/gcrt1.o: In function `__gmon_start__':
    (.text+0x98): undefined reference to `_mcleanup'
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/toolchain/msdk-4.4.7-mips-EL-3.10-u0.9.33-m32t-140827/bin/../lib/gcc/mips-linux-uclibc/4.4.7/../../../../mips-linux-uclibc/lib/gcrt1.o: In function `__gmon_start__':
    (.text+0x9c): undefined reference to `_mcleanup'
    iperf3_profile-main.o: In function `main':
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/users/iperf-3.1.7/src/main.c:62: undefined reference to `_mcount'
    iperf3_profile-main.o: In function `sigend_handler':
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/users/iperf-3.1.7/src/main.c:124: undefined reference to `_mcount'
    iperf3_profile-main.o: In function `run':
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/users/iperf-3.1.7/src/main.c:131: undefined reference to `_mcount'
    iperf3_profile-cjson.o: In function `cJSON_GetErrorPtr':
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/users/iperf-3.1.7/src/cjson.c:47: undefined reference to `_mcount'
    iperf3_profile-cjson.o: In function `cJSON_strcasecmp':
    /home/enos/workspace/fgn-r4-3.4.11C/rtl819x/users/iperf-3.1.7/src/cjson.c:50: undefined reference to `_mcount'
    iperf3_profile-cjson.o:/home/enos/workspace/fgn-r4-3.4.11C/rtl819x/users/iperf-3.1.7/src/cjson.c:60: more undefined references to `_mcount' follow
    collect2: ld returned 1 exit status
    make[5]: *** [iperf3_profile] Error 1
           
    

參考資料


台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

ralink 有一個試範專案為 hello_world,不懂的話可以參考它的 Makefile。由於主要的變數都直接從 user/Makefile 繼承而來,所以都可以直接使用,不用宣告,讓 Makefile 變得很乾淨。

  • 修改 source/config/config.in,參考 "Hello World Example",在 make menuconfig 時出現一個選項。
  • 修改 source/user/Makefile,參考 "CONFIG_USER_HELLO_WORLD",在做 make user_only 才會一起編譯。
  • 把你的專案拷貝到 user 目錄下,並參考 source/user/hello_world/Makefile 去修改。
  • Makefile 主要是新增一個 romfs 把執行檔拷貝到執行目錄,另外可以使用 echo "test" >> $(ROMFSDIR)/etc_ro/rcS,讓程式一開機就執行。

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()

1 2