lte: (fixes #2992) Send method of the LteUeNetDevice doesn't use protocolNumber parameter
This commit is contained in:
@@ -27,6 +27,8 @@ New user-visible features
|
||||
Bugs fixed
|
||||
----------
|
||||
|
||||
- Bug 2992 - lte: Send method of the LteUeNetDevice doesn't use protocolNumber parameter
|
||||
|
||||
Known issues
|
||||
------------
|
||||
In general, known issues are tracked on the project tracker available
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/mac48-address.h"
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/ipv4-l3-protocol.h"
|
||||
#include "ns3/ipv6.h"
|
||||
#include "ns3/ipv6-header.h"
|
||||
#include "ns3/ipv6-l3-protocol.h"
|
||||
#include "ns3/inet-socket-address.h"
|
||||
#include "ns3/epc-gtpu-header.h"
|
||||
#include "ns3/abort.h"
|
||||
@@ -60,13 +62,13 @@ EpcSgwPgwApplication::UeInfo::RemoveBearer (uint8_t bearerId)
|
||||
}
|
||||
|
||||
uint32_t
|
||||
EpcSgwPgwApplication::UeInfo::Classify (Ptr<Packet> p)
|
||||
EpcSgwPgwApplication::UeInfo::Classify (Ptr<Packet> p, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << p);
|
||||
// we hardcode DOWNLINK direction since the PGW is espected to
|
||||
// classify only downlink packets (uplink packets will go to the
|
||||
// internet without any classification).
|
||||
return m_tftClassifier.Classify (p, EpcTft::DOWNLINK);
|
||||
return m_tftClassifier.Classify (p, EpcTft::DOWNLINK, protocolNumber);
|
||||
}
|
||||
|
||||
Ipv4Address
|
||||
@@ -160,16 +162,12 @@ EpcSgwPgwApplication::~EpcSgwPgwApplication ()
|
||||
bool
|
||||
EpcSgwPgwApplication::RecvFromTunDevice (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << source << dest << packet << packet->GetSize ());
|
||||
NS_LOG_FUNCTION (this << source << dest << protocolNumber << packet << packet->GetSize ());
|
||||
m_rxTunPktTrace (packet->Copy ());
|
||||
Ptr<Packet> pCopy = packet->Copy ();
|
||||
|
||||
uint8_t ipType;
|
||||
pCopy->CopyData (&ipType, 1);
|
||||
ipType = (ipType>>4) & 0x0f;
|
||||
|
||||
// get IP address of UE
|
||||
if (ipType == 0x04)
|
||||
if (protocolNumber == Ipv4L3Protocol::PROT_NUMBER)
|
||||
{
|
||||
Ipv4Header ipv4Header;
|
||||
pCopy->RemoveHeader (ipv4Header);
|
||||
@@ -184,7 +182,7 @@ EpcSgwPgwApplication::RecvFromTunDevice (Ptr<Packet> packet, const Address& sour
|
||||
else
|
||||
{
|
||||
Ipv4Address enbAddr = it->second->GetEnbAddr ();
|
||||
uint32_t teid = it->second->Classify (packet);
|
||||
uint32_t teid = it->second->Classify (packet, protocolNumber);
|
||||
if (teid == 0)
|
||||
{
|
||||
NS_LOG_WARN ("no matching bearer for this packet");
|
||||
@@ -195,7 +193,7 @@ EpcSgwPgwApplication::RecvFromTunDevice (Ptr<Packet> packet, const Address& sour
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ipType == 0x06)
|
||||
else if (protocolNumber == Ipv6L3Protocol::PROT_NUMBER)
|
||||
{
|
||||
Ipv6Header ipv6Header;
|
||||
pCopy->RemoveHeader (ipv6Header);
|
||||
@@ -210,7 +208,7 @@ EpcSgwPgwApplication::RecvFromTunDevice (Ptr<Packet> packet, const Address& sour
|
||||
else
|
||||
{
|
||||
Ipv4Address enbAddr = it->second->GetEnbAddr ();
|
||||
uint32_t teid = it->second->Classify (packet);
|
||||
uint32_t teid = it->second->Classify (packet, protocolNumber);
|
||||
if (teid == 0)
|
||||
{
|
||||
NS_LOG_WARN ("no matching bearer for this packet");
|
||||
|
||||
@@ -224,12 +224,13 @@ public:
|
||||
*
|
||||
*
|
||||
* \param p the IP packet from the internet to be classified
|
||||
* \param protocolNumber the protocol number of the IP packet
|
||||
*
|
||||
* \return the corresponding bearer ID > 0 identifying the bearer
|
||||
* among all the bearers of this UE; returns 0 if no bearers
|
||||
* matches with the previously declared TFTs
|
||||
*/
|
||||
uint32_t Classify (Ptr<Packet> p);
|
||||
uint32_t Classify (Ptr<Packet> p, uint16_t protocolNumber);
|
||||
|
||||
/**
|
||||
* \return the address of the eNB to which the UE is connected
|
||||
|
||||
@@ -31,10 +31,12 @@
|
||||
#include "ns3/ipv6-header.h"
|
||||
#include "ns3/udp-header.h"
|
||||
#include "ns3/tcp-header.h"
|
||||
#include "ns3/ipv4-l3-protocol.h"
|
||||
#include "ns3/icmpv4-l4-protocol.h"
|
||||
#include "ns3/udp-l4-protocol.h"
|
||||
#include "ns3/tcp-l4-protocol.h"
|
||||
#include "ns3/ipv6-l3-protocol.h"
|
||||
#include "ns3/icmpv6-l4-protocol.h"
|
||||
#include "ns3/icmpv4-l4-protocol.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -62,18 +64,13 @@ EpcTftClassifier::Delete (uint32_t id)
|
||||
m_tftMap.erase (id);
|
||||
}
|
||||
|
||||
|
||||
uint32_t
|
||||
EpcTftClassifier::Classify (Ptr<Packet> p, EpcTft::Direction direction)
|
||||
EpcTftClassifier::Classify (Ptr<Packet> p, EpcTft::Direction direction, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << p << p->GetSize () << direction);
|
||||
|
||||
Ptr<Packet> pCopy = p->Copy ();
|
||||
|
||||
uint8_t ipType;
|
||||
pCopy->CopyData (&ipType, 1);
|
||||
ipType = (ipType>>4) & 0x0f;
|
||||
|
||||
Ipv4Address localAddressIpv4;
|
||||
Ipv4Address remoteAddressIpv4;
|
||||
|
||||
@@ -86,7 +83,7 @@ EpcTftClassifier::Classify (Ptr<Packet> p, EpcTft::Direction direction)
|
||||
uint16_t localPort = 0;
|
||||
uint16_t remotePort = 0;
|
||||
|
||||
if (ipType == 0x04)
|
||||
if (protocolNumber == Ipv4L3Protocol::PROT_NUMBER)
|
||||
{
|
||||
Ipv4Header ipv4Header;
|
||||
pCopy->RemoveHeader (ipv4Header);
|
||||
@@ -202,7 +199,7 @@ EpcTftClassifier::Classify (Ptr<Packet> p, EpcTft::Direction direction)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ipType == 0x06)
|
||||
else if (protocolNumber == Ipv6L3Protocol::PROT_NUMBER)
|
||||
{
|
||||
Ipv6Header ipv6Header;
|
||||
pCopy->RemoveHeader (ipv6Header);
|
||||
@@ -261,7 +258,7 @@ EpcTftClassifier::Classify (Ptr<Packet> p, EpcTft::Direction direction)
|
||||
}
|
||||
|
||||
|
||||
if (ipType == 0x04)
|
||||
if (protocolNumber == Ipv4L3Protocol::PROT_NUMBER)
|
||||
{
|
||||
NS_LOG_INFO ("Classifying packet:"
|
||||
<< " localAddr=" << localAddressIpv4
|
||||
@@ -288,7 +285,7 @@ EpcTftClassifier::Classify (Ptr<Packet> p, EpcTft::Direction direction)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ipType == 0x06)
|
||||
else if (protocolNumber == Ipv6L3Protocol::PROT_NUMBER)
|
||||
{
|
||||
NS_LOG_INFO ("Classifying packet:"
|
||||
<< " localAddr=" << localAddressIpv6
|
||||
|
||||
@@ -77,12 +77,13 @@ public:
|
||||
/**
|
||||
* classify an IP packet
|
||||
*
|
||||
* \param p the IP packet. It is assumed that the outmost header is an IPv4 header.
|
||||
* \param p the IP packet. The outmost header can only be an IPv4 or an IPv6 header.
|
||||
* \param direction the EPC TFT direction (can be downlink, uplink or bi-directional)
|
||||
*
|
||||
* \param protocolNumber the protocol of the packet. Only IPv4 and IPv6 are supported.
|
||||
*
|
||||
* \return the identifier (>0) of the first TFT that matches with the IP packet; 0 if no TFT matched.
|
||||
*/
|
||||
uint32_t Classify (Ptr<Packet> p, EpcTft::Direction direction);
|
||||
uint32_t Classify (Ptr<Packet> p, EpcTft::Direction direction, uint16_t protocolNumber);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -203,15 +203,15 @@ EpcUeNas::ActivateEpsBearer (EpsBearer bearer, Ptr<EpcTft> tft)
|
||||
}
|
||||
|
||||
bool
|
||||
EpcUeNas::Send (Ptr<Packet> packet)
|
||||
EpcUeNas::Send (Ptr<Packet> packet, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet);
|
||||
NS_LOG_FUNCTION (this << packet << protocolNumber);
|
||||
|
||||
switch (m_state)
|
||||
{
|
||||
case ACTIVE:
|
||||
{
|
||||
uint32_t id = m_tftClassifier.Classify (packet, EpcTft::UPLINK);
|
||||
uint32_t id = m_tftClassifier.Classify (packet, EpcTft::UPLINK, protocolNumber);
|
||||
NS_ASSERT ((id & 0xFFFFFF00) == 0);
|
||||
uint8_t bid = (uint8_t) (id & 0x000000FF);
|
||||
if (bid == 0)
|
||||
|
||||
@@ -147,10 +147,11 @@ public:
|
||||
* Enqueue an IP packet on the proper bearer for uplink transmission
|
||||
*
|
||||
* \param p the packet
|
||||
* \param protocolNumber the protocol number of the packet
|
||||
*
|
||||
* \return true if successful, false if an error occurred
|
||||
*/
|
||||
bool Send (Ptr<Packet> p);
|
||||
bool Send (Ptr<Packet> p, uint16_t protocolNumber);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -387,8 +387,10 @@ LteEnbNetDevice::DoInitialize (void)
|
||||
bool
|
||||
LteEnbNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << dest << protocolNumber);
|
||||
NS_ASSERT_MSG (protocolNumber == Ipv4L3Protocol::PROT_NUMBER || protocolNumber == Ipv6L3Protocol::PROT_NUMBER, "unsupported protocol " << protocolNumber << ", only IPv4/IPv6 is supported");
|
||||
NS_LOG_FUNCTION (this << packet << dest << protocolNumber);
|
||||
NS_ABORT_MSG_IF (protocolNumber != Ipv4L3Protocol::PROT_NUMBER
|
||||
&& protocolNumber != Ipv6L3Protocol::PROT_NUMBER,
|
||||
"unsupported protocol " << protocolNumber << ", only IPv4 and IPv6 are supported");
|
||||
return m_rrc->SendData (packet);
|
||||
}
|
||||
|
||||
|
||||
@@ -286,13 +286,11 @@ LteUeNetDevice::DoInitialize (void)
|
||||
bool
|
||||
LteUeNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << dest << protocolNumber);
|
||||
if (protocolNumber != Ipv4L3Protocol::PROT_NUMBER && protocolNumber != Ipv6L3Protocol::PROT_NUMBER)
|
||||
{
|
||||
NS_LOG_INFO ("unsupported protocol " << protocolNumber << ", only IPv4 and IPv6 are supported");
|
||||
return true;
|
||||
}
|
||||
return m_nas->Send (packet);
|
||||
NS_LOG_FUNCTION (this << packet << dest << protocolNumber);
|
||||
NS_ABORT_MSG_IF (protocolNumber != Ipv4L3Protocol::PROT_NUMBER
|
||||
&& protocolNumber != Ipv6L3Protocol::PROT_NUMBER,
|
||||
"unsupported protocol " << protocolNumber << ", only IPv4 and IPv6 are supported");
|
||||
return m_nas->Send (packet, protocolNumber);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "ns3/ipv4-header.h"
|
||||
#include "ns3/udp-header.h"
|
||||
#include "ns3/tcp-header.h"
|
||||
#include "ns3/ipv4-l3-protocol.h"
|
||||
#include "ns3/udp-l4-protocol.h"
|
||||
#include "ns3/tcp-l4-protocol.h"
|
||||
|
||||
@@ -163,7 +164,7 @@ EpcTftClassifierTestCase::DoRun (void)
|
||||
udpPacket->AddHeader (m_udpHeader);
|
||||
udpPacket->AddHeader (m_ipHeader);
|
||||
NS_LOG_LOGIC (this << *udpPacket);
|
||||
uint32_t obtainedTftId = m_c ->Classify (udpPacket, m_d);
|
||||
uint32_t obtainedTftId = m_c ->Classify (udpPacket, m_d, Ipv4L3Protocol::PROT_NUMBER);
|
||||
NS_TEST_ASSERT_MSG_EQ (obtainedTftId, (uint16_t) m_tftId, "bad classification of UDP packet");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user