semi-real multicast hardware addresses
This commit is contained in:
@@ -132,7 +132,7 @@ CsmaNetDevice::Init(bool sendEnable, bool receiveEnable)
|
||||
m_queue = 0;
|
||||
|
||||
EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff"));
|
||||
EnableMulticast();
|
||||
EnableMulticast (Eui48Address ("01:00:5e:00:00:00"));
|
||||
|
||||
SetSendEnable (sendEnable);
|
||||
SetReceiveEnable (receiveEnable);
|
||||
@@ -500,10 +500,11 @@ CsmaNetDevice::Receive (const Packet& packet)
|
||||
EthernetHeader header (false);
|
||||
EthernetTrailer trailer;
|
||||
Eui48Address broadcast;
|
||||
Eui48Address multicast;
|
||||
Eui48Address destination;
|
||||
Packet p = packet;
|
||||
|
||||
NS_DEBUG ("CsmaNetDevice::Receive UID is (" << p.GetUid() << ")");
|
||||
NS_DEBUG ("CsmaNetDevice::Receive (): UID is " << p.GetUid());
|
||||
|
||||
// Only receive if send side of net device is enabled
|
||||
if (!IsReceiveEnabled())
|
||||
@@ -522,12 +523,25 @@ CsmaNetDevice::Receive (const Packet& packet)
|
||||
trailer.CheckFcs(p);
|
||||
p.RemoveHeader(header);
|
||||
|
||||
NS_DEBUG ("CsmaNetDevice::Receive (): Pkt destination is " <<
|
||||
header.GetDestination ());
|
||||
//
|
||||
// XXX BUGBUG
|
||||
//
|
||||
// An IP host group address is mapped to an Ethernet multicast address
|
||||
// by placing the low-order 23-bits of the IP address into the low-order
|
||||
// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex).
|
||||
//
|
||||
// Need to mask off the appropriate multicast bits.
|
||||
//
|
||||
multicast = Eui48Address::ConvertFrom (GetMulticast ());
|
||||
broadcast = Eui48Address::ConvertFrom (GetBroadcast ());
|
||||
destination = Eui48Address::ConvertFrom (GetAddress ());
|
||||
if ((header.GetDestination() != broadcast) &&
|
||||
(header.GetDestination() != multicast) &&
|
||||
(header.GetDestination() != destination))
|
||||
{
|
||||
// not for us.
|
||||
NS_DEBUG ("CsmaNetDevice::Receive (): Dropping pkt ");
|
||||
m_dropTrace (p);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,11 +68,14 @@ PointToPointNetDevice::PointToPointNetDevice (Ptr<Node> node,
|
||||
{
|
||||
NS_DEBUG ("PointToPointNetDevice::PointToPointNetDevice (" << node << ")");
|
||||
|
||||
// BUGBUG FIXME
|
||||
//
|
||||
// You _must_ support broadcast to get any sort of packet from the ARP layer.
|
||||
// BUGBUG FIXME
|
||||
//
|
||||
// You _must_ support broadcast to get any sort of packet from the ARP layer.
|
||||
EnableBroadcast (Eui48Address ("ff:ff:ff:ff:ff:ff"));
|
||||
EnableMulticast();
|
||||
//
|
||||
// Randomly pick the ethernet multicast address base
|
||||
//
|
||||
EnableMulticast (Eui48Address ("01:00:5e:00:00:00"));
|
||||
EnablePointToPoint();
|
||||
}
|
||||
|
||||
|
||||
@@ -84,9 +84,18 @@ ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest)
|
||||
else if (dest.IsMulticast ())
|
||||
{
|
||||
NS_DEBUG ("ArpIpv4Interface::SendTo (): IsMulticast");
|
||||
// XXX BUGBUG
|
||||
// Need real multicast addresses
|
||||
hardwareDestination = GetDevice ()->GetBroadcast ();
|
||||
NS_ASSERT_MSG(GetDevice ()->IsMulticast (),
|
||||
"ArpIpv4Interface::SendTo (): Sending multicast packet over "
|
||||
"non-multicast device");
|
||||
// XXX
|
||||
//
|
||||
// An IP host group address is mapped to an Ethernet multicast address
|
||||
// by placing the low-order 23-bits of the IP address into the low-order
|
||||
// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex).
|
||||
//
|
||||
// Currently no easy way to or bit from Ipv4Address into Address
|
||||
//
|
||||
hardwareDestination = GetDevice ()->GetMulticast ();
|
||||
found = true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -288,12 +288,13 @@ Ipv4L3Protocol::Lookup (
|
||||
// want to force users to construct a route in order to get packets out of a
|
||||
// node, so there will have been no route found and it is left to us to send
|
||||
// the packet. What we'll do is to send the multicast out all of the
|
||||
// interfaces on this node.
|
||||
// interfaces on this node. Note that we start with interface 1 since we
|
||||
// don't particularly want to send the packet out the loopback.
|
||||
//
|
||||
NS_DEBUG ("Ipv4StaticRouting::Lookup (): "
|
||||
"Local source. Flooding multicast packet");
|
||||
|
||||
for (uint32_t i = 0; i < GetNInterfaces (); ++i)
|
||||
for (uint32_t i = 1; i < GetNInterfaces (); ++i)
|
||||
{
|
||||
Packet p = packet;
|
||||
Ipv4Header h = ipHeader;
|
||||
|
||||
@@ -113,6 +113,7 @@ NetDevice::IsBroadcast (void) const
|
||||
{
|
||||
return m_isBroadcast;
|
||||
}
|
||||
|
||||
Address const &
|
||||
NetDevice::GetBroadcast (void) const
|
||||
{
|
||||
@@ -139,10 +140,18 @@ NetDevice::IsMulticast (void) const
|
||||
return m_isMulticast;
|
||||
}
|
||||
|
||||
Address const &
|
||||
NetDevice::GetMulticast (void) const
|
||||
{
|
||||
NS_ASSERT (m_isMulticast);
|
||||
return m_multicast;
|
||||
}
|
||||
|
||||
void
|
||||
NetDevice::EnableMulticast (void)
|
||||
NetDevice::EnableMulticast (Address multicast)
|
||||
{
|
||||
m_isMulticast = true;
|
||||
m_multicast = multicast;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -138,10 +138,21 @@ public:
|
||||
* not true.
|
||||
*/
|
||||
Address const &GetBroadcast (void) const;
|
||||
|
||||
/**
|
||||
* \return value of m_isMulticast flag
|
||||
*/
|
||||
bool IsMulticast (void) const;
|
||||
|
||||
/**
|
||||
* \return the multicast address supported by
|
||||
* this netdevice.
|
||||
*
|
||||
* Calling this method is invalid if IsMulticast returns
|
||||
* not true.
|
||||
*/
|
||||
Address const &GetMulticast (void) const;
|
||||
|
||||
/**
|
||||
* \return value of m_isPointToPoint flag
|
||||
*/
|
||||
@@ -212,9 +223,10 @@ public:
|
||||
*/
|
||||
void DisableBroadcast (void);
|
||||
/**
|
||||
* Set m_isMulticast flag to true
|
||||
* Enable multicast support. This method should be
|
||||
* called by subclasses from their constructor
|
||||
*/
|
||||
void EnableMulticast (void);
|
||||
void EnableMulticast (Address multicast);
|
||||
/**
|
||||
* Set m_isMulticast flag to false
|
||||
*/
|
||||
@@ -303,6 +315,7 @@ public:
|
||||
uint16_t m_ifIndex;
|
||||
Address m_address;
|
||||
Address m_broadcast;
|
||||
Address m_multicast;
|
||||
uint16_t m_mtu;
|
||||
bool m_isUp;
|
||||
bool m_isBroadcast;
|
||||
|
||||
Reference in New Issue
Block a user