--- a/src/devices/tap-bridge/tap-bridge.cc Tue Dec 22 14:59:17 2009 +0300 +++ a/src/devices/tap-bridge/tap-bridge.cc Tue Dec 22 18:10:34 2009 +0300 @@ -357,6 +357,7 @@ // // We want to get as much of this stuff automagically as possible. // + // For CONFIGURE_LOCAL mode only: // is the IP address we are going to set in the newly // created Tap device on the Linux host. At the point in the simulation // where devices are coming up, we should have all of our IP addresses @@ -364,20 +365,39 @@ // the new Tap device from the IP address associated with the bridged // net device. // + + bool wantIp = (m_mode == CONFIGURE_LOCAL); + Ptr nd = GetBridgedNetDevice (); Ptr n = nd->GetNode (); Ptr ipv4 = n->GetObject (); - uint32_t index = ipv4->GetInterfaceForDevice (nd); - if (ipv4->GetNAddresses (index) > 1) + + if (wantIp + && (ipv4 == 0) + && m_tapIp.IsBroadcast () + && m_tapNetmask.IsEqual (Ipv4Mask::GetOnes ())) { - NS_LOG_WARN ("Underlying bridged NetDevice has multiple IP addresses; using first one."); + NS_FATAL_ERROR ("TapBridge::CreateTap(): Tap device IP configuration requested but neither IP address nor IP netmask is provided"); } - Ipv4Address ipv4Address = ipv4->GetAddress (index, 0).GetLocal (); - // - // The net mask is sitting right there next to the ipv4 address. - // - Ipv4Mask ipv4Mask = ipv4->GetAddress (index, 0).GetMask (); + // Some stub values to make tap-creator happy + Ipv4Address ipv4Address ("255.255.255.255"); + Ipv4Mask ipv4Mask ("255.255.255.255"); + + if (wantIp) + { + uint32_t index = ipv4->GetInterfaceForDevice (nd); + if (ipv4->GetNAddresses (index) > 1) + { + NS_LOG_WARN ("Underlying bridged NetDevice has multiple IP addresses; using first one."); + } + ipv4Address = ipv4->GetAddress (index, 0).GetLocal (); + + // + // The net mask is sitting right there next to the ipv4 address. + // + ipv4Mask = ipv4->GetAddress (index, 0).GetMask (); + } // // The MAC address should also already be assigned and waiting for us in