running examples scratch

96 views
Skip to first unread message

Hajar Hantouti

unread,
Nov 26, 2015, 1:50:39 PM11/26/15
to ns-3-users
Hello everyone,

in order to use some examples "examples/routing/simple-routing-ping6.cc" among others , I have copied this example to scratch/simple-routing-modified.cc .

what I noticed is that the pcap files generated doesn't provide the same results : in the original example I have (ping) request and (ping) reply , but in the copied example i only found the (ping) requests.

I remark this on other ipv6 routing examples.

to copy the examples to scratch folder I followed this guide :https://www.nsnam.org/support/faq/writing-scripts/

I have attached screans with the original example and the example copied in scratch folder .

Thanks for your help ,
Cordially
Hajar
routing simple Examples.png
simple-routing-Scratch.png

Tommaso Pecorella

unread,
Nov 26, 2015, 6:05:48 PM11/26/15
to ns-3-users
Hi,

I checked and it works as intended for me. Please make sure that the two scrips are identical. If you changed something, please attach the modified script. Moreover, please state the ns-3 version you're using.

T.

Hajar Hantouti

unread,
Nov 27, 2015, 4:15:57 AM11/27/15
to ns-3-...@googlegroups.com
Hello,
Thanky you Tomaso for you time,

Actually I'm running the ns3 3.24.1 version , I didn't modify the examples copied to scratch .
I'm working on a project and I made some modifications to the Node.{cc,h} and ipv6-l3-protocol.{cc,h} . I can provide you details if you wish ..
can't this be caused because of memory or building issues ?

Thanks for your help
This email has been sent from a virus-free computer protected by Avast.
www.avast.com

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/o8OgpfKSxYg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.



--
Cordialement ;

Hajar HANTOUTI

Phd student -Umi University.


Tommaso Pecorella

unread,
Nov 27, 2015, 9:02:16 AM11/27/15
to ns-3-users
Feel free to attach the modified files. About the cause of your issue, it could be anything in the code you modified. We triple checked ns-3.24.1 and it was quite robust against memory and building issues.
I'm oriented to think that the problem is in the changes you did.

T.

Hajar Hantouti

unread,
Nov 29, 2015, 4:43:41 AM11/29/15
to ns-3-...@googlegroups.com
 Hello Tomaso,

The main Idea behind my modifications is to add an extension header to some packets ,the packets that match a classification rule.
I added a new extension header "My" to the files:
       ipv6-extension.{cc,h} ,
       ipv6-extension-header.{cc,h}
       ipv6-header.{cc,h}
at this point things were working well.

When I modified the files node.{cc,h} and Ipv6-l3-protocol.{cc,h} I get the problem of not replying to ping requests.

These are the modifications that I made to the file Node.h:

 void SetMyClassifier(bool val);
  bool GetMyClassifier();
  bool m_My_classify;
 
These are the modifications that I made to the file Node.cc in order to enable classification on the node:

void Node::SetMyClassifier(bool val)
{
        m_My_classify=val;
}
bool Node::GetMyClassifier()
{
        return  m_My_classify;
}
 
This is the code that i added to the file Ipv6-l3-protocol.cc in the ipforward function in order to classify and mark packets just before forwarding:


// enable the node to classifiy packets
bool classify=m_node->GetMyClassifier();
//modif Classification
Ipv6Address src_My=Ipv6Address("2001:1::200:ff:fe00:1");
Ipv6Address dst_My=Ipv6Address("2001:2::200:ff:fe00:5");

Ipv6Address dst_org = header.GetDestinationAddress ();
Ipv6Address src_org = header.GetSourceAddress ();
    if(classify){
        if(src_My.IsEqual(src_org))
        {
        //modification for Marking the matching packets
                ipHeader.SetNextHeader(200);
                Ipv6ExtensionMyHeader MyHeader;
                MyHeader.SetNextHeader(header.GetNextHeader());
                MyHeader.SetLength(16);
                uint16_t new_length = ipHeader.GetPayloadLength() + (uint16_t) MyHeader.GetLength() ;
                ipHeader.SetPayloadLength(new_length);
                packet->AddHeader(MyHeader);
        }
    }
 
Please Find attached the full source code files.
Sorry for this long email,Thanks for your help.
extension_caller_code.cc
node.h
ipv6-extension.cc
ipv6-extension.h
ipv6-extension-header.cc
ipv6-extension-header.h
ipv6-header.h
ipv6-l3-protocol.cc
ipv6-l3-protocol.h
node.cc

Hajar Hantouti

unread,
Dec 5, 2015, 3:43:52 PM12/5/15
to ns-3-users
Hello,
actually I located the source of the problem.
its the code that I added at the end the Ipforward function in the ipv6-l3-protocol.cc
  ipHeader.SetNextHeader(200);
                Ipv6ExtensionMyHeader MyHeader;
                MyHeader.SetNextHeader(header.GetNextHeader());
                MyHeader.SetLength(16);
uint16_t new_length = ipHeader.GetPayloadLength() + (uint16_t)      MyHeader.GetLength() ;
                ipHeader.SetPayloadLength(new_length);
                packet->AddHeader(MyHeader);
Thanks for your help,
Cordially
Hajar

Tommaso Pecorella

unread,
Dec 5, 2015, 4:00:27 PM12/5/15
to ns-3-users
Hi Hajar,

I'm glad you found the issue and sorry if I didn't help you on this. I was kinda busy in the last few days (and I forgot about it).

Cheers,

T.

Hajar Hantouti

unread,
Dec 5, 2015, 4:22:15 PM12/5/15
to ns-3-...@googlegroups.com
Hello Tomaso ,
I understand ,I'm glade for your help.
actually , up to now I could just locate the source of problem , but I may need you help to check with me if something is wrong in this portion of code :


 ipHeader.SetNextHeader(200);
 Ipv6ExtensionMyHeader MyHeader;
 MyHeader.SetNextHeader(header.GetNextHeader());
 MyHeader.SetLength(16);
uint16_t new_length = ipHeader.GetPayloadLength() + (uint16_t)      MyHeader.GetLength() ;
ipHeader.SetPayloadLength(new_length);
packet->AddHeader(MyHeader);

I insert this in the Ipforward fnction in the Ipv6-l3-protocol.cc , just before these lines :

 int32_t interface = GetInterfaceForDevice (rtentry->GetOutputDevice ());
  m_unicastForwardTrace (ipHeader, packet, interface);
  SendRealOut (rtentry, packet, ipHeader);

Thanks for your time,


Tommaso Pecorella

unread,
Dec 5, 2015, 4:37:08 PM12/5/15
to ns-3-users
uint16_t new_length = ipHeader.GetPayloadLength() + (uint16_t) MyHeader.GetLength() ;
must be
uint16_t new_length = ipHeader.GetPayloadLength() + (uint16_t) MyHeader.GetSerializedSize() ;

GetLength returns the option length excluding the first 8 octets. As a consequence, you was counting 8 bytes less.


Cheers,

T.

Hajar Hantouti

unread,
Dec 6, 2015, 5:04:52 PM12/6/15
to ns-3-...@googlegroups.com
Hello ,
Unfortunately , there is something else ,the problem remains.
I get successive (ping) requests instead of replies.

--
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/o8OgpfKSxYg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

Tommaso Pecorella

unread,
Dec 6, 2015, 6:23:08 PM12/6/15
to ns-3-users
That's a different problem. Most probably your packet don't reach the destination, and all you see are the requests.
One thing you can do is to enable packet printing (packet::EnablePrinting() if I remember right) and place NS_LOG_UNCOND where your packets are supposed to pass by. Check where they're dropped and so on.

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages