(OK)(OK) Fedora23-NS3-Android-x86-MANETs-Testing



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
need java-1.7.0-openjdk, not java-1.8.0-openjdk
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

java -version

[root@localhost gem5-stable]# ls /usr/lib/jvm/
java                                           java-openjdk       jre-1.8.0-openjdk-1.8.0.91-6.b14.fc23.x86_64
java-1.8.0                                     jre                jre-openjdk
java-1.8.0-openjdk                             jre-1.8.0
java-1.8.0-openjdk-1.8.0.91-6.b14.fc23.x86_64  jre-1.8.0-openjdk
[root@localhost gem5-stable]#

============================================
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.
 
Your version is: openjdk version "1.8.0_91" OpenJDK Runtime Environment (build 1.8.0_91-b14) OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode).
The required version is: "1.7.x"
 
Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:171: *** stop

#### make failed to build some targets (28 seconds) ####

[root@localhost android-6.0.1_r46]#
[root@localhost android-6.0.1_r46]# export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
[root@localhost android-6.0.1_r46]# export PATH=$JAVA_HOME/bin:$PATH
[root@localhost android-6.0.1_r46]# java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (fedora-2.5.4.2.fc20-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
[root@localhost android-6.0.1_r46]#

*********************************************************
install java-1.7.0-openjdk
*********************************************************
http://koji.fedoraproject.org/koji/buildinfo?buildID=605625

dnf search openjdk
dnf install java-atk-wrapper

[root@localhost Desktop]# ls java-1.7.0-openjdk-*
java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-accessibility-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-debuginfo-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-demo-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-devel-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-headless-1.7.0.75-2.5.4.2.fc20.x86_64.rpm
java-1.7.0-openjdk-src-1.7.0.75-2.5.4.2.fc20.x86_64.rpm

[root@localhost Desktop]# rpm -ivh --force --nodeps java-1.7.0-openjdk-*
[root@localhost Desktop]# java -version
[root@localhost Desktop]# ls /usr/lib/jvm/

export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
export PATH=$JAVA_HOME/bin:$PATH
*********************************************************

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
download Android-x86-* from http://www.fosshub.com/Android-x86.html/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Android-x86 —— compile the source code
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
http://www.android-x86.org/getsourcecode

[root@localhost android-x86-6.0-rc1]# export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
[root@localhost android-x86-6.0-rc1]# export PATH=$JAVA_HOME/bin:$PATH

[root@localhost android-x86-6.0-rc1]# . build/envsetup.sh
[root@localhost android-x86-6.0-rc1]# lunch android_x86-userdebug

[root@localhost android-x86-6.0-rc1]# m -j4 iso_img
Total translation table size: 6900
Total rockridge attributes bytes: 3312
Total directory bytes: 12288
Path table size(bytes): 88
Done with: The File(s)                             Block(s)    170078
Writing:   Ending Padblock                         Start Block 170122
Done with: Ending Padblock                         Block(s)    150
Max brk space used 22000
170272 extents written (332 MB)
/bin/bash: isohybrid: 未找到命令
isohybrid not found.
Install syslinux 4.0 or higher if you want to build a usb bootable iso.

out/target/product/x86/android_x86.iso is built successfully.

make: Leaving directory '/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/android-x86/android-x86-6.0-rc1'
#### make completed successfully (03:19:54 (hh:mm:ss)) ####

------------------------------------------------------------
out/target/product/x86/android_x86.iso

[root@localhost android-x86-6.0-rc1]# ll -h out/target/product/x86/android_x86.iso
-rw-r--r--. 1 root root 333M 6月  13 18:42 out/target/product/x86/android_x86.iso
------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
install Android-x86 (android_x86.iso) in VirtualBox
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

refer to http://www.rickylford.com/install-android-5-1-on-virtualbox/

[root@localhost virtualbox-os]# pwd
/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os

[root@localhost virtualbox-os]# ll -h
-rw-------. 1 root root 5.1G 6月  14 21:24 android-x86-6.0-rc1-1.vdi
[root@localhost virtualbox-os]#

Note: the name of Android-x86 Virtualhost created in VirtualBox is "android-x86-6.0-rc1-1", after, we will create new Android-x86 Virtualhosts by copying "android-x86-6.0-rc1-1".

[root@localhost virtualbox-os]# cp android-x86-6.0-rc1-1.vdi android-x86-6.0-rc1-2.vdi

[root@localhost virtualbox-os]# ll -h
-rw-------. 1 root root 5.1G 6月  14 21:24 android-x86-6.0-rc1-1.vdi
-rw-------. 1 root root 5.1G 6月  14 21:17 android-x86-6.0-rc1-2.vdi

[root@localhost virtualbox-os]# VBoxManage internalcommands sethduuid android-x86-6.0-rc1-2.vdi

--------------------------------------------------------------------------
the up command must be executed,
otherwise, Error when importing VDI file in VirtualBox
--------------------------------------------------------------------------

Cannot register the hard disk '/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/Android-x86-6.0-rc1-1.vdi' {dbfc8e7b-4969-4836-86d9-418e60328b83} because a hard disk '/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os/android-x86-6.0-rc1-2.vdi' with UUID {dbfc8e7b-4969-4836-86d9-418e60328b83} already exists.

Solution:

[root@localhost virtualbox-os]# VBoxManage internalcommands sethduuid android-x86-6.0-rc1-1.vdi
UUID changed to: 865924c0-53b5-4aac-83b3-2402b33acdeb

[root@localhost virtualbox-os]# VBoxManage internalcommands dumphdinfo android-x86-6.0-rc1-1.vdi
--------------------------------------------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
running Android-x86 in VirtualBox
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-----------
in HOST
-----------
tunctl -t tap-left
ip link set up dev tap-left
brctl addbr br-android
brctl addif br-android tap-left
ip link set up dev br-android
ip addr add 10.1.1.1/24 dev br-android
ip route add 10.1.1.0/24 dev br-android
-----------
// VirtualBox > (android-x86-6.0-rc1-1) > Settings > Network > Adapter 1 > bridge, br-android.

-----------
in Android
-----------
-------------------------------------
// in HOST
[root@localhost busybox]# adb push busybox-x86_64 /data
[root@localhost busybox]# adb shell

// in Android
root@vbox86p:/ # cd data/
chmod 755 busybox-x86_64
-------------------------------------
// in Android

netcfg eth1 down
./busybox-x86_64 ifconfig eth1 down
./busybox-x86_64 ifconfig eth1 10.1.1.2 netmask 255.255.255.0 up

// ./busybox-x86_64 ip addr add 10.1.1.2/24 dev eth1
// ./busybox-x86_64 ip route add default via 10.1.1.1 dev eth1

./busybox-x86_64 route -n
./busybox-x86_64 ifconfig
./busybox-x86_64 ping 10.1.1.2
-----------

-------------------------------------
ifconfig br-android down
brctl delif br-android tap-left
brctl delif br-android eth1
brctl delbr br-android
ifconfig tap-left down
tunctl -d tap-left
//ip link delete veth_android44
//ip link delete X
-------------------------------------

http://cygnus.androidapksfree.com/hulk/com.UCMobile.intl_v10.10.0.796-238_Android-2.3.apk

http://www.apkmirror.com/wp-content/uploads/uploaded/5758ac63cb322/com.android.chrome_51.0.2704.81-270408111_minAPI21(x86)(nodpi)_apkmirror.com.apk
------------------------------------------------------------


--------------------------------------------------------------------------
netcat transfer file to android from fedora23
--------------------------------------------------------------------------
Server (fedora23)
[root@localhost Desktop]# pwd
/root/Desktop
[root@localhost Desktop]# ls cm-browser5-20-38.apk
cm-browser5-20-38.apk
[root@localhost Desktop]#
iptables -I INPUT -p tcp --dport 12123 -j ACCEPT
iptables -D INPUT -p tcp --dport 12123 -j ACCEPT
nc -l 12123 < chrome51.apk

Client (android)
nc 10.108.162.164 12123 > chrome51.apk

Client (fedora/linux)
nc -n 10.108.162.164 12123 > chrome51.apk

--------------------------------
nc -l 12123 > config.log
nc -n 172.17.0.1 12123  < config.log

--------------------------------------------------------------------------
Android 6.0 (Marshmallow) Install apk - INSTALL_FAILED_INVALID_URI
--------------------------------------------------------------------------

must be under the root directory:

cd /
pm install /sdcard/Download/chrome51.apk

Success
-------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++





++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
running two Android-x86 in VirtualBox, they connect to "ethernet bridge"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

brctl addbr br-android
ip link set up dev br-android
ip addr add 10.1.1.1/24 dev br-android
ip route add 10.1.1.0/24 dev br-android

ifconfig br-android down
brctl delbr br-android

// VirtualBox > (android-x86-6.0-rc1-1) > Settings > Network > Adapter 1 > bridge, br-android.

// in android-x86-6.0-rc1-1
ifconfig eth0 down
ifconfig eth0 10.1.1.10 netmask 255.255.255.0 up

// VirtualBox > (android-x86-6.0-rc1-2) > Settings > Network > Adapter 1 > bridge, br-android.

// in android-x86-6.0-rc1-2
ifconfig eth0 down
ifconfig eth0 10.1.1.20 netmask 255.255.255.0 up

android-x86-6.0-rc1-1 can ping android-x86-6.0-rc1-2, and vice verse

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
compile quagga in CentOS in Docker
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@dc90dd730230 quagga]# uname -a
Linux dc90dd730230 4.4.8-300.fc23.x86_64 #1 SMP Wed Apr 20 16:59:27 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@dc90dd730230 quagga]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@dc90dd730230 quagga]#
------------------------------------------------

root@cd2cc1b26be3:~/quagga# ls ..
quagga  quagga-mtr  quagga-svnsnap.tgz
root@cd2cc1b26be3:~/quagga# pwd
/root/quagga

// root@cd2cc1b26be3:~/quagga# ./update-autotools
// root@cd2cc1b26be3:~/quagga# aclocal -I m4 --install

root@cd2cc1b26be3:~/quagga#

./bootstrap.sh
./configure --enable-user=root --enable-group=root --enable-vtysh --with-cflags=-ggdb

----------------------------------------------------------------------------------------
Quagga configuration
--------------------
quagga version          : 0.99.21mr2.2-dev
host operating system   : linux-gnu
source code location    : .
compiler                : gcc
compiler flags          : -ggdb
C++ compiler            : g++
C++ compiler flags      : -ggdb
make                    : make
includes                :  
linker flags            :  -lcrypt   -lrt   -ltermcap -lreadline -lm
state file directory    : /var/run
config file directory   : /usr/local/etc
example directory       : /usr/local/etc
user to run as        : root
group to run as        : root
group for vty sockets    :
config file mask        : 0600
log file mask           : 0600
generic netlink         : no
  (support for RFC 4938 link metrics)
----------------------------------------------------------------------------------------
make
make install

cd /usr/local/etc/
cp ospf6d.conf.sample ospf6d.conf
cp zebra.conf.sample zebra.conf

----------------------------------------------------------------------------------------
vi ospf6d.conf
----------------------------------------------------------------------------------------
interface eth0
 ipv6 ospf6 priority 1
 ipv6 ospf6 transmit-delay 1
 ipv6 ospf6 ifmtu 1500
 ipv6 ospf6 cost 1
 ipv6 ospf6 hello-interval 2
 ipv6 ospf6 dead-interval 6
 ipv6 ospf6 retransmit-interval 5
 ipv6 ospf6 network manet-designated-router
 ipv6 ospf6 ackinterval 1800
 ipv6 ospf6 backupwaitinterval 2000
 ipv6 ospf6 twohoprefresh 3
 ipv6 ospf6 hellorepeatcount 3
 ipv6 ospf6 adjacencyconnectivity biconnected
 ipv6 ospf6 lsafullness mdrfulllsa
 ipv6 ospf6 flood-delay 100
!
 
router ospf6
 instance-id 65
! router-id 10.1.0.1 (Note: Each node is not the same) (line 21)
 interface eth0 area 0.0.0.0
 protocol-traffic-class 184
 redistribute ospf
 redistribute connected
!
----------------------------------------------------------------------------------------

zebra -d
ospf6d -d
vtysh
> show ipv6 ospf6 route
> show ip route
> show ipv6 route
> exit

route add 123.123.123.123 reject
route -n
route del 123.123.123.123 reject

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, compile successfully quagga in CentOS in Docker
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




// install_quagga-0.99.21mr2.2_on_android-x86_64_in_Fedora23.txt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
cross compile quagga-0.99.21mr2.2 for android-x86_64 in Fedora23
quagga-0.99.21mr2.2 can be got from http://downloads.pf.itd.nrl.navy.mil/ospf-manet/
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------
www.nrl.navy.mil —— OSPF MANET Designated Routers (OSPF-MDR) Implementation
----------------------------------------------------------------------------------------
wget http://downloads.pf.itd.nrl.navy.mil/ospf-manet/nightly_snapshots/quagga-svnsnap.tgz
wget https://www.busybox.net/downloads/binaries/busybox-i686
----------------------------------------------------------------------------------------

[root@localhost quagga]# pwd
/opt/android-on-linux/quagga
[root@localhost quagga]# make clean

[root@localhost quagga]# ./bootstrap.sh

++++++++++++++++++ Issues
[root@localhost quagga]# gedit lib/zebra.h

//#include <sys/fcntl.h>
#include <fcntl.h>
++++++++++++++++++
xorp/libxorp/ipv4.hh:471:48: error: macro "static_assert" requires 2 arguments, but only 1 given
xorp/libxorp/ipv6.hh:425:52: error: macro "static_assert" requires 2 arguments, but only 1 given

[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipv4.hh

    //static_assert(sizeof(IPv4) == sizeof(uint32_t));
    static_assert(sizeof(IPv4) == sizeof(uint32_t), "");

[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipv6.hh

    //static_assert(sizeof(IPv6) == 4 * sizeof(uint32_t));
    static_assert(sizeof(IPv6) == 4 * sizeof(uint32_t), "");

[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipvx.cc ./xpimd/xorp/libxorp/selector.cc ./xpimd/xorp/libproto/packet.hh
    //static_assert(*);

[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/utility.h
    //#define UNUSED(var)    static_assert(sizeof(var) != 0)
    #define UNUSED(var)    static_assert(sizeof(var) != 0, "")

[root@localhost quagga]# gedit ./xpimd/xorp/libxorp/ipv6.cc
    //static_assert(sizeof(_addr) == sizeof(tmp_addr));
    static_assert(sizeof(_addr) == sizeof(tmp_addr), "");

--------------
/opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/__config:598:0: note: this is the location of the previous definition
 #define static_assert(__b, __m) \
--------------
++++++++++++++++++
xorp/fea/mfea_proto_comm.cc:1657:46: error: invalid conversion from 'void*' to 'const uint8_t* {aka const unsigned char*}' [-fpermissive]
   int_val = extract_host_int(CMSG_DATA(cmsgp));
-----

/opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/include/sys/socket.h:112:0: note: this is the location of the previous definition
 #define CMSG_DATA(cmsg) ((void*)((char*)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))

[root@localhost quagga]# gedit ./xpimd/xorp/fea/mfea_proto_comm.cc
    // add the following lines

    #define CMSG_DATA(cmsg) ((uint8_t*)((char*)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
#ifndef CMSG_LEN

#else // ! HAVE_RFC3542
    #undef HAVE_IPV6_MULTICAST_ROUTING

++++++++++++++++++++++
xorp/pim/pim_mrt_task.cc:185:14: error: ambiguous overload for 'operator!=' (operand types are 'std::__ndk1::list<PimMreTask*>::reverse_iterator {aka std::__ndk1::reverse_iterator<std::__ndk1::__list_iterator<PimMreTask*, void*> >}' and 'std::__ndk1::list<PimMreTask*>::reverse_iterator {aka std::__ndk1::reverse_iterator<std::__ndk1::__list_iterator<PimMreTask*, void*> >}')
     if (iter != pim_mre_task_list().rend()) {
              ^
xorp/pim/pim_mrt_task.cc:185:14: note: candidates are:
In file included from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/memory:604:0,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:628,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/string:439,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:15,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/ios:216,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/iostream:38,
                 from xorp/libxorp/xorp.h:35,
                 from xorp/pim/pim_mrt_task.cc:23:
/opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/iterator:593:1: note: bool std::__ndk1::operator!=(const std::__ndk1::reverse_iterator<_Iter1>&, const std::__ndk1::reverse_iterator<_Iter2>&) [with _Iter1 = std::__ndk1::__list_iterator<PimMreTask*, void*>; _Iter2 = std::__ndk1::__list_iterator<PimMreTask*, void*>]
 operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
 ^
In file included from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/algorithm:627:0,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/string:439,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/__locale:15,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/ios:216,
                 from /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/iostream:38,
                 from xorp/libxorp/xorp.h:35,
                 from xorp/pim/pim_mrt_task.cc:23:
/opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libcxx/include/utility:172:1: note: bool std::__ndk1::rel_ops::operator!=(const _Tp&, const _Tp&) [with _Tp = std::__ndk1::reverse_iterator<std::__ndk1::__list_iterator<PimMreTask*, void*> >]
 operator!=(const _Tp& __x, const _Tp& __y)
 ^
------------
[root@localhost quagga]# gedit ./xpimd/xorp/pim/pim_mrt_task.cc         (four places)

    //if (iter != pim_mre_task_list().rend()) {
    if (!(iter == pim_mre_task_list().rend())) {

++++++++++++++++++++++
[root@localhost quagga]# gedit ./xpimd/xorp/pim/pim_vif.cc

#include <netinet/ip6.h>
#include <netinet/in.h>

++++++++++++++++++++++
zebra_client.cc:186: error: undefined reference to 'zcalloc(int, unsigned int)'
zebra_client.cc:242: error: undefined reference to 'zfree(int, void*)'

[root@localhost quagga]# gedit xpimd/zebra_client.cc

#if 1 /* set to 1 to use system alloc directly */
#undef XMALLOC
#undef XCALLOC
#undef XREALLOC
#undef XFREE
#define XMALLOC(T,S) malloc((S))
#define XCALLOC(T,S) calloc(1, (S))
#define XREALLOC(T,P,S) realloc((P),(S))
#define XFREE(T,P) free((P))
#endif

++++++++++++++++++++++
zebra_router.cc:48: error: undefined reference to 'memory_init()'

[root@localhost quagga]# gedit xpimd/zebra_router.cc

    vty_init(master);
    //memory_init();

++++++++++++++++++++++
../lib/.libs/libzebra.so: error: undefined reference to 'crypt'

download from (libcrypt.so.1) https://sourceforge.net/p/android-x86/bootable_newinstaller/ci/9a49bb368ac83fa339678d259ec2c6c668267db8/tree/initrd/lib/libcrypt.so.1?format=raw

cp libcrypt.so.1 /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so

++++++++++++++++++++++



-------------------------------------------------------
android-ndk-r12 + android-23 + x86-4.9 (static linked), failed
-------------------------------------------------------

[root@localhost quagga]#

./bootstrap.sh


make clean

export NDK_ROOT="/opt/android-on-linux/android-ndk-r12"
export SYSROOT="$NDK_ROOT/platforms/android-23/arch-x86"
export CFLAGS="-g --pipe --sysroot=$SYSROOT -I$NDK_ROOT/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/include-fixed/ -I$NDK_ROOT/platforms/android-23/arch-x86/usr/include -I$NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include/ -I$NDK_ROOT/sources/android/support/include/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"

export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -Wl,-dy -lcrypt -Wl,-dn -lstlport_static -lc++ -lm -lc"        ((can not work))

export CPATH="/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/i686-linux-android-cpp"
export CXX="$CPATH/i686-linux-android-g++"
export CC="$CPATH/i686-linux-android-gcc"
export LD="$CPATH/i686-linux-android-ld"
export AR="$CPATH/i686-linux-android-ar"

./configure --enable-user=root --enable-group=root --host=i686-android-linux --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out

make -j4

-----------------------------------------------------
http://blog.csdn.net/ztguang/article/details/51030002

// -Wl,-dn -lLibraries -lWorkflowEngineD -lxerces-c -lsqlite -lstdc++ -lc -lstlport_static -Wl,-dy
// -Wl,-dy -lc -ldl -lstlport -lstdc++ -Wl,-dn
// -Wl,-v -Wl,-dy -lcrypt -Wl,-dn
-----------------------------------------------------

echo "ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}" > arm-linux.cache
echo "ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}" >> arm-linux.cache
echo "ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}" >> arm-linux.cache

./configure --enable-user=root --enable-group=root --host=i686-android-linux --enable-vtysh=no --cache-file=arm-linux.cache --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out

make -j4
-----------------------------------------------------


----------------------------------------------------------------------
android-ndk-r10e + android-21 + x86-4.8 (dynamically linked), failed
----------------------------------------------------------------------

make clean

export NDK_ROOT="/opt/android-on-linux/android-ndk-r10e"
export SYSROOT="$NDK_ROOT/platforms/android-21/arch-x86"
export CFLAGS="-g --pipe --sysroot=$SYSROOT -I$NDK_ROOT/toolchains/x86-4.8/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.8/include-fixed/ -I$NDK_ROOT/platforms/android-21/arch-x86/usr/include -I$NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include/ -I$NDK_ROOT/sources/android/support/include/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-21/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86 -lstlport_shared -lcrypt -lm -lc++ -lc"
export CPATH="/opt/android-on-linux/android-ndk-r10e/toolchains/x86-4.8/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/i686-linux-android-cpp"
export CXX="$CPATH/i686-linux-android-g++"
export CC="$CPATH/i686-linux-android-gcc"
export LD="$CPATH/i686-linux-android-ld"
export AR="$CPATH/i686-linux-android-ar"

./configure --enable-user=root --enable-group=root --host=i686-android-linux --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out

make -j4

make install

----------------------------------------------------------------------
android-ndk-r19d + android-19 + x86-4.8 (dynamically linked), failed
----------------------------------------------------------------------

make clean

export NDK_ROOT="/opt/android-on-linux/android-ndk-r9d"
export SYSROOT="$NDK_ROOT/platforms/android-19/arch-x86"
export CFLAGS="-g --pipe --sysroot=$SYSROOT -I$NDK_ROOT/toolchains/x86-4.8/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.8/include-fixed/ -I$NDK_ROOT/platforms/android-19/arch-x86/usr/include -I$NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include/ -I$NDK_ROOT/sources/android/support/include/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-19/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86 -lstlport_shared -lcrypt -lm -lc++ -lc"
export CPATH="/opt/android-on-linux/android-ndk-r9d/toolchains/x86-4.8/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/i686-linux-android-cpp"
export CXX="$CPATH/i686-linux-android-g++"
export CC="$CPATH/i686-linux-android-gcc"
export LD="$CPATH/i686-linux-android-ld"
export AR="$CPATH/i686-linux-android-ar"

./configure --enable-user=root --enable-group=root --host=i686-android-linux --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out

make -j4

make install



-------------------------------------------------------
Fedora 23, android-ndk-r12 + android-23 + x86-4.9 (dynamically linked), success
-------------------------------------------------------

++++++++++++++++++++++
../lib/.libs/libzebra.so: error: undefined reference to 'crypt'

download from (libcrypt.so.1) https://sourceforge.net/p/android-x86/bootable_newinstaller/ci/9a49bb368ac83fa339678d259ec2c6c668267db8/tree/initrd/lib/libcrypt.so.1?format=raw

cp libcrypt.so.1 /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -d libcrypt.so

---------------------------------------------
can also find it in android-x86-6.0-rc1
---------------------------------------------
[root@localhost android-x86-6.0-rc1]# pwd
/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/android-x86/android-x86-6.0-rc1

[root@localhost android-x86-6.0-rc1]# find . -name libcrypt*
./bootable/newinstaller/initrd/lib/libcrypt.so.1

that is:
/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/android-x86/android-x86-6.0-rc1/bootable/newinstaller/initrd/lib/libcrypt.so.1
---------------------------------------------
++++++++++++++++++++++

[root@localhost quagga]# gedit configure

  /* LIBS="-lcrypt $LIBS" */
  LIBS=" $LIBS"

  /* LIBS="-lm $LIBS" */
  LIBS=" $LIBS"
  /* LIBM="-lm" */
  LIBM=""

++++++++++++++++++++++
the following, no use
++++++++++++++++++++++

download libcrypto.so from https://github.com/emileb/OpenSSL-for-Android-Prebuilt

[root@localhost lib]# pwd
/root/桌面/OpenSSL-for-Android-Prebuilt-master/openssl-1.0.2/x86/lib
[root@localhost lib]# cp libcrypto.so /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -d libcrypto.so
++++++++++++++++++++++

[root@localhost quagga]# gedit lib/command.c lib/vty.c

safe_strerror(errno)  -->  "safe_strerror(errno)"

sed -i "s/__sF/exit/g" `grep "__sF" -rl ./tmp`

sed -i "s/safe_strerror(errno)/\"safe_strerror(errno)\"/g" `grep "safe_strerror(errno)" -rl ./`
sed -i "s/safe_strerror\ (errno)/\"safe_strerror(errno)\"/g" `grep "safe_strerror (errno)" -rl ./`
sed -i "s/\"safe_strerror(errno)\"/safe_strerror(errno)/g" `grep "\"safe_strerror(errno)\"" -rl ./`

sed -i "s/safe_strerror(save_errno)/\"safe_strerror(save_errno)\"/g" `grep "safe_strerror(save_errno)" -rl ./`
sed -i "s/safe_strerror\ (save_errno)/\"safe_strerror(save_errno)\"/g" `grep "safe_strerror (save_errno)" -rl ./`
sed -i "s/\"safe_strerror(save_errno)\"/safe_strerror(save_errno)/g" `grep "\"safe_strerror(save_errno)\"" -rl ./`

sed -i "s/safe_strerror(-errnum)/\"safe_strerror(-errnum)\"/g" `grep "safe_strerror(-errnum)" -rl ./`
sed -i "s/safe_strerror\ (-errnum)/\"safe_strerror(-errnum)\"/g" `grep "safe_strerror (-errnum)" -rl ./`
sed -i "s/\"safe_strerror(-errnum)\"/safe_strerror(-errnum)/g" `grep "\"safe_strerror(-errnum)\"" -rl ./`

sed -i "s/safe_strerror(en)/\"safe_strerror(en)\"/g" `grep "safe_strerror(en)" -rl ./`
sed -i "s/safe_strerror\ (en)/\"safe_strerror(en)\"/g" `grep "safe_strerror (en)" -rl ./`
sed -i "s/\"safe_strerror(en)\"/safe_strerror(en)/g" `grep "\"safe_strerror(en)\"" -rl ./`

sed -i "s/safe_strerror(sockerr)/\"safe_strerror(sockerr)\"/g" `grep "safe_strerror(sockerr)" -rl ./`
sed -i "s/safe_strerror\ (sockerr)/\"safe_strerror(sockerr)\"/g" `grep "safe_strerror (sockerr)" -rl ./`
sed -i "s/\"safe_strerror(sockerr)\"/safe_strerror(sockerr)/g" `grep "\"safe_strerror(sockerr)\"" -rl ./`


++++++++++++++++++++++

root@x86:/ # /system/xbin/quagga/zebra                                         
CANNOT LINK EXECUTABLE: cannot locate symbol "__errno_location" referenced by "/system/lib/libcrypt.so.1"...
1|root@x86:/ #

-----------------
CANNOT LINK EXECUTABLE: cannot locate symbol

If you get an error like CANNOT LINK EXECUTABLE: cannot locate symbol "signal" referenced by "gatord" on android, please ensure you are using the correct version of the Android ndk: ndk32 for 32-bit targets and ndk64 for 64-bit targets.

++++++++++++++++++++++
[root@localhost quagga]# gedit lib/crypt.c lib/crypt.h

http://blog.csdn.net/ztguang/article/details/51763624

++++++++++++++++++++++

[root@localhost quagga]# gedit lib/command.c

#include <crypt.h>

[root@localhost quagga]# gedit lib/Makefile.am                 // add crypt.c & crypt.h

libzebra_la_SOURCES = \
    network.c pid_output.c getopt.c getopt1.c daemon.c \
    checksum.c vector.c linklist.c vty.c built.c command.c crypt.c \

pkginclude_HEADERS = \
    buffer.h checksum.h command.h crypt.h filter.h getopt.h hash.h \

++++++++++++++++++++++
/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: error: ../lib/.libs/libzebra.a(thread.o): multiple definition of 'thread_timer_remain_second'
/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin/ld: xpimd-zebra_thread.o: previous definition here
-------

[root@localhost quagga]# gedit ./xpimd/zebra_thread.hh ./xpimd/zebra_thread.cc

funcname_  -->  zt_
thread_  -->  zt_thread_

++++++++++++++++++++++

[root@localhost quagga]#

--------------------------
export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lcrypt -lm -lc++ -lc"

export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lm -lc++ -lc"

export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -lcrypt -Wl,-dn -lstlport_static -lm -lc++ -lc -Wl,-dy"

export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -static -Wl,-dn -lstlport_static -lm -lc++ -lc -Wl,-dy"

// -Wl,-soname -Wl,libzebra.so -o .libs/libzebra.so


--------------------------
can be successful (dynamically)
--------------------------
export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lm -lc++ -lc"

export LDFLAGS="--sysroot=$SYSROOT -fPIE -pie -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lm -lc++ -lc"
--------------------------

--------------------------
can be successful (static)
--------------------------
export LDFLAGS="--sysroot=$SYSROOT -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -static -lstlport_static -lm -lc++ -lc"
--------------------------

--------------------------
GCC: -static and -pie are incompatible for x86
--------------------------
Android 5+ —— error: only position independent executables (PIE) are supported.

CFLAGS += -fPIE
LDFLAGS += -fPIE -pie

such as:
export CFLAGS="-I/softdev/arm-libs/include -fPIE"
export CPPLAGS="$CPPFLAGS -fPIE"
export CXXLAGS="$CXXFLAGS -fPIE"
export LDFLAGS="-L/softdev/arm-libs/lib -static -fPIE -pie"
--------------------------


--------------------------
(OK)(OK)(OK) (x86)
--------------------------

-----------------------
export LDFLAGS="--sysroot=$SYSROOT -fPIE -pie -fuse-ld=bfd -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lm -lc++ -lc"
-----------------------

./bootstrap.sh


make clean

export NDK_ROOT="/opt/android-on-linux/android-ndk-r12"
export SYSROOT="$NDK_ROOT/platforms/android-23/arch-x86"
export CFLAGS="-g --pipe --sysroot=$SYSROOT -fPIE -I$NDK_ROOT/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/include-fixed/ -I$NDK_ROOT/platforms/android-23/arch-x86/usr/include -I$NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include/ -I$NDK_ROOT/sources/android/support/include/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="--sysroot=$SYSROOT -fPIE -pie -L$NDK_ROOT/platforms/android-23/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lm -lc++ -lc"
export CPATH="/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/i686-linux-android-cpp"
export CXX="$CPATH/i686-linux-android-g++"
export CC="$CPATH/i686-linux-android-gcc"
export LD="$CPATH/i686-linux-android-ld"
export AR="$CPATH/i686-linux-android-ar"

./configure --enable-user=root --enable-group=root --host=i686-android-linux --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out

----------------------------------------
[root@localhost quagga]# gedit Makefile
//INCLUDES = -I/usr/inet6/include
INCLUDES =
----------------------------------------

make -j4

make install

ll -h out/sbin
ll -h out/lib

adb push out/sbin/ /system/xbin/quagga/
adb push out/lib/libzebra.so /lib/
adb push out/lib/libospf.so /lib/
adb push out/lib/libospfapiclient.so /lib/

----------------------------------------


----------------------------------------------------
(OK)(OK)(OK) (x86) —— android-x86-4.4-r5 (API 19)
----------------------------------------------------

-----------------------
export LDFLAGS="--sysroot=$SYSROOT -fPIE -pie -fuse-ld=bfd -L$NDK_ROOT/platforms/android-19/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lm -lc++ -lc"
-----------------------

./bootstrap.sh


make clean

export NDK_ROOT="/opt/android-on-linux/android-ndk-r12"
export SYSROOT="$NDK_ROOT/platforms/android-19/arch-x86"
export CFLAGS="-g --pipe --sysroot=$SYSROOT -fPIE -I$NDK_ROOT/toolchains/x86-4.9/prebuilt/linux-x86_64/lib/gcc/i686-linux-android/4.9.x/include-fixed/ -I$NDK_ROOT/platforms/android-19/arch-x86/usr/include -I$NDK_ROOT/platforms/android-21/arch-x86/usr/include -I$NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include/ -I$NDK_ROOT/sources/android/support/include/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="--sysroot=$SYSROOT -fPIE -pie -L$NDK_ROOT/platforms/android-19/arch-x86/usr/lib/ -L$NDK_ROOT/platforms/android-21/arch-x86/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86 -lstlport_shared -lm -lc++ -lc"
export CPATH="/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/i686-linux-android-cpp"
export CXX="$CPATH/i686-linux-android-g++"
export CC="$CPATH/i686-linux-android-gcc"
export LD="$CPATH/i686-linux-android-ld"
export AR="$CPATH/i686-linux-android-ar"

./configure --enable-user=root --enable-group=root --host=i686-android-linux --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out

----------------------------------------
[root@localhost quagga]# gedit Makefile
//INCLUDES = -I/usr/inet6/include
INCLUDES =
----------------------------------------

make -j4

make install

ll -h out/sbin
ll -h out/lib

adb push out/sbin/ /system/xbin/quagga/
adb push out/lib/libzebra.so /lib/
adb push out/lib/libospf.so /lib/
adb push out/lib/libospfapiclient.so /lib/

----------------------------------------

[root@localhost quagga]# ll -h out/sbin/
总用量 23M
-rwxr-xr-x. 1 root root 242K 6月  25 21:58 babeld
-rwxr-xr-x. 1 root root 1.6M 6月  25 21:58 bgpd
-rwxr-xr-x. 1 root root 1.1M 6月  25 21:58 ospf6d
-rwxr-xr-x. 1 root root  19K 6月  25 21:58 ospfclient
-rwxr-xr-x. 1 root root  20K 6月  25 21:58 ospfd
-rwxr-xr-x. 1 root root 271K 6月  25 21:58 ripd
-rwxr-xr-x. 1 root root 231K 6月  25 21:58 ripngd
-rwxr-xr-x. 1 root root  51K 6月  25 21:58 watchquagga
-rwxr-xr-x. 1 root root  19M 6月  25 21:58 xpimd
-rwxr-xr-x. 1 root root 390K 6月  25 21:58 zebra
[root@localhost quagga]#

-----------------------------------------------------



----------------------------------------------------------------------
(OK)(OK)(OK) (x86_64) —— android-x86_64-6.0-rc1 (API 23)
----------------------------------------------------------------------

./bootstrap.sh


make clean

export NDK_ROOT="/opt/android-on-linux/android-ndk-r12"
export SYSROOT="$NDK_ROOT/platforms/android-23/arch-x86_64"
export CFLAGS="-g --pipe --sysroot=$SYSROOT -fPIE -I$NDK_ROOT/toolchains/x86_64-4.9/prebuilt/linux-x86_64/lib/gcc/x86_64-linux-android/4.9.x/include-fixed/ -I$NDK_ROOT/platforms/android-23/arch-x86_64/usr/include -I$NDK_ROOT/sources/cxx-stl/llvm-libc++/libcxx/include/ -I$NDK_ROOT/sources/android/support/include/"
export CPPFLAGS="$CFLAGS"
export CXXFLAGS="$CFLAGS"
export LDFLAGS="--sysroot=$SYSROOT -fPIE -pie -L$NDK_ROOT/platforms/android-23/arch-x86_64/usr/lib/ -L$NDK_ROOT/sources/cxx-stl/stlport/libs/x86_64 -L$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/x86_64 -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64 -lstlport_shared -lm -lc++ -lc"
export CPATH="/opt/android-on-linux/android-ndk-r12/toolchains/x86_64-4.9/prebuilt/linux-x86_64/bin"
export CPP="$CPATH/x86_64-linux-android-cpp"
export CXX="$CPATH/x86_64-linux-android-g++"
export CC="$CPATH/x86_64-linux-android-gcc"
export LD="$CPATH/x86_64-linux-android-ld"
export AR="$CPATH/x86_64-linux-android-ar"

./configure --enable-user=root --enable-group=root --host=x86_64-android-linux --exec-prefix=/opt/android-on-linux/quagga/out --prefix=/opt/android-on-linux/quagga/out

make -j4

make install

ll -h out/sbin
ll -h out/lib
ll -h out/etc

----------------------------------------
root@x86:/ #
mount -o remount,rw /system
mount -o remount,rw /

----------------------------------------

adb shell mkdir -p /system/xbin/quagga/etc

adb push out/sbin/ /system/xbin/quagga/
adb push out/lib/libzebra.so /system/lib64/
adb push out/lib/libospf.so /system/lib64/
adb push out/lib/libospfapiclient.so /system/lib64/

adb push /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/stlport/libs/x86_64/libstlport_shared.so /system/lib64/
adb push /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libs/x86_64/libc++_shared.so /system/lib64/

[root@localhost quagga]#
cp out/etc/zebra.conf.sample out/etc/zebra.conf
cp out/etc/ospf6d.conf.sample out/etc/ospf6d.conf
gedit out/etc/ospf6d.conf
-----------------------------------------
interface eth0
 ipv6 ospf6 priority 1
 ipv6 ospf6 transmit-delay 1
 ipv6 ospf6 ifmtu 1500
 ipv6 ospf6 cost 1
 ipv6 ospf6 hello-interval 2
 ipv6 ospf6 dead-interval 6
 ipv6 ospf6 retransmit-interval 5
 ipv6 ospf6 network manet-designated-router
 ipv6 ospf6 ackinterval 1800
 ipv6 ospf6 backupwaitinterval 2000
 ipv6 ospf6 twohoprefresh 3
 ipv6 ospf6 hellorepeatcount 3
 ipv6 ospf6 adjacencyconnectivity biconnected
 ipv6 ospf6 lsafullness mdrfulllsa
 ipv6 ospf6 flood-delay 100
!
 
router ospf6
 instance-id 65
! router-id 10.1.0.1 (Note: Each node is not the same) (line 21)
 interface eth0 area 0.0.0.0
 protocol-traffic-class 184
 redistribute ospf
 redistribute connected
!
-----------------------------------------

adb shell mkdir -p /system/xbin/quagga/etc
adb shell mkdir -p /opt/android-on-linux/quagga/out/etc

adb push out/etc/zebra.conf /system/xbin/quagga/etc/
adb push out/etc/ospf6d.conf /system/xbin/quagga/etc/

adb shell cp /system/xbin/quagga/etc/zebra.conf /opt/android-on-linux/quagga/out/etc/
adb shell cp /system/xbin/quagga/etc/ospf6d.conf /opt/android-on-linux/quagga/out/etc/

-----------------------------------------

root@x86_64:/ #
/system/xbin/quagga/zebra -d
/system/xbin/quagga/ospf6d -d
ps
--------------------
root      3135  1     8112   732            0 7fa5ddac075a S /system/xbin/quagga/zebra
root      3138  1     8704   2344           0 7f8ae094a75a S /system/xbin/quagga/ospf6d
root      3139  3014  5800   1844           0 7f3fd2f7a457 R ps
--------------------

//  /system/xbin/quagga/zebra -d -f /etc/zebra.conf
//  /system/xbin/quagga/ospf6d -d -f /etc/ospf6d.conf

-----------------------------------------

adb connect 192.168.58.102:5555
adb devices
adb -s 192.168.58.102:5555 root
adb -s 192.168.58.102:5555 shell

adb disconnect 192.168.58.102:5555


----------------------------------------------------------------------
the following commands should be included in seem-tools-CLI-semi-auto.sh
----------------------------------------------------------------------
adb shell mkdir -p /opt/android-on-linux/quagga/out/etc
adb shell cp /system/xbin/quagga/etc/zebra.conf /opt/android-on-linux/quagga/out/etc/
adb shell cp /system/xbin/quagga/etc/ospf6d.conf /opt/android-on-linux/quagga/out/etc/
adb shell /system/xbin/quagga/zebra -d
adb shell /system/xbin/quagga/ospf6d -d
----------------------------------------------------------------------

------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
So far, cross compile successfully quagga-0.99.21mr2.2 for android-x86_64 in Fedora23
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------
(OK) install chrome & busybox in android-x86_64 —— uninstall chrome
------------------------------------------------------------------------------------------------
http://www.apkmirror.com/wp-content/uploads/uploaded/5758ac63cb322/com.android.chrome_51.0.2704.81-270408111_minAPI21(x86)(nodpi)_apkmirror.com.apk


[root@localhost apk]# pwd
/opt/android-on-linux/apk
[root@localhost apk]# ls
chrome.dev-53.0.2767.6.apk
[root@localhost apk]#

adb push chrome.dev-53.0.2767.6.apk /sdcard/Download/
adb push chrome_51.0.2704.81.apk /sdcard/Download/

adb push /opt/tools/busybox/busybox-x86_64 /system/xbin/

--------------------
//  must be under the root directory

root@x86_64:/ #
cd /
pm install /sdcard/Download/chrome.dev-53.0.2767.6.apk            (can not work)
pm install /sdcard/Download/chrome_51.0.2704.81.apk

root@x86_64:/ # pm list packages|grep chrome                                   
package:com.android.chrome
package:com.chrome.dev
root@x86_64:/ # pm uninstall com.chrome.dev

------------------------------------------------------------------------------------------------
(OK)(OK) Creating VMs from an existing VDI file in CLI (VBoxManage) in Fedora 23
------------------------------------------------------------------------------------------------
[root@localhost virtualbox-os]#
cp android-x86_64-6.0-rc1-0.vdi android-x86_64-6.0-rc1-1.vdi; cp android-x86_64-6.0-rc1-0.vdi android-x86_64-6.0-rc1-2.vdi; cp android-x86_64-6.0-rc1-0.vdi android-x86_64-6.0-rc1-3.vdi; cp android-x86_64-6.0-rc1-0.vdi android-x86_64-6.0-rc1-4.vdi; cp android-x86_64-6.0-rc1-0.vdi android-x86_64-6.0-rc1-5.vdi;

VBoxManage internalcommands dumphdinfo android-x86_64-6.0-rc1-1.vdi

VBoxManage internalcommands sethduuid android-x86_64-6.0-rc1-1.vdi
VBoxManage internalcommands sethduuid android-x86_64-6.0-rc1-2.vdi
VBoxManage internalcommands sethduuid android-x86_64-6.0-rc1-3.vdi
VBoxManage internalcommands sethduuid android-x86_64-6.0-rc1-4.vdi
VBoxManage internalcommands sethduuid android-x86_64-6.0-rc1-5.vdi



VBoxManage createvm --name android-x86_64-6.0-rc1-1 --ostype Linux_64 --register
VBoxManage modifyvm android-x86_64-6.0-rc1-1 --memory 1024 --vram 128 --usb off --audio pulse --audiocontroller sb16 --acpi on --rtcuseutc off --boot1 disk --boot2 dvd --nic1 bridged --bridgeadapter1 virbr0
VBoxManage storagectl android-x86_64-6.0-rc1-1 --name "IDE Controller" --add ide --controller PIIX4
VBoxManage storageattach android-x86_64-6.0-rc1-1 --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium android-x86_64-6.0-rc1-1.vdi

VBoxManage showvminfo android-x86_64-6.0-rc1-1

VBoxManage startvm android-x86_64-6.0-rc1-1

VBoxManage controlvm android-x86_64-6.0-rc1-1 poweroff
    //pause|resume|reset|poweroff|savestate|acpipowerbutton|acpisleepbutton|

// delete VM
VBoxManage unregistervm android-x86_64-6.0-rc1-1
rm /root/VirtualBox\ VMs/android-x86_64-6.0-rc1-1 -rf

//VBoxManage unregistervm android-x86_64-6.0-rc1-1 [--delete]
------------------------------------------------------------------------------------------------




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
running Android-x86 in VirtualBox, install quagga-0.99.21mr2.2 in Android-x86
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

-------------------------------------------------------
first, install quagga-mdr in android-x86-6.0-rc1-1
-------------------------------------------------------

------------------------------------------------
Android adb connect (android-x86-6.0-rc1-1)
------------------------------------------------
to set up the first android-x86 VM in VirtualBox.
 ---> VirtualBox > (android-x86-6.0-rc1-1) > Settings > Network > Adapter 1 > Host-only.
 ---> (android-x86-6.0-rc1-1) > (Alt+F1) > ifconfig (or netcfg) > 192.168.56.101
 ---> HOST: ping 192.168.56.101

[root@localhost ~]#
adb connect 192.168.56.101:5555
adb devices
adb -s 192.168.56.101:5555 root
adb -s 192.168.56.101:5555 shell

adb disconnect 192.168.56.101:5555

root@x86:/ #
mount -o remount,rw /system

[root@localhost quagga]# pwd
/opt/android-on-linux/quagga
[root@localhost quagga]#

adb shell mkdir /system/xbin/quagga
adb shell ls /system/xbin/quagga
adb shell ls /lib/
adb shell cp /lib/libc.so.org /lib/libc.so

adb push out/sbin/ /system/xbin/quagga/

adb push out/lib/libzebra.so /lib/
adb push out/lib/libospf.so /lib/
adb push out/lib/libospfapiclient.so /lib/

adb push /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/stlport/libs/x86/libstlport_shared.so /lib/
adb push /opt/android-on-linux/android-ndk-r12/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so /lib/

-----------------------------------
adb pull /lib/libc.so /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so-android-x86-6
hte /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so-android-x86-6
    libc.so --> libc.so.6

adb push /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so-android-x86-6 /lib/libc.so.6

adb push /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so /lib/libc.so.6

---------------use the following
hte /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so
    libc.so --> libc.so.6

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -d
/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-ld -d

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-nm /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so-android-x86-6 |grep __sF

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-nm /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so |grep __sF

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -a  out/sbin/zebra

---------------not use the following
hte /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so
hte /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so.1-android-x86-6
    libc.so.6 --> libc.so

-----------------------------------
[root@localhost android-x86-6.0-rc1]# find . -name libcrypt*
./bootable/newinstaller/initrd/lib/libcrypt.so.1

[root@localhost android-x86-6.0-rc1]# cp ./bootable/newinstaller/initrd/lib/libcrypt.so.1 /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so.1-android-x86-6

-----------------------------------

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-objdump -d /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -d /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so

-----------------------------------
adb push /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so.1-android-x86-6 /lib/libcrypt.so.1
adb push /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libcrypt.so /lib/libcrypt.so.1
adb push /opt/android-on-linux/android-ndk-r12/platforms/android-23/arch-x86/usr/lib/libc.so /lib/libc.so.6

+++++++++++++++++++++++++++++++++++
adb push /opt/android-on-linux/android-ndk-r10e/sources/cxx-stl/stlport/libs/x86/libstlport_shared.so /lib/
adb push /opt/android-on-linux/android-ndk-r10e/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so /lib/
adb push /opt/android-on-linux/android-ndk-r10e/platforms/android-21/arch-x86/usr/lib/libcrypt.so /lib/libcrypt.so.1
adb push /opt/android-on-linux/android-ndk-r10e/platforms/android-21/arch-x86/usr/lib/libc.so /lib/libc.so.6

-----------------------------------
adb push /opt/android-on-linux/android-ndk-r9d/sources/cxx-stl/stlport/libs/x86/libstlport_shared.so /lib/
adb push /opt/android-on-linux/android-ndk-r9d/sources/cxx-stl/llvm-libc++/libs/x86/libc++_shared.so /lib/
adb push /opt/android-on-linux/android-ndk-r9d/platforms/android-21/arch-x86/usr/lib/libcrypt.so /lib/libcrypt.so.1
adb push /opt/android-on-linux/android-ndk-r9d/platforms/android-21/arch-x86/usr/lib/libc.so /lib/libc.so.6

-----------------------------------
root@x86:/ # ls -l /lib/libc.so*                                             
-rw-r--r-- root     root      1144696 2016-06-14 12:23 libc.so
-rwxrwxrwx root     root       131656 2016-06-01 04:56 libc.so.6
root@x86:/ #
-----------------------------------


------------------------------------------------------------------------------------------------

root@x86:/ #
chmod 755 /system/xbin/busybox-i686
busybox-i686 ls

-----------------------------------
/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -d out/lib/libzebra.so |grep soname

 0x0000000e (SONAME)                     Library soname: [libzebra.so]

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -d platforms/android-23/arch-x86/usr/lib/libcrypt.so |grep soname

 0x0000000e (SONAME)                     Library soname: [libcrypt.so.1]

/opt/android-on-linux/android-ndk-r12/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-readelf -d platforms/android-23/arch-x86/usr/lib/libc.so |grep soname

 0x0000000e (SONAME)                     Library soname: [libc.so]   ???? should be [libc.so.6]


-----------------------------------

-----------
in Android
-----------
-------------------------------------
// in HOST
[root@localhost busybox]# adb push busybox-x86_64 /data
[root@localhost busybox]# adb shell

// in Android
root@vbox86p:/ # cd data/
chmod 755 busybox-x86_64
-------------------------------------
// in Android

netcfg eth1 down
./busybox-x86_64 ifconfig eth1 down
./busybox-x86_64 ifconfig eth1 10.1.1.2 netmask 255.255.255.0 up

// ./busybox-x86_64 ip addr add 10.1.1.2/24 dev eth1
// ./busybox-x86_64 ip route add default via 10.1.1.1 dev eth1

./busybox-x86_64 route -n
./busybox-x86_64 ifconfig
./busybox-x86_64 ping 10.1.1.2
-----------

-------------------------------------
ifconfig br-android down
brctl delif br-android tap-left
brctl delif br-android eth1
brctl delbr br-android
ifconfig tap-left down
tunctl -d tap-left
//ip link delete veth_android44
//ip link delete X
-------------------------------------

http://cygnus.androidapksfree.com/hulk/com.UCMobile.intl_v10.10.0.796-238_Android-2.3.apk

http://www.apkmirror.com/wp-content/uploads/uploaded/5758ac63cb322/com.android.chrome_51.0.2704.81-270408111_minAPI21(x86)(nodpi)_apkmirror.com.apk
------------------------------------------------------------


--------------------------------------------------------------------------
netcat transfer file to android from fedora23
--------------------------------------------------------------------------
Server (fedora23)
[root@localhost Desktop]# pwd
/root/Desktop
[root@localhost Desktop]# ls cm-browser5-20-38.apk
cm-browser5-20-38.apk
[root@localhost Desktop]#
iptables -I INPUT -p tcp --dport 12123 -j ACCEPT
iptables -D INPUT -p tcp --dport 12123 -j ACCEPT
nc -l 12123 < chrome51.apk

Client (android)
nc 10.108.162.164 12123 > chrome51.apk

Client (fedora/linux)
nc -n 10.108.162.164 12123 > chrome51.apk

--------------------------------
nc -l 12123 > config.log
nc -n 172.17.0.1 12123  < config.log

--------------------------------------------------------------------------
Android 6.0 (Marshmallow) Install apk - INSTALL_FAILED_INVALID_URI
--------------------------------------------------------------------------

must be under the root directory:

cd /
pm install /sdcard/Download/chrome51.apk

Success
-------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++






-------------------------------------------------------
So far, we have installed quagga-mdr in android-x86-6.0-rc1-1 successfully.
-------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
running five Android-x86 in VirtualBox, they connect to NS3(MANETs) via "ethernet bridge"
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


-----------
in HOST
-----------

brctl addbr br_a_1
tunctl -t tap_a_1
ifconfig tap_a_1 0.0.0.0 promisc up
brctl addif br_a_1 tap_a_1
ifconfig br_a_1 up

brctl addbr br_a_2
tunctl -t tap_a_2
ifconfig tap_a_2 0.0.0.0 promisc up
brctl addif br_a_2 tap_a_2
ifconfig br_a_2 up

brctl addbr br_a_3
tunctl -t tap_a_3
ifconfig tap_a_3 0.0.0.0 promisc up
brctl addif br_a_3 tap_a_3
ifconfig br_a_3 up

brctl addbr br_a_4
tunctl -t tap_a_4
ifconfig tap_a_4 0.0.0.0 promisc up
brctl addif br_a_4 tap_a_4
ifconfig br_a_4 up

brctl addbr br_a_5
tunctl -t tap_a_5
ifconfig tap_a_5 0.0.0.0 promisc up
brctl addif br_a_5 tap_a_5
ifconfig br_a_5 up

----------------------
//You will also have to make sure that your kernel has ethernet filtering (ebtables, bridge-nf, arptables) disabled. If you do not do this, only STP and ARP traffic will be allowed to flow across your bridge and your whole scenario will not work.

[root@localhost ~]#

cd /proc/sys/net/bridge
for f in bridge-nf-*; do echo 0 > $f; done
cd -

-----------

[root@localhost virtualbox-os]# pwd
/run/media/root/158a840e-63fa-4544-b0b8-dc0d40c79241/virtualbox-os

[root@localhost virtualbox-os]# ll -h
-rw-------. 1 root root 5.1G 6月  14 21:24 android-x86-6.0-rc1-1.vdi
-rw-------. 1 root root 5.1G 6月  14 21:17 android-x86-6.0-rc1-2.vdi
-rw-------. 1 root root 5.1G 6月  14 21:17 android-x86-6.0-rc1-3.vdi
-rw-------. 1 root root 5.1G 6月  14 21:17 android-x86-6.0-rc1-4.vdi
-rw-------. 1 root root 5.1G 6月  14 21:17 android-x86-6.0-rc1-5.vdi
[root@localhost virtualbox-os]#

-----------

to set up the first android-x86 VM in VirtualBox.
 ---> VirtualBox > (android-x86-6.0-rc1-1) > Settings > Network > Adapter 1 > bridge, br_a_1.

to set up the second android-x86 VM in VirtualBox.
 ---> VirtualBox > (android-x86-6.0-rc1-2) > Settings > Network > Adapter 1 > bridge, br_a_2.

to set up the second android-x86 VM in VirtualBox.
 ---> VirtualBox > (android-x86-6.0-rc1-3) > Settings > Network > Adapter 1 > bridge, br_a_3.

to set up the second android-x86 VM in VirtualBox.
 ---> VirtualBox > (android-x86-6.0-rc1-4) > Settings > Network > Adapter 1 > bridge, br_a_4.

to set up the second android-x86 VM in VirtualBox.
 ---> VirtualBox > (android-x86-6.0-rc1-5) > Settings > Network > Adapter 1 > bridge, br_a_5.

-----------

-----------
// in android-x86-6.0-rc1-1
-----------
ip addr add 172.17.0.1/16 dev eth0
ping 172.17.0.5

-----------
// in android-x86-6.0-rc1-5
-----------
ip addr add 172.17.0.5/16 dev eth0
ping 172.17.0.1

//ifconfig eth0 down
//ifconfig eth0 192.168.26.20 netmask 255.255.255.0 up

------------------------------------------------------------------------------------------
android-x86-6.0-rc1-1 can not ping android-x86-6.0-rc1-5
------------------------------------------------------------------------------------------


-----------------------
running NS3
-----------------------
[root@localhost ~]# cd /opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25

[root@localhost ns-3.25]# gedit scratch/manet-android-x86.cc
//----------------
  TapBridgeHelper tapBridge;
  tapBridge.SetAttribute ("Mode", StringValue ("UseLocal"));

  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_a_1"));
  tapBridge.Install (nodes.Get (0), devices.Get (0));

  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_a_2"));
  tapBridge.Install (nodes.Get (1), devices.Get (1));

  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_a_3"));
  tapBridge.Install (nodes.Get (2), devices.Get (2));

  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_a_4"));
  tapBridge.Install (nodes.Get (3), devices.Get (3));

  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_a_5"));
  tapBridge.Install (nodes.Get (4), devices.Get (4));

//----------------

[root@localhost ns-3.25]# ./waf --run manet-android-x86 --vis


------------------------------------------------------------------------------------------
android-x86-6.0-rc1-1 can ping android-x86-6.0-rc1-5 successfully, and vice verse
------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------
clean
------------------------------------------------------------------------------------------
ifconfig br_a_1 down
brctl delif br_a_1 tap_a_1
brctl delbr br_a_1
ifconfig tap_a_1 down
tunctl -d tap_a_1

ifconfig br_a_2 down
brctl delif br_a_2 tap_a_2
brctl delbr br_a_2
ifconfig tap_a_2 down
tunctl -d tap_a_2

ifconfig br_a_3 down
brctl delif br_a_3 tap_a_3
brctl delbr br_a_3
ifconfig tap_a_3 down
tunctl -d tap_a_3

ifconfig br_a_4 down
brctl delif br_a_4 tap_a_4
brctl delbr br_a_4
ifconfig tap_a_4 down
tunctl -d tap_a_4

ifconfig br_a_5 down
brctl delif br_a_5 tap_a_5
brctl delbr br_a_5
ifconfig tap_a_5 down
tunctl -d tap_a_5

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So far, all is OK
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


posted @ 2016-06-22 23:00  张同光  阅读(112)  评论(0编辑  收藏  举报