bad checkSum

214 views
Skip to first unread message

thunder

unread,
Sep 6, 2011, 10:49:19 AM9/6/11
to ns-3-users
hi all
I made a simulation on ns3 for wifi nodes (802.11b) sending TCP
packets and everything went fine and the results appeared in
wireshark
but wireshark gives me that there is a bad check sum why does that
happen

the following is my simulation script:

/* -*- 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
*/

#include "ns3/core-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/wifi-module.h"
#include "ns3/mobility-module.h"
#include "ns3/csma-module.h"
#include "ns3/internet-module.h"

// Default Network Topology
//
// Wifi 10.1.1.0
//
// AP1 _
// *<-------* |
// | | |
// n2 n0 |
// \ Both links will operate at same freq.
// AP2 / The are both in the same network
// *<-------* |
// | | |
// n3 n1 |
// -
// *
// |
// n4
//

using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("ThirdScriptExample");

int
main (int argc, char *argv[])
{
uint32_t nWifi = 3;

LogComponentEnable ("UdpEchoClientApplication", LOG_LEVEL_INFO);
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);

NodeContainer wifiStaNodes;
wifiStaNodes.Create (nWifi);
NodeContainer wifiApNodes;
wifiApNodes.Create(2);

YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();

phy.SetChannel (channel.Create ());

WifiHelper wifi;
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue
("DsssRate1Mbps"),
"ControlMode",StringValue
("DsssRate1Mbps"));

NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();

Ssid ssid = Ssid ("ns-3-ssid");
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false));

NetDeviceContainer staDevices;
staDevices = wifi.Install (phy, mac, wifiStaNodes);

mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid));

NetDeviceContainer apDevices;
apDevices = wifi.Install (phy, mac, wifiApNodes);

NetDeviceContainer allDevices;
allDevices.Add(apDevices);
allDevices.Add(staDevices);

MobilityHelper mobility;

mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (5.0),
"DeltaY", DoubleValue (10.0),
"GridWidth", UintegerValue (3),
"LayoutType", StringValue
("RowFirst"));

mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiStaNodes);

mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiApNodes);

InternetStackHelper stack;

stack.Install (wifiApNodes);
stack.Install (wifiStaNodes);

Ipv4AddressHelper address;

address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer wifiInterfaces;
wifiInterfaces = address.Assign (allDevices);

//
// Create a BulkSendApplication and install it on node 0
//

uint16_t port = 5000;

DataRate dataRate1 ("1Mb/s");
OnOffHelper onOff ("ns3::TcpSocketFactory", Address
(InetSocketAddress (wifiInterfaces.GetAddress (2), port)));
onOff.SetAttribute ("DataRate", DataRateValue (dataRate1));
//onOff.SetAttribute ("OnTime", RandomVariableValue
(ConstantVariable (0.01)));
//onOff.SetAttribute ("OffTime", RandomVariableValue
(ConstantVariable (10)));
onOff.SetAttribute ("PacketSize", UintegerValue (50));

ApplicationContainer staApps = onOff.Install (wifiApNodes.Get(0));

//staApps.Start (Seconds (1.0));
//staApps.Stop (Seconds (10.0));


////DataRate dataRate2 ("1Mb/s");
////OnOffHelper onOff2 ("ns3::TcpSocketFactory", Address
(InetSocketAddress (wifiInterfaces.GetAddress (3), port)));
////onOff2.SetAttribute ("DataRate", DataRateValue (dataRate2));
//onOff2.SetAttribute ("OnTime", RandomVariableValue
(ConstantVariable (0.01)));
//onOff2.SetAttribute ("OffTime", RandomVariableValue
(ConstantVariable (10)));
////onOff2.SetAttribute ("PacketSize", UintegerValue (50));

////ApplicationContainer staApps2 = onOff2.Install
(wifiApNodes.Get(1));

//staApps2.Start (Seconds (1.0));
//staApps2.Stop (Seconds (10.0));

for (int i=0; i<10; i++)
{
staApps.Start (Seconds (i));
staApps.Stop (Seconds (i));
ApplicationContainer staApps = onOff.Install (wifiApNodes.Get(0));

};

phy.SetPcapDataLinkType(YansWifiPhyHelper::DLT_IEEE802_11_RADIO);

Ipv4GlobalRoutingHelper::PopulateRoutingTables ();

Simulator::Stop (Seconds (10.0));

phy.EnablePcap ("third", apDevices.Get(0));
phy.EnablePcap ("third", apDevices.Get(1));
phy.EnablePcap ("third", staDevices.Get(0));
phy.EnablePcap ("third", staDevices.Get(1));

Simulator::Run ();
Simulator::Destroy ();
return 0;
}

Estabraq H

unread,
Sep 6, 2011, 11:01:24 AM9/6/11
to ns-3-...@googlegroups.com
actually i have the same problem, my pcap files show either no packets or bad checksum, although my flow monitor show received packets successfully!!

hope someone can help us both..



--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


Andrés Malavassi

unread,
Sep 6, 2011, 12:05:01 PM9/6/11
to ns-3-...@googlegroups.com
Checksum Calculations are disable by defualt, add this to your code:


GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));

I hope it helps

2011/9/6 Estabraq H <estab...@gmail.com>



--
Andrés Malavasi Mora
Estudiante Escuela Ingeniería Eléctrica Universidad de Costa Rica
Tel: 8321-85-76

Estabraq H

unread,
Sep 6, 2011, 12:36:15 PM9/6/11
to ns-3-...@googlegroups.com
Thanx a lot.. it did help me.. hop it helps thunder :)

thunder

unread,
Sep 11, 2011, 8:20:06 AM9/11/11
to ns-3-users
well yes it did work

On Sep 6, 7:36 pm, Estabraq H <estabra...@gmail.com> wrote:
> Thanx a lot.. it did help me.. hop it helps thunder :)
>
> On Tue, Sep 6, 2011 at 7:05 PM, Andrés Malavassi <malavass...@gmail.com>wrote:
>
> > Checksum Calculations are disable by defualt, add this to your code:
>
> > GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
>
> > I hope it helps
>
> > 2011/9/6 Estabraq H <estabra...@gmail.com>
>
> >> actually i have the same problem, my pcap files show either no packets or
> >> bad checksum, although my flow monitor show received packets successfully!!
>
> >> hope someone can help us both..
>

thunder

unread,
Sep 11, 2011, 8:20:18 AM9/11/11
to ns-3-users
thanks :)

On Sep 6, 7:05 pm, Andrés Malavassi <malavass...@gmail.com> wrote:
> Checksum Calculations are disable by defualt, add this to your code:
>
> GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));
>
> I hope it helps
>
> 2011/9/6 Estabraq H <estabra...@gmail.com>
>
>
>
> > actually i have the same problem, my pcap files show either no packets or
> > bad checksum, although my flow monitor show received packets successfully!!
>
> > hope someone can help us both..
>
Reply all
Reply to author
Forward
0 new messages