disallow routing on bridge devices with IP address, fix wifi-wired-bridging

This commit is contained in:
Craig Dowell
2008-11-26 13:48:53 -08:00
parent 8e049d9194
commit d27274e958
3 changed files with 46 additions and 31 deletions

View File

@@ -14,30 +14,32 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Default network topology
// Default network topology includes some number of AP nodes specified by
// the variable nWifis (defaults to two). Off of each AP node, there are some
// number of STA nodes specified by the variable nStas (defaults to two).
// Each AP talks to its associated STA nodes. There are bridge net devices
// on each AP node that bridge the whole thing into one network.
//
// +-----+ +-----+ +-----+ +-----+
// | sta | | sta | | sta | | sta |
// | STA | | STA | | STA | | STA |
// +-----+ +-----+ +-----+ +-----+
// 192.168.1.2 192.168.1.3 192.168.2.2 192.168.2.3
// 192.168.0.3 192.168.0.4 192.168.0.5 192.168.0.6
// -------- -------- -------- --------
// WIFI STA WIFI STA WIFI STA WIFI STA
// -------- -------- | -------- --------
// -------- -------- -------- --------
// ((*)) ((*)) | ((*)) ((*))
// |
// ((*)) | ((*))
// ------- | -------
// ######## WIFI AP WIFI AP #########
// # ------- ------- #
// B # 102.168.1.1 102.168.2.1 # B
// R # +----------+ +----------+ # R
// I # | backbone | | backbone | # I
// D # +----------+ +----------+ # D
// G # 192.168.0.1 192.168.0.2 # G
// E # ---- ---- # E
// ########## CSMA CSMA ##########
// | |
// ================================
// ((*)) | ((*))
// ------- -------
// WIFI AP CSMA ========= CSMA WIFI AP
// ------- ---- ---- -------
// ############## ##############
// BRIDGE BRIDGE
// ############## ##############
// 192.168.0.1 192.168.0.2
// +---------+ +---------+
// | AP Node | | AP Node |
// +---------+ +---------+
//
#include "ns3/core-module.h"
@@ -86,7 +88,6 @@ int main (int argc, char *argv[])
stack.Install (backboneNodes);
backboneDevices = csma.Install (backboneNodes);
backboneInterfaces = ip.Assign (backboneDevices);
double wifiX = 0.0;
for (uint32_t i = 0; i < nWifis; ++i)
@@ -109,7 +110,6 @@ int main (int argc, char *argv[])
wifiPhy.SetChannel (wifiChannel.Create ());
sta.Create (nStas);
ip.NewNetwork ();
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (wifiX),
"MinY", DoubleValue (0.0),
@@ -127,8 +127,12 @@ int main (int argc, char *argv[])
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (2.5)));
apDev = wifi.Install (wifiPhy, backboneNodes.Get (i));
apInterface = ip.Assign (apDev);
bridge.Install (backboneNodes.Get (i), NetDeviceContainer (apDev, backboneDevices.Get (i)));
NetDeviceContainer bridgeDev;
bridgeDev = bridge.Install (backboneNodes.Get (i), NetDeviceContainer (apDev, backboneDevices.Get (i)));
// assign AP IP address to bridge, not wifi
apInterface = ip.Assign (bridgeDev);
// setup the STAs
stack.Install (sta);

View File

@@ -214,7 +214,7 @@ SPFVertex::GetChild (uint32_t n) const
return *i;
}
}
NS_ASSERT_MSG(false, "Index <n> out of range.");
NS_ASSERT_MSG (false, "Index <n> out of range.");
return 0;
}
@@ -726,7 +726,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
/*
if (w->GetVertexType () == SPFVertex::VertexNetwork && l)
{
NS_ASSERT_MSG(0, "Error: SPFNexthopCalculation parameter problem");
NS_ASSERT_MSG (0, "Error: SPFNexthopCalculation parameter problem");
}
*/
@@ -778,7 +778,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
// return the link record describing the link from <w> to <v>. Think of it as
// SPFGetLink.
//
NS_ASSERT(l);
NS_ASSERT (l);
GlobalRoutingLinkRecord *linkRemote = 0;
linkRemote = SPFGetNextLink (w, v, linkRemote);
//
@@ -792,7 +792,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
// from the root node to the host represented by vertex <w>, you have to send
// the packet to the next hop address specified in w->m_nextHop.
//
w->SetNextHop(linkRemote->GetLinkData ());
w->SetNextHop (linkRemote->GetLinkData ());
//
// Now find the outgoing interface corresponding to the point to point link
// from the perspective of <v> -- remember that <l> is the link "from"
@@ -846,7 +846,7 @@ GlobalRouteManagerImpl::SPFNexthopCalculation (
* use can then be derived from the next hop IP address (or
* it can be inherited from the parent network).
*/
w->SetNextHop(linkRemote->GetLinkData ());
w->SetNextHop (linkRemote->GetLinkData ());
w->SetOutgoingTypeId (v->GetOutgoingTypeId ());
NS_LOG_LOGIC ("Next hop from " <<
v->GetVertexId () << " to " << w->GetVertexId () <<
@@ -1001,7 +1001,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
// of the tree. Initially, this queue is empty.
//
CandidateQueue candidate;
NS_ASSERT(candidate.Size () == 0);
NS_ASSERT (candidate.Size () == 0);
//
// Initialize the shortest-path tree to only contain the router doing the
// calculation. Each router (and corresponding network) is a vertex in the
@@ -1108,7 +1108,7 @@ GlobalRouteManagerImpl::SPFCalculate (Ipv4Address root)
}
else
{
NS_ASSERT_MSG(0, "illegal SPFVertex type");
NS_ASSERT_MSG (0, "illegal SPFVertex type");
}
//
// RFC2328 16.1. (5).

View File

@@ -589,8 +589,7 @@ GlobalRouter::DiscoverLSAs (void)
{
uint32_t ifIndexBridge;
bool rc = FindIfIndexForDevice(node, ndLocal, ifIndexBridge);
NS_ABORT_MSG_IF (rc, "GlobalRouter::ProcessBridgedBroadcastLink(): "
"Bridge ports must not have an IPv4 interface index");
NS_ABORT_MSG_IF (rc, "GlobalRouter::DiscoverLSAs(): Bridge ports must not have an IPv4 interface index");
}
//
@@ -782,9 +781,19 @@ GlobalRouter::ProcessSingleBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *p
GlobalRouter::ProcessBridgedBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
{
NS_LOG_FUNCTION (nd << pLSA << &c);
NS_ASSERT_MSG (nd->IsBridge (), "GlobalRouter::ProcessBridgedBroadcastLink(): Called with non-bridge net device");
#if 0
//
// It is possible to admit the possibility that a bridge device on a node
// can also participate in routing. This would surprise people who don't
// come from Microsoft-land where they do use such a construct. Based on
// the principle of least-surprise, we will leave the relatively simple
// code in place to do this, but not enable it until someone really wants
// the capability. Even then, we will not enable this code as a default
// but rather something you will have to go and turn on.
//
Ptr<BridgeNetDevice> bnd = nd->GetObject<BridgeNetDevice> ();
NS_ABORT_MSG_UNLESS (bnd, "GlobalRouter::DiscoverLSAs (): GetObject for <BridgeNetDevice> failed");
@@ -817,6 +826,7 @@ GlobalRouter::ProcessBridgedBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *
// to do is to repeat what is done for a single broadcast link on all of
// those net devices living under the bridge (trolls?)
//
bool areTransitNetwork = false;
Ipv4Address desigRtr ("255.255.255.255");
@@ -921,6 +931,7 @@ GlobalRouter::ProcessBridgedBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *
pLSA->AddLinkRecord (plr);
plr = 0;
}
#endif
}
void