(OK)(OK) experiment - mptcp on Android-x86-kernel-4.4.12 (SUCCESS)

来源:互联网 发布:物品识别软件 编辑:程序博客网 时间:2024/06/01 09:15



mptcp-experiment.txt

eth0 (android-1) <--> br_m_11 <--> tap_m_11 <--> switch1 (NS3) <--> tap_m_12 <--> br_m_12 <--> eth0 (android-2)eth1 (android-1) <--> br_m_21 <--> tap_m_21 <--> switch2 (NS3) <--> tap_m_22 <--> br_m_22 <--> eth1 (android-2)(android-1)ifconfig eth0 112.26.1.1/24 upifconfig eth1 112.26.2.1/24 up(android-2)ifconfig eth0 112.26.1.2/24 upifconfig eth1 112.26.2.2/24 up[root@localhost fedora23server-share]# cp seem_mptcp_switch.cc /opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25/scratch/cd /opt/tools/network_simulators/ns3/ns-allinone-3.25/ns-3.25./waf --run scratch/seem_mptcp_switch --vis------------------wps-office-10.1.0.5444-1.a20.x86_64.rpm (79MB)(android-1)adb connect 192.168.56.3 && adb -s 192.168.56.3 rootadb shell mount -o remount,rw /systemadb shell mount -o remount,rw /adb push /opt/tools/wps-office-10.1.0.5444-1.a20.x86_64.rpm /data/wps-office.rpm------------------(android-1)  nc -l 12123 < /data/wps-office.rpm        netstat -naupt        0.0.0.0:33186(android-2)  nc 112.26.1.1 12123 > wps-office.rpm        nc 112.26.1.1 33186 > wps-office.rpmtcpdump -vv -n -i br_m_11tcpdump -vv -n -i br_m_21+++++++++++++++++++++++++++++++++++++++++++++++++tunctl -t tap_m_11ifconfig tap_m_11 upbrctl addbr br_m_11brctl addif br_m_11 tap_m_11ifconfig br_m_11 uptunctl -t tap_m_12ifconfig tap_m_12 upbrctl addbr br_m_12brctl addif br_m_12 tap_m_12ifconfig br_m_12 uptunctl -t tap_m_21ifconfig tap_m_21 upbrctl addbr br_m_21brctl addif br_m_21 tap_m_21ifconfig br_m_21 uptunctl -t tap_m_22ifconfig tap_m_22 upbrctl addbr br_m_22brctl addif br_m_22 tap_m_22ifconfig br_m_22 up+++++++++++++++++++++++++++++++++++++++++++++++++ifconfig br_m_11 downbrctl delif br_m_11 tap_m_11brctl delbr br_m_11ifconfig tap_m_11 downtunctl -d tap_m_11ifconfig br_m_12 downbrctl delif br_m_12 tap_m_12brctl delbr br_m_12ifconfig tap_m_12 downtunctl -d tap_m_12ifconfig br_m_21 downbrctl delif br_m_21 tap_m_21brctl delbr br_m_21ifconfig tap_m_21 downtunctl -d tap_m_21ifconfig br_m_22 downbrctl delif br_m_22 tap_m_22brctl delbr br_m_22ifconfig tap_m_22 downtunctl -d tap_m_22+++++++++++++++++++++++++++++++++++++++++++++++++

seem_mptcp_switch.cc

/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- *//* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */// Network topology////    (android-1)    eth0   eth1//                    n0     n2//                    |      |//                   ---   ----//                   |S1|  |S2|//                   ---   ----//                    |      |//                    n1     n3//    (android-2)    eth0   eth1// eth0 (android-1) <--> br_m_11 <--> tap_m_11 <--> switch1 (NS3) <--> tap_m_12 <--> br_m_12 <--> eth0 (android-2)// eth1 (android-1) <--> br_m_21 <--> tap_m_21 <--> switch2 (NS3) <--> tap_m_22 <--> br_m_22 <--> eth1 (android-2)//// - CBR/UDP flows from n0 to n1 and from n3 to n0// - DropTail queues// - Tracing of queues and packet receptions to file "openflow-switch.tr"// - If order of adding nodes and netdevices is kept://      n0 = 00:00:00;00:00:01, n1 = 00:00:00:00:00:03, n3 = 00:00:00:00:00:07//and port number corresponds to node number, so port 0 is connected to n0, for example.#include <iostream>#include <fstream>#include "ns3/core-module.h"#include "ns3/network-module.h"#include "ns3/csma-module.h"#include "ns3/openflow-module.h"#include "ns3/tap-bridge-module.h"#include "ns3/log.h"using namespace ns3;NS_LOG_COMPONENT_DEFINE ("OpenFlowCsmaSwitchWin7");bool verbose = false;bool use_drop = false;ns3::Time timeout = ns3::Seconds (0);boolSetVerbose (std::string value){  verbose = true;  return true;}boolSetDrop (std::string value){  use_drop = true;  return true;}boolSetTimeout (std::string value){  try {      timeout = ns3::Seconds (atof (value.c_str ()));      return true;    }  catch (...) { return false; }  return false;}intmain (int argc, char *argv[]){  //int num=5;  #ifdef NS3_OPENFLOW  //  // Allow the user to override any of the defaults and the above Bind() at  // run-time, via command-line arguments  //  CommandLine cmd;  cmd.AddValue ("v", "Verbose (turns on logging).", MakeCallback (&SetVerbose));  cmd.AddValue ("verbose", "Verbose (turns on logging).", MakeCallback (&SetVerbose));  cmd.AddValue ("d", "Use Drop Controller (Learning if not specified).", MakeCallback (&SetDrop));  cmd.AddValue ("drop", "Use Drop Controller (Learning if not specified).", MakeCallback (&SetDrop));  cmd.AddValue ("t", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback ( &SetTimeout));  cmd.AddValue ("timeout", "Learning Controller Timeout (has no effect if drop controller is specified).", MakeCallback ( &SetTimeout));  cmd.Parse (argc, argv);  if (verbose)    {      LogComponentEnable ("OpenFlowCsmaSwitchExample", LOG_LEVEL_INFO);      LogComponentEnable ("OpenFlowInterface", LOG_LEVEL_INFO);      LogComponentEnable ("OpenFlowSwitchNetDevice", LOG_LEVEL_INFO);    }  //  // Explicitly create the nodes required by the topology (shown above).  //  NS_LOG_INFO ("Create nodes.");  NodeContainer nodes;  nodes.Create (4);  NodeContainer csmaSwitch;  csmaSwitch.Create (2);  NS_LOG_INFO ("Build Topology");  CsmaHelper csma;  csma.SetChannelAttribute ("DataRate", DataRateValue (5000000));  csma.SetChannelAttribute ("Delay", TimeValue (MilliSeconds (2)));  //-------------------------------------------------------------------------Switch1  // Create the csma links, from each terminal to the switch  NetDeviceContainer terminalDevices;  NetDeviceContainer switchDevice1;  for (int i = 0; i < 2; i++)  {      NetDeviceContainer link = csma.Install (NodeContainer (nodes.Get (i), csmaSwitch.Get (0)));      terminalDevices.Add (link.Get (0));      switchDevice1.Add (link.Get (1));  }  // Create the switch netdevice, which will do the packet switching  Ptr<Node> switchNode1 = csmaSwitch.Get (0);  OpenFlowSwitchHelper swtch1;  if (use_drop)  {      Ptr<ns3::ofi::DropController> controller1 = CreateObject<ns3::ofi::DropController> ();      swtch1.Install (switchNode1, switchDevice1, controller1);  }  else  {      Ptr<ns3::ofi::LearningController> controller1 = CreateObject<ns3::ofi::LearningController> ();      if (!timeout.IsZero ()) controller1->SetAttribute ("ExpirationTime", TimeValue (timeout));      swtch1.Install (switchNode1, switchDevice1, controller1);  }  //-------------------------------------------------------------------------Switch1  //-------------------------------------------------------------------------Switch2  //NetDeviceContainer terminalDevices;  NetDeviceContainer switchDevice2;  for (int i = 2; i < 4; i++)  {      NetDeviceContainer link = csma.Install (NodeContainer (nodes.Get (i), csmaSwitch.Get (1)));      terminalDevices.Add (link.Get (0));      switchDevice2.Add (link.Get (1));  }  // Create the switch netdevice, which will do the packet switching  Ptr<Node> switchNode2 = csmaSwitch.Get (1);  OpenFlowSwitchHelper swtch2;  if (use_drop)  {      Ptr<ns3::ofi::DropController> controller2 = CreateObject<ns3::ofi::DropController> ();      swtch2.Install (switchNode2, switchDevice2, controller2);  }  else  {      Ptr<ns3::ofi::LearningController> controller2 = CreateObject<ns3::ofi::LearningController> ();      if (!timeout.IsZero ()) controller2->SetAttribute ("ExpirationTime", TimeValue (timeout));      swtch2.Install (switchNode2, switchDevice2, controller2);  }  //-------------------------------------------------------------------------Switch2  //  // Configure tracing of all enqueue, dequeue, and NetDevice receive events.  // Trace output will be sent to the file "openflow-switch.tr"  //  AsciiTraceHelper ascii;  csma.EnableAsciiAll (ascii.CreateFileStream ("seem-mptcp-switch.tr"));  //  // Also configure some tcpdump traces; each interface will be traced.  // The output files will be named:  //     openflow-switch-<nodeId>-<interfaceId>.pcap  // and can be read by the "tcpdump -r" command (use "-tt" option to  // display timestamps correctly)  //  csma.EnablePcapAll ("seem-mptcp-switch", false);  //  // Use the TapBridgeHelper to connect to the pre-configured tap devices for   // the left side.  We go with "UseBridge" mode since the CSMA devices support  // promiscuous mode and can therefore make it appear that the bridge is   // extended into ns-3.  The install method essentially bridges the specified  // tap to the specified CSMA device.  //  TapBridgeHelper tapBridge;  tapBridge.SetAttribute ("Mode", StringValue ("UseBridge"));  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_m_11"));  tapBridge.Install (nodes.Get (0), terminalDevices.Get (0));  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_m_12"));  tapBridge.Install (nodes.Get (1), terminalDevices.Get (1));  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_m_21"));  tapBridge.Install (nodes.Get (2), terminalDevices.Get (2));  tapBridge.SetAttribute ("DeviceName", StringValue ("tap_m_22"));  tapBridge.Install (nodes.Get (3), terminalDevices.Get (3));  //  // Now, do the actual simulation.  //  NS_LOG_INFO ("Run Simulation.");  Simulator::Run ();  Simulator::Destroy ();  NS_LOG_INFO ("Done.");  #else  NS_LOG_INFO ("NS-3 OpenFlow is not enabled. Cannot run simulation.");  #endif // NS3_OPENFLOW}



(android-1)  nc -l 12123 < /data/wps-office.rpm
(android-2)  nc 112.26.1.1 12123 > wps-office.rpm

tcpdump -vv -n -i br_m_11 > tcpdump1.txt
tcpdump -vv -n -i br_m_21 > tcpdump2.txt
+++++++++++++++++++++++++++++++++++++++++++++

tcpdump1.txt

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

22:30:06.117248 IP (tos 0x0, ttl 64, id 36481, offset 0, flags [DF], proto TCP (6), length 72)
    112.26.1.2.51630 > 112.26.1.1.12123: Flags [S], cksum 0x7262 (correct), seq 1124357721, win 29200, options [mss 1460,sackOK,TS val 2939096 ecr 0,nop,wscale 7,mptcp capable csum {0xe011bbae3cd0eebf}], length 0
22:30:06.117606 IP (tos 0x0, ttl 64, id 52872, offset 0, flags [DF], proto TCP (6), length 40)
    112.26.1.1.12123 > 112.26.1.2.51630: Flags [R.], cksum 0x3b31 (correct), seq 0, ack 1124357722, win 0, length 0
22:30:11.064110 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 112.26.1.1 tell 112.26.1.2, length 46
22:30:11.064336 ARP, Ethernet (len 6), IPv4 (len 4), Reply 112.26.1.1 is-at 08:00:27:8c:9f:3c, length 46
22:30:22.271362 IP (tos 0x0, ttl 64, id 45247, offset 0, flags [DF], proto TCP (6), length 72)
    112.26.1.2.51632 > 112.26.1.1.12123: Flags [S], cksum 0xd795 (correct), seq 1186572100, win 29200, options [mss 1460,sackOK,TS val 2955259 ecr 0,nop,wscale 7,mptcp capable csum {0x3ebd3ef3eccb7b0}], length 0
22:30:22.271592 IP (tos 0x0, ttl 64, id 61080, offset 0, flags [DF], proto TCP (6), length 40)
    112.26.1.1.12123 > 112.26.1.2.51632: Flags [R.], cksum 0xe68e (correct), seq 0, ack 1186572101, win 0, length 0
22:30:24.189405 IP (tos 0x0, ttl 64, id 10519, offset 0, flags [DF], proto TCP (6), length 72)
    112.26.1.2.51634 > 112.26.1.1.12123: Flags [S], cksum 0xf6f1 (correct), seq 2871211597, win 29200, options [mss 1460,sackOK,TS val 2957146 ecr 0,nop,wscale 7,mptcp capable csum {0x53006e39ad7c4571}], length 0
22:30:24.189656 IP (tos 0x0, ttl 64, id 62568, offset 0, flags [DF], proto TCP (6), length 40)
    112.26.1.1.12123 > 112.26.1.2.51634: Flags [R.], cksum 0xf319 (correct), seq 0, ack 2871211598, win 0, length 0
22:30:27.274167 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 112.26.1.2 tell 112.26.1.1, length 46
22:30:27.418879 ARP, Ethernet (len 6), IPv4 (len 4), Reply 112.26.1.2 is-at 08:00:27:3c:1c:d5, length 46
22:33:31.926426 IP (tos 0x0, ttl 64, id 52860, offset 0, flags [DF], proto TCP (6), length 72)
    112.26.1.2.49240 > 112.26.1.1.prp: Flags [S], cksum 0x2f06 (correct), seq 1520579271, win 29200, options [mss 1460,sackOK,TS val 3144891 ecr 0,nop,wscale 7,mptcp capable csum {0xf5514185e69305d6}], length 0
22:33:31.926634 IP (tos 0x0, ttl 64, id 40449, offset 0, flags [DF], proto TCP (6), length 40)
    112.26.1.1.prp > 112.26.1.2.49240: Flags [R.], cksum 0x77ab (correct), seq 0, ack 1520579272, win 0, length 0
22:33:36.871171 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 112.26.1.1 tell 112.26.1.2, length 46
22:33:36.871388 ARP, Ethernet (len 6), IPv4 (len 4), Reply 112.26.1.1 is-at 08:00:27:8c:9f:3c, length 46
22:34:08.260392 IP (tos 0x0, ttl 64, id 46412, offset 0, flags [DF], proto TCP (6), length 72)
    112.26.1.2.59962 > 112.26.1.1.45831: Flags [S], cksum 0x86df (correct), seq 3647684567, win 29200, options [mss 1460,sackOK,TS val 3181211 ecr 0,nop,wscale 7,mptcp capable csum {0xa34cc6e6d8e399d7}], length 0
22:34:08.260766 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 72)
    112.26.1.1.45831 > 112.26.1.2.59962: Flags [S.], cksum 0x4a07 (correct), seq 1338984933, ack 3647684568, win 28560, options [mss 1460,sackOK,TS val 632809 ecr 3181211,nop,wscale 7,mptcp capable csum {0x6b71b446d392e743}], length 0
22:34:08.462502 IP (tos 0x0, ttl 64, id 46413, offset 0, flags [DF], proto TCP (6), length 80)
    112.26.1.2.59962 > 112.26.1.1.45831: Flags [.], cksum 0xc066 (correct), seq 1, ack 1, win 229, options [nop,nop,TS val 3181413 ecr 632809,mptcp capable csum {0xa34cc6e6d8e399d7,0x6b71b446d392e743},mptcp dss ack 390181884], length 0
22:34:08.462725 IP (tos 0x0, ttl 64, id 57685, offset 0, flags [DF], proto TCP (6), length 68)
    112.26.1.1.45831 > 112.26.1.2.59962: Flags [.], cksum 0x0769 (correct), seq 1, ack 1, win 224, options [nop,nop,TS val 633011 ecr 3181413,mptcp add-addr id 3 112.26.2.1,mptcp dss ack 4042773622], length 0
22:34:08.462987 IP (tos 0x0, ttl 64, id 46414, offset 0, flags [DF], proto TCP (6), length 68)
    112.26.1.2.59962 > 112.26.1.1.45831: Flags [.], cksum 0x025e (correct), seq 1, ack 1, win 229, options [nop,nop,TS val 3181413 ecr 632809,mptcp add-addr id 3 112.26.2.2,mptcp dss ack 390181884], length 0

(android-1) reboot

(android-2) reboot










0 0
原创粉丝点击