Xia Yang
unread,Jun 7, 2011, 1:56:08 AM6/7/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-users
Dear All,
I notice there might be a bug in the implementation of ipv4-l3-
protocol. The problem surfaces when doing a subnet directed broadcast
over multiple interfaces which are assigned with IPv4 addresses under
the same subnet. It seems the current code (3.10) only finds the first
interface with the same subnet, even the socket is bound to a
different netdevice and the packet is sent using a different source
address. This will cause the broadcast traffic being sent out to wrong
network interfaces.
If anyone encounters similar problems, please confirm my observation
so that this bug can be reported to the development team. Thanks!
The code snippet handling this part is as follows:
src/internet-stack/ipv4-l3-protocol.cc
// 2) check: packet is destined to a subnet-directed broadcast
address
uint32_t ifaceIndex = 0;
for (Ipv4InterfaceList::iterator ifaceIter = m_interfaces.begin ();
ifaceIter != m_interfaces.end (); ifaceIter++, ifaceIndex++)
{
Ptr<Ipv4Interface> outInterface = *ifaceIter;
for (uint32_t j = 0; j < GetNAddresses (ifaceIndex); j++)
{
Ipv4InterfaceAddress ifAddr = GetAddress (ifaceIndex, j);
NS_LOG_LOGIC ("Testing address " << ifAddr.GetLocal () << "
with mask " << ifAddr.GetMask ());
if (destination.IsSubnetDirectedBroadcast (ifAddr.GetMask
()) &&
destination.CombineMask (ifAddr.GetMask ()) ==
ifAddr.GetLocal ().CombineMask (ifAddr.GetMask ()) )
{
NS_LOG_LOGIC ("Ipv4L3Protocol::Send case 2: subnet
directed bcast to " << ifAddr.GetLocal ());
ipHeader = BuildHeader (source, destination, protocol,
packet->GetSize (), ttl, mayFragment);
Ptr<Packet> packetCopy = packet->Copy ();
m_sendOutgoingTrace (ipHeader, packetCopy, ifaceIndex);
packetCopy->AddHeader (ipHeader);
m_txTrace (packetCopy, m_node->GetObject<Ipv4> (),
ifaceIndex);
outInterface->Send (packetCopy, destination);
return;
}
}
}