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

(-)a/examples/tunneling/virtual-net-device.cc (+6 lines)
 Lines 115-120    Link Here 
115
    NS_LOG_DEBUG ("N3SocketRecv: " << *packet);
115
    NS_LOG_DEBUG ("N3SocketRecv: " << *packet);
116
    SocketAddressTag socketAddressTag;
116
    SocketAddressTag socketAddressTag;
117
    packet->RemovePacketTag (socketAddressTag);
117
    packet->RemovePacketTag (socketAddressTag);
118
    SocketRecvIfTag recvIfTag;
119
    packet->RemovePacketTag (recvIfTag);
118
    m_n3Tap->Receive (packet, 0x0800, m_n3Tap->GetAddress (), m_n3Tap->GetAddress (), NetDevice::PACKET_HOST);
120
    m_n3Tap->Receive (packet, 0x0800, m_n3Tap->GetAddress (), m_n3Tap->GetAddress (), NetDevice::PACKET_HOST);
119
  }
121
  }
120
122
 Lines 124-129    Link Here 
124
    NS_LOG_DEBUG ("N0SocketRecv: " << *packet);
126
    NS_LOG_DEBUG ("N0SocketRecv: " << *packet);
125
    SocketAddressTag socketAddressTag;
127
    SocketAddressTag socketAddressTag;
126
    packet->RemovePacketTag (socketAddressTag);
128
    packet->RemovePacketTag (socketAddressTag);
129
    SocketRecvIfTag recvIfTag;
130
    packet->RemovePacketTag (recvIfTag);
127
    m_n0Tap->Receive (packet, 0x0800, m_n0Tap->GetAddress (), m_n0Tap->GetAddress (), NetDevice::PACKET_HOST);
131
    m_n0Tap->Receive (packet, 0x0800, m_n0Tap->GetAddress (), m_n0Tap->GetAddress (), NetDevice::PACKET_HOST);
128
  }
132
  }
129
133
 Lines 133-138    Link Here 
133
    NS_LOG_DEBUG ("N1SocketRecv: " << *packet);
137
    NS_LOG_DEBUG ("N1SocketRecv: " << *packet);
134
    SocketAddressTag socketAddressTag;
138
    SocketAddressTag socketAddressTag;
135
    packet->RemovePacketTag (socketAddressTag);
139
    packet->RemovePacketTag (socketAddressTag);
140
    SocketRecvIfTag recvIfTag;
141
    packet->RemovePacketTag (recvIfTag);
136
    m_n1Tap->Receive (packet, 0x0800, m_n1Tap->GetAddress (), m_n1Tap->GetAddress (), NetDevice::PACKET_HOST);
142
    m_n1Tap->Receive (packet, 0x0800, m_n1Tap->GetAddress (), m_n1Tap->GetAddress (), NetDevice::PACKET_HOST);
137
  }
143
  }
138
144
(-)a/src/common/packet-tag-list.cc (-1 / +1 lines)
 Lines 136-142    Link Here 
136
  // ensure this id was not yet added
136
  // ensure this id was not yet added
137
  for (struct TagData *cur = m_next; cur != 0; cur = cur->next) 
137
  for (struct TagData *cur = m_next; cur != 0; cur = cur->next) 
138
    {
138
    {
139
      NS_ASSERT (cur->tid != tag.GetInstanceTypeId ());
139
      NS_ASSERT_MSG (cur->tid != tag.GetInstanceTypeId (), "Assert: trying to add a Packet tag type that is already added");
140
    }
140
    }
141
  struct TagData *head = AllocData ();
141
  struct TagData *head = AllocData ();
142
  head->count = 1;
142
  head->count = 1;
(-)a/src/internet-stack/ipv4-l3-protocol.cc (+4 lines)
 Lines 780-785    Link Here 
780
780
781
  m_localDeliverTrace (ip, packet, iif);
781
  m_localDeliverTrace (ip, packet, iif);
782
782
783
  SocketRecvIfTag tag;
784
  tag.SetRecvIf (iif);
785
  p->AddPacketTag (tag);
786
783
  Ptr<Ipv4L4Protocol> protocol = GetProtocol (ip.GetProtocol ());
787
  Ptr<Ipv4L4Protocol> protocol = GetProtocol (ip.GetProtocol ());
784
  if (protocol != 0)
788
  if (protocol != 0)
785
    {
789
    {
(-)a/src/internet-stack/ipv6-l3-protocol.cc (+6 lines)
 Lines 665-670    Link Here 
665
{
665
{
666
  NS_LOG_FUNCTION (this << device << p << protocol << from << to << packetType);
666
  NS_LOG_FUNCTION (this << device << p << protocol << from << to << packetType);
667
  NS_LOG_LOGIC ("Packet from " << from << " received on node " << m_node->GetId ());
667
  NS_LOG_LOGIC ("Packet from " << from << " received on node " << m_node->GetId ());
668
668
  uint32_t interface = 0;
669
  uint32_t interface = 0;
669
  Ptr<Packet> packet = p->Copy ();
670
  Ptr<Packet> packet = p->Copy ();
670
  Ptr<Ipv6Interface> ipv6Interface = 0;
671
  Ptr<Ipv6Interface> ipv6Interface = 0;
 Lines 933-938    Link Here 
933
{
934
{
934
  NS_LOG_FUNCTION (this << packet << ip << iif);
935
  NS_LOG_FUNCTION (this << packet << ip << iif);
935
  Ptr<Packet> p = packet->Copy ();
936
  Ptr<Packet> p = packet->Copy ();
937
938
  SocketRecvIfTag tag;
939
  tag.SetRecvIf (iif);
940
  p->AddPacketTag (tag);
941
936
  Ptr<Ipv6L4Protocol> protocol = 0; 
942
  Ptr<Ipv6L4Protocol> protocol = 0; 
937
  Ptr<Ipv6ExtensionDemux> ipv6ExtensionDemux = m_node->GetObject<Ipv6ExtensionDemux>();
943
  Ptr<Ipv6ExtensionDemux> ipv6ExtensionDemux = m_node->GetObject<Ipv6ExtensionDemux>();
938
  Ptr<Ipv6Extension> ipv6Extension = 0;
944
  Ptr<Ipv6Extension> ipv6Extension = 0;
(-)a/src/node/socket.cc (+54 lines)
 Lines 487-490    Link Here 
487
  os << (m_dontFragment?"true":"false");
487
  os << (m_dontFragment?"true":"false");
488
}
488
}
489
489
490
491
SocketRecvIfTag::SocketRecvIfTag ()  
492
{
493
}
494
495
void 
496
SocketRecvIfTag::SetRecvIf (uint32_t ifindex)
497
{
498
  m_ifindex = ifindex;
499
}
500
501
uint32_t 
502
SocketRecvIfTag::GetRecvIf (void) const
503
{
504
  return m_ifindex;
505
}
506
507
508
TypeId
509
SocketRecvIfTag::GetTypeId (void)
510
{
511
  static TypeId tid = TypeId ("ns3::SocketRecvIfTag")
512
    .SetParent<Tag> ()
513
    .AddConstructor<SocketRecvIfTag> ()
514
    ;
515
  return tid;
516
}
517
TypeId
518
SocketRecvIfTag::GetInstanceTypeId (void) const
519
{
520
  return GetTypeId ();
521
}
522
523
uint32_t 
524
SocketRecvIfTag::GetSerializedSize (void) const
525
{ 
526
  return sizeof(uint32_t);
527
}
528
void 
529
SocketRecvIfTag::Serialize (TagBuffer i) const
530
{ 
531
  i.WriteU32 (m_ifindex);
532
}
533
void 
534
SocketRecvIfTag::Deserialize (TagBuffer i)
535
{ 
536
  m_ifindex = i.ReadU32 ();
537
}
538
void
539
SocketRecvIfTag::Print (std::ostream &os) const
540
{
541
  os << "RecvIf=" << (uint32_t) m_ifindex;
542
}
543
490
}//namespace ns3
544
}//namespace ns3
(-)a/src/node/socket.h (+25 lines)
 Lines 80-85    Link Here 
80
    ERROR_INVAL,
80
    ERROR_INVAL,
81
    ERROR_BADF,
81
    ERROR_BADF,
82
    ERROR_NOROUTETOHOST,
82
    ERROR_NOROUTETOHOST,
83
    ERROR_NODEV,
84
    ERROR_ADDRNOTAVAIL,
83
    SOCKET_ERRNO_LAST
85
    SOCKET_ERRNO_LAST
84
  };
86
  };
85
87
 Lines 637-642    Link Here 
637
  bool m_dontFragment;
639
  bool m_dontFragment;
638
};
640
};
639
641
642
/**
643
 * \brief This class implements a tag that carries the information of
644
 * received interface of a packet to the socket layer
645
 */
646
class SocketRecvIfTag : public Tag
647
{
648
public:
649
  SocketRecvIfTag ();
650
  void SetRecvIf (uint32_t ifindex);
651
  uint32_t GetRecvIf (void) const;
652
653
  static TypeId GetTypeId (void);  
654
  virtual TypeId GetInstanceTypeId (void) const;
655
  virtual uint32_t GetSerializedSize (void) const;
656
  virtual void Serialize (TagBuffer i) const;
657
  virtual void Deserialize (TagBuffer i);
658
  virtual void Print (std::ostream &os) const;
659
660
private:
661
  uint8_t m_ifindex;
662
};
663
664
640
} //namespace ns3
665
} //namespace ns3
641
666
642
#endif /* SOCKET_H */
667
#endif /* SOCKET_H */

Return to bug 671