merge ns-3-lena-dev and ns-3-dev
authorNicola Baldo <nbaldo@cttc.es>
Mon, 30 Jan 2012 12:26:03 +0100
changeset 8603 14e8a4d1e53f
parent 8602 f9ac77eaaaa5 (current diff)
parent 7699 90904c14135f (diff)
child 8604 65ae4fb796af
child 8621 25b41bd12140
merge ns-3-lena-dev and ns-3-dev
--- a/CHANGES.html	Mon Jan 30 11:56:33 2012 +0100
+++ b/CHANGES.html	Mon Jan 30 12:26:03 2012 +0100
@@ -44,6 +44,16 @@
 us a note on ns-developers mailing list.  </p>
 
 <hr>
+<h1>Changes from ns-3.13 to ns-3-dev</h1>
+
+<h2>Changes to existing API:</h2>
+<ul>
+<li> The Ipv6RawSocketImpl "IcmpFilter" attribute has been removed. Six 
+new member functions have been added to enable the same functionality.
+</li>
+</ul>
+
+<hr>
 <h1>Changes from ns-3.12 to ns-3.13</h1>
 
 <h2>Changes to build system:</h2>
--- a/RELEASE_NOTES	Mon Jan 30 11:56:33 2012 +0100
+++ b/RELEASE_NOTES	Mon Jan 30 12:26:03 2012 +0100
@@ -9,6 +9,29 @@
 Consult the file CHANGES.html for more detailed information about changed
 API and behavior across ns-3 releases.
 
+Release 3-dev
+==============
+
+Availability
+------------
+This release is available from: 
+
+Supported platforms
+-------------------
+
+New user-visible features
+-------------------------
+
+Bugs fixed
+----------
+ - bug 1319 - Fix Ipv6RawSocketImpl Icmpv6 filter
+ - bug 1318 - Asserts for IPv6 malformed packets
+
+Known issues
+------------
+In general, known issues are tracked on the project tracker available
+at http://www.nsnam.org/bugzilla/
+
 Release 3.13
 ==============
 
--- a/src/click/model/ipv4-click-routing.cc	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/click/model/ipv4-click-routing.cc	Mon Jan 30 12:26:03 2012 +0100
@@ -114,6 +114,7 @@
 void
 Ipv4ClickRouting::DoDispose ()
 {
+  simclick_click_kill (m_simNode);
   m_ipv4 = 0;
   delete m_simNode;
   Ipv4RoutingProtocol::DoDispose ();
@@ -416,8 +417,15 @@
 std::string
 Ipv4ClickRouting::ReadHandler (std::string elementName, std::string handlerName)
 {
-  std::string s = simclick_click_read_handler (m_simNode, elementName.c_str (), handlerName.c_str (), 0, 0);
-  return s;
+  char *handle = simclick_click_read_handler (m_simNode, elementName.c_str (), handlerName.c_str (), 0, 0);
+  std::string ret (handle);
+
+  // This is required because Click does not free
+  // the memory allocated to the return string
+  // from simclick_click_read_handler()
+  free(handle);
+
+  return ret;
 }
 
 int
--- a/src/emu/model/emu-net-device.cc	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/emu/model/emu-net-device.cc	Mon Jan 30 12:26:03 2012 +0100
@@ -476,8 +476,8 @@
       //
       // Execute the socket creation process image.
       //
-      status = ::execlp ("emu-sock-creator", 
-                         "emu-sock-creator",                            // argv[0] (filename)
+      status = ::execlp (EMU_SOCK_CREATOR,
+                         EMU_SOCK_CREATOR,                            // argv[0] (filename)
                          oss.str ().c_str (),                           // argv[1] (-p<path?
                          (char *)NULL);
 
--- a/src/emu/wscript	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/emu/wscript	Mon Jan 30 12:26:03 2012 +0100
@@ -43,12 +43,14 @@
             'helper/emu-helper.h',
         ]
 
-    obj = bld.create_suid_program('emu-sock-creator')
-    obj.source = [
+    creator = bld.create_suid_program('emu-sock-creator')
+    creator.source = [
         'model/emu-sock-creator.cc',
         'model/emu-encode-decode.cc',
         ]
 
+    module.env.append_value("DEFINES", "EMU_SOCK_CREATOR=\"%s\"" % (creator.target,))
+
     if bld.env['ENABLE_EXAMPLES']:
         bld.add_subdirs('examples')
 
--- a/src/internet/doc/internet-stack.rst	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/internet/doc/internet-stack.rst	Mon Jan 30 12:26:03 2012 +0100
@@ -127,6 +127,16 @@
 main purpose is to provide address-family specific information (addresses) about
 an interface.
 
+All the classes have appropriate traces in order to track sent, received and lost packets.
+The users is encouraged to use them so to find out if (and where) a packet is dropped. A
+common mistake is to forget the effects of local queues when sending packets, e.g., the ARP
+queue. This can be particularly puzzling when sending jumbo packets or packet bursts using UDP.
+The ARP cache pending queue is limited (3 datagrams) and IP packets might be fragmented, easily
+overfilling the ARP cache queue size. In those cases it is useful to increase the ARP cache
+pending size to a proper value, e.g.:::
+
+    Config::SetDefault ("ns3::ArpCache::PendingQueueSize", UintegerValue (MAX_BURST_SIZE/L2MTU*3));
+
 The IPv6 implementation follows a similar architecture.
 
 Layer-4 protocols and sockets
--- a/src/internet/model/ipv4-raw-socket-impl.cc	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/internet/model/ipv4-raw-socket-impl.cc	Mon Jan 30 12:26:03 2012 +0100
@@ -29,7 +29,7 @@
                    MakeUintegerAccessor (&Ipv4RawSocketImpl::m_protocol),
                    MakeUintegerChecker<uint16_t> ())
     .AddAttribute ("IcmpFilter", 
-                   "Any icmp header whose type field matches a bit in this filter is dropped.",
+                   "Any icmp header whose type field matches a bit in this filter is dropped. Type must be less than 32.",
                    UintegerValue (0),
                    MakeUintegerAccessor (&Ipv4RawSocketImpl::m_icmpFilter),
                    MakeUintegerChecker<uint32_t> ())
@@ -326,7 +326,7 @@
           copy->PeekHeader (icmpHeader);
           uint8_t type = icmpHeader.GetType ();
           if (type < 32 &&
-              ((1 << type) & m_icmpFilter))
+              ((uint32_t(1) << type) & m_icmpFilter))
             {
               // filter out icmp packet.
               return false;
--- a/src/internet/model/ipv6-raw-socket-impl.cc	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/internet/model/ipv6-raw-socket-impl.cc	Mon Jan 30 12:26:03 2012 +0100
@@ -51,10 +51,6 @@
                    UintegerValue (0),
                    MakeUintegerAccessor (&Ipv6RawSocketImpl::m_protocol),
                    MakeUintegerChecker<uint16_t> ())
-    .AddAttribute ("IcmpFilter", "Any ICMPv6 header whose type field matches a bit in this filter is dropped.",
-                   UintegerValue (0),
-                   MakeUintegerAccessor (&Ipv6RawSocketImpl::m_icmpFilter),
-                   MakeUintegerChecker<uint32_t> ())
   ;
   return tid;
 }
@@ -69,6 +65,7 @@
   m_protocol = 0;
   m_shutdownSend = false;
   m_shutdownRecv = false;
+  Icmpv6FilterSetPassAll();
 }
 
 Ipv6RawSocketImpl::~Ipv6RawSocketImpl ()
@@ -328,7 +325,7 @@
           copy->PeekHeader (icmpHeader);
           uint8_t type = icmpHeader.GetType ();
 
-          if ((1 << type) & m_icmpFilter)
+          if (Icmpv6FilterWillBlock(type))
             {
               /* packet filtered */
               return false;
@@ -372,5 +369,41 @@
   return true;
 }
 
+void
+Ipv6RawSocketImpl::Icmpv6FilterSetPassAll()
+{
+  memset(&m_icmpFilter, 0xff, sizeof(icmpv6Filter));
+}
+
+void
+Ipv6RawSocketImpl::Icmpv6FilterSetBlockAll()
+{
+  memset(&m_icmpFilter, 0x00, sizeof(icmpv6Filter));
+}
+
+void
+Ipv6RawSocketImpl::Icmpv6FilterSetPass(uint8_t type)
+{
+  (m_icmpFilter.icmpv6Filt[(type) >> 5]) |= (uint32_t(1) << ((type) & 31));
+}
+
+void
+Ipv6RawSocketImpl::Icmpv6FilterSetBlock(uint8_t type)
+{
+  (m_icmpFilter.icmpv6Filt[(type) >> 5]) &= ~(uint32_t(1) << ((type) & 31));
+}
+
+bool
+Ipv6RawSocketImpl::Icmpv6FilterWillPass(uint8_t type)
+{
+  return (((m_icmpFilter.icmpv6Filt[(type) >> 5]) & (uint32_t(1) << ((type) & 31))) != 0);
+}
+
+bool
+Ipv6RawSocketImpl::Icmpv6FilterWillBlock(uint8_t type)
+{
+  return (((m_icmpFilter.icmpv6Filt[(type) >> 5]) & (uint32_t(1) << ((type) & 31))) == 0);
+}
+
 } /* namespace ns3 */
 
--- a/src/internet/model/ipv6-raw-socket-impl.h	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/internet/model/ipv6-raw-socket-impl.h	Mon Jan 30 12:26:03 2012 +0100
@@ -219,10 +219,47 @@
   virtual bool SetAllowBroadcast (bool allowBroadcast);
   virtual bool GetAllowBroadcast () const;
 
+  /**
+   * \brief Clean the ICMPv6 filter structure
+   */
+  void Icmpv6FilterSetPassAll();
+
+  /**
+   * \brief Set the filter to block all the ICMPv6 types
+   */
+  void Icmpv6FilterSetBlockAll();
+
+  /**
+   * \brief Set the filter to pass one ICMPv6 type
+   * \param the ICMPv6 type to pass
+   */
+  void Icmpv6FilterSetPass(uint8_t type);
+
+  /**
+   * \brief Set the filter to block one ICMPv6 type
+   * \param the ICMPv6 type to block
+   */
+  void Icmpv6FilterSetBlock(uint8_t type);
+
+  /**
+   * \brief Ask the filter about the status of one ICMPv6 type
+   * \param the ICMPv6 type
+   * \return true if the ICMP type is passing through
+   */
+  bool Icmpv6FilterWillPass(uint8_t type);
+
+  /**
+   * \brief Ask the filter about the status of one ICMPv6 type
+   * \param the ICMPv6 type
+   * \return true if the ICMP type is being blocked
+   */
+  bool Icmpv6FilterWillBlock(uint8_t type);
+
+
 private:
   /**
    * \struct Data
-   * \brief IPv6 raw data and additionnal information.
+   * \brief IPv6 raw data and additional information.
    */
   struct Data
   {
@@ -277,9 +314,17 @@
   bool m_shutdownRecv;
 
   /**
+   * \brief Struct to hold the ICMPv6 filter
+   */
+  typedef struct
+  {
+    uint32_t icmpv6Filt[8];
+  } icmpv6Filter;
+
+  /**
    * \brief ICMPv6 filter.
    */
-  uint32_t m_icmpFilter;
+  icmpv6Filter m_icmpFilter;
 };
 
 } /* namespace ns3 */
--- a/src/tap-bridge/model/tap-bridge.cc	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/tap-bridge/model/tap-bridge.cc	Mon Jan 30 12:26:03 2012 +0100
@@ -524,8 +524,8 @@
       //
       // Execute the socket creation process image.
       //
-      status = ::execlp ("tap-creator", 
-                         "tap-creator",                       // argv[0] (filename)
+      status = ::execlp (TAP_CREATOR, 
+                         TAP_CREATOR,                       // argv[0] (filename)
                          ossDeviceName.str ().c_str (),       // argv[1] (-d<device name>)
                          ossGateway.str ().c_str (),          // argv[2] (-g<gateway>)
                          ossIp.str ().c_str (),               // argv[3] (-i<IP address>)
--- a/src/tap-bridge/wscript	Mon Jan 30 11:56:33 2012 +0100
+++ b/src/tap-bridge/wscript	Mon Jan 30 12:26:03 2012 +0100
@@ -43,12 +43,14 @@
         ]
 
     if not bld.env['PLATFORM'].startswith('freebsd'):
-        obj = bld.create_suid_program('tap-creator')
-        obj.source = [
+        tap_creator = bld.create_suid_program('tap-creator')
+        tap_creator.source = [
             'model/tap-creator.cc',
             'model/tap-encode-decode.cc',
             ]
 
+    module.env.append_value("DEFINES", "TAP_CREATOR=\"%s\"" % (tap_creator.target,))
+
     if bld.env['ENABLE_EXAMPLES']:
         bld.add_subdirs('examples')
 
--- a/wscript	Mon Jan 30 11:56:33 2012 +0100
+++ b/wscript	Mon Jan 30 12:26:03 2012 +0100
@@ -541,7 +541,7 @@
         super(SuidBuild_task, self).__init__(*args, **kwargs)
         self.m_display = 'build-suid'
         try:
-            program_obj = wutils.find_program(self.generator.target, self.generator.env)
+            program_obj = wutils.find_program(self.generator.name, self.generator.env)
         except ValueError, ex:
             raise WafError(str(ex))
         program_node = program_obj.path.find_or_declare(program_obj.target)
@@ -558,7 +558,10 @@
 
     def runnable_status(self):
         "RUN_ME SKIP_ME or ASK_LATER"
-        st = os.stat(self.filename)
+        try:
+            st = os.stat(self.filename)
+        except OSError:
+            return Task.ASK_LATER
         if st.st_uid == 0:
             return Task.SKIP_ME
         else: