View | Details | Raw Unified | Return to bug 1796
Collapse All | Expand All

(-)a/src/internet/model/ipv6-end-point.cc (-5 / +6 lines)
 Lines 95-101    Link Here 
95
  m_peerPort = port;
95
  m_peerPort = port;
96
}
96
}
97
97
98
void Ipv6EndPoint::SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t> callback)
98
void Ipv6EndPoint::SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface> > callback)
99
{
99
{
100
  m_rxCallback = callback;
100
  m_rxCallback = callback;
101
}
101
}
 Lines 110-120    Link Here 
110
  m_destroyCallback = callback;
110
  m_destroyCallback = callback;
111
}
111
}
112
112
113
void Ipv6EndPoint::ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port)
113
void Ipv6EndPoint::ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
114
{
114
{
115
  if (!m_rxCallback.IsNull ())
115
  if (!m_rxCallback.IsNull ())
116
    {
116
    {
117
      m_rxCallback (p, header, port);
117
      Simulator::ScheduleNow (&Ipv6EndPoint::DoForwardUp, this, p, header, port,
118
                              incomingInterface);
118
    }
119
    }
119
}
120
}
120
121
 Lines 128-136    Link Here 
128
    }
129
    }
129
}
130
}
130
131
131
void Ipv6EndPoint::DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport)
132
void Ipv6EndPoint::DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport, Ptr<Ipv6Interface> incomingInterface)
132
{
133
{
133
  m_rxCallback (p, header, sport);
134
  m_rxCallback (p, header, sport, incomingInterface);
134
}
135
}
135
136
136
void Ipv6EndPoint::DoForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type, 
137
void Ipv6EndPoint::DoForwardIcmp (Ipv6Address src, uint8_t ttl, uint8_t type, 
(-)a/src/internet/model/ipv6-end-point.h (-4 / +7 lines)
 Lines 27-32    Link Here 
27
#include "ns3/callback.h"
27
#include "ns3/callback.h"
28
#include "ns3/ipv6-header.h"
28
#include "ns3/ipv6-header.h"
29
#include "ns3/net-device.h"
29
#include "ns3/net-device.h"
30
#include "ns3/ipv6-interface.h"
30
31
31
namespace ns3
32
namespace ns3
32
{
33
{
 Lines 132-138    Link Here 
132
   * \brief Set the reception callback.
133
   * \brief Set the reception callback.
133
   * \param callback callback function
134
   * \param callback callback function
134
   */
135
   */
135
  void SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t> callback);
136
  void SetRxCallback (Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface> > callback);
136
137
137
  /**
138
  /**
138
   * \brief Set the ICMP callback.
139
   * \brief Set the ICMP callback.
 Lines 151-158    Link Here 
151
   * \param p the packet
152
   * \param p the packet
152
   * \param header the packet header
153
   * \param header the packet header
153
   * \param port source port
154
   * \param port source port
155
   * \param incomingInterface incoming interface
154
   */
156
   */
155
  void ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port);
157
  void ForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface);
156
158
157
  /**
159
  /**
158
   * \brief Function called from an L4Protocol implementation
160
   * \brief Function called from an L4Protocol implementation
 Lines 172-179    Link Here 
172
   * \param p packet
174
   * \param p packet
173
   * \param header the packet header
175
   * \param header the packet header
174
   * \param sport source port
176
   * \param sport source port
177
   * \param incomingInterface incoming interface
175
   */
178
   */
176
  void DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport);
179
  void DoForwardUp (Ptr<Packet> p, Ipv6Header header, uint16_t sport, Ptr<Ipv6Interface> incomingInterface);
177
180
178
  /**
181
  /**
179
   * \brief ForwardIcmp wrapper.
182
   * \brief ForwardIcmp wrapper.
 Lines 214-220    Link Here 
214
  /**
217
  /**
215
   * \brief The RX callback.
218
   * \brief The RX callback.
216
   */
219
   */
217
  Callback<void, Ptr<Packet>, Ipv6Header, uint16_t> m_rxCallback;
220
  Callback<void, Ptr<Packet>, Ipv6Header, uint16_t, Ptr<Ipv6Interface> > m_rxCallback;
218
221
219
  /**
222
  /**
220
   * \brief The ICMPv6 callback.
223
   * \brief The ICMPv6 callback.
(-)a/src/internet/model/tcp-l4-protocol.cc (-1 / +1 lines)
 Lines 506-512    Link Here 
506
    }
506
    }
507
  NS_ASSERT_MSG (endPoints.size () == 1, "Demux returned more than one endpoint");
507
  NS_ASSERT_MSG (endPoints.size () == 1, "Demux returned more than one endpoint");
508
  NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket");
508
  NS_LOG_LOGIC ("TcpL4Protocol "<<this<<" forwarding up to endpoint/socket");
509
  (*endPoints.begin ())->ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort ());
509
  (*endPoints.begin ())->ForwardUp (packet, ipHeader, tcpHeader.GetSourcePort (), interface);
510
  return IpL4Protocol::RX_OK;
510
  return IpL4Protocol::RX_OK;
511
}
511
}
512
512
(-)a/src/internet/model/tcp-socket-base.cc (-1 / +1 lines)
 Lines 810-816    Link Here 
810
}
810
}
811
811
812
void
812
void
813
TcpSocketBase::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port)
813
TcpSocketBase::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
814
{
814
{
815
  DoForwardUp (packet, header, port);
815
  DoForwardUp (packet, header, port);
816
}
816
}
(-)a/src/internet/model/tcp-socket-base.h (-1 / +2 lines)
 Lines 31-36    Link Here 
31
#include "ns3/ipv4-header.h"
31
#include "ns3/ipv4-header.h"
32
#include "ns3/ipv4-interface.h"
32
#include "ns3/ipv4-interface.h"
33
#include "ns3/ipv6-header.h"
33
#include "ns3/ipv6-header.h"
34
#include "ns3/ipv6-interface.h"
34
#include "ns3/event-id.h"
35
#include "ns3/event-id.h"
35
#include "tcp-tx-buffer.h"
36
#include "tcp-tx-buffer.h"
36
#include "tcp-rx-buffer.h"
37
#include "tcp-rx-buffer.h"
 Lines 136-142    Link Here 
136
137
137
  // Helper functions: Transfer operation
138
  // Helper functions: Transfer operation
138
  void ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface);
139
  void ForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface);
139
  void ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port);
140
  void ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface);
140
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface); //Get a pkt from L3
141
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface); //Get a pkt from L3
141
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv6Header header, uint16_t port); // Ipv6 version
142
  virtual void DoForwardUp (Ptr<Packet> packet, Ipv6Header header, uint16_t port); // Ipv6 version
142
  void ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
143
  void ForwardIcmp (Ipv4Address icmpSource, uint8_t icmpTtl, uint8_t icmpType, uint8_t icmpCode, uint32_t icmpInfo);
(-)a/src/internet/model/udp-l4-protocol.cc (-1 / +1 lines)
 Lines 402-408    Link Here 
402
  for (Ipv6EndPointDemux::EndPointsI endPoint = endPoints.begin ();
402
  for (Ipv6EndPointDemux::EndPointsI endPoint = endPoints.begin ();
403
       endPoint != endPoints.end (); endPoint++)
403
       endPoint != endPoints.end (); endPoint++)
404
    {
404
    {
405
      (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort ());
405
      (*endPoint)->ForwardUp (packet->Copy (), header, udpHeader.GetSourcePort (), interface);
406
    }
406
    }
407
  return IpL4Protocol::RX_OK;
407
  return IpL4Protocol::RX_OK;
408
}
408
}
(-)a/src/internet/model/udp-socket-impl.cc (-1 / +10 lines)
 Lines 32-37    Link Here 
32
#include "ns3/udp-socket-factory.h"
32
#include "ns3/udp-socket-factory.h"
33
#include "ns3/trace-source-accessor.h"
33
#include "ns3/trace-source-accessor.h"
34
#include "ns3/ipv4-packet-info-tag.h"
34
#include "ns3/ipv4-packet-info-tag.h"
35
#include "ns3/ipv6-packet-info-tag.h"
35
#include "udp-socket-impl.h"
36
#include "udp-socket-impl.h"
36
#include "udp-l4-protocol.h"
37
#include "udp-l4-protocol.h"
37
#include "ipv4-end-point.h"
38
#include "ipv4-end-point.h"
 Lines 951-957    Link Here 
951
}
952
}
952
953
953
void 
954
void 
954
UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port)
955
UdpSocketImpl::ForwardUp6 (Ptr<Packet> packet, Ipv6Header header, uint16_t port, Ptr<Ipv6Interface> incomingInterface)
955
{
956
{
956
  NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << port);
957
  NS_LOG_FUNCTION (this << packet << header.GetSourceAddress () << port);
957
958
 Lines 960-965    Link Here 
960
      return;
961
      return;
961
    }
962
    }
962
963
964
  // Should check via getsockopt ()..
965
  if (IsRecvPktInfo ())
966
    {
967
      Ipv6PacketInfoTag tag;
968
      packet->RemovePacketTag (tag);
969
      tag.SetRecvIf (incomingInterface->GetDevice ()->GetIfIndex ());
970
      packet->AddPacketTag (tag);
971
    }
963
972
964
  //Check only version 6 options
973
  //Check only version 6 options
965
  if (IsIpv6RecvTclass ())
974
  if (IsIpv6RecvTclass ())
(-)a/src/internet/model/udp-socket-impl.h (-1 / +2 lines)
 Lines 104-110    Link Here 
104
  int FinishBind (void);
104
  int FinishBind (void);
105
  void ForwardUp (Ptr<Packet> p, Ipv4Header header, uint16_t port, 
105
  void ForwardUp (Ptr<Packet> p, Ipv4Header header, uint16_t port, 
106
                  Ptr<Ipv4Interface> incomingInterface);
106
                  Ptr<Ipv4Interface> incomingInterface);
107
  void ForwardUp6 (Ptr<Packet> p, Ipv6Header header, uint16_t port);
107
  void ForwardUp6 (Ptr<Packet> p, Ipv6Header header, uint16_t port,
108
                   Ptr<Ipv6Interface> incomingInterface);
108
  void Destroy (void);
109
  void Destroy (void);
109
  void Destroy6 (void);
110
  void Destroy6 (void);
110
  int DoSend (Ptr<Packet> p);
111
  int DoSend (Ptr<Packet> p);

Return to bug 1796