View | Details | Raw Unified | Return to bug 782
Collapse All | Expand All

(-)a/src/devices/tap-bridge/tap-bridge.cc (-8 / +28 lines)
 Lines 357-362    Link Here 
357
      //
357
      //
358
      // We want to get as much of this stuff automagically as possible.
358
      // We want to get as much of this stuff automagically as possible.
359
      //
359
      //
360
      // For CONFIGURE_LOCAL mode only:
360
      // <IP-address> is the IP address we are going to set in the newly 
361
      // <IP-address> is the IP address we are going to set in the newly 
361
      // created Tap device on the Linux host.  At the point in the simulation
362
      // created Tap device on the Linux host.  At the point in the simulation
362
      // where devices are coming up, we should have all of our IP addresses
363
      // where devices are coming up, we should have all of our IP addresses
 Lines 364-383    Link Here 
364
      // the new Tap device from the IP address associated with the bridged
365
      // the new Tap device from the IP address associated with the bridged
365
      // net device.
366
      // net device.
366
      //
367
      //
368
369
      bool wantIp = (m_mode == CONFIGURE_LOCAL);
370
367
      Ptr<NetDevice> nd = GetBridgedNetDevice ();
371
      Ptr<NetDevice> nd = GetBridgedNetDevice ();
368
      Ptr<Node> n = nd->GetNode ();
372
      Ptr<Node> n = nd->GetNode ();
369
      Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
373
      Ptr<Ipv4> ipv4 = n->GetObject<Ipv4> ();
370
      uint32_t index = ipv4->GetInterfaceForDevice (nd);
374
371
      if (ipv4->GetNAddresses (index) > 1)
375
      if (wantIp
376
            && (ipv4 == 0)
377
            && m_tapIp.IsBroadcast ()
378
            && m_tapNetmask.IsEqual (Ipv4Mask::GetOnes ()))
372
        {
379
        {
373
          NS_LOG_WARN ("Underlying bridged NetDevice has multiple IP addresses; using first one.");
380
          NS_FATAL_ERROR ("TapBridge::CreateTap(): Tap device IP configuration requested but neither IP address nor IP netmask is provided");
374
        }
381
        }
375
      Ipv4Address ipv4Address = ipv4->GetAddress (index, 0).GetLocal ();
376
382
377
      //
383
      // Some stub values to make tap-creator happy
378
      // The net mask is sitting right there next to the ipv4 address.
384
      Ipv4Address ipv4Address ("255.255.255.255");
379
      //
385
      Ipv4Mask ipv4Mask ("255.255.255.255");
380
      Ipv4Mask ipv4Mask = ipv4->GetAddress (index, 0).GetMask ();
386
387
      if (wantIp)
388
        {
389
          uint32_t index = ipv4->GetInterfaceForDevice (nd);
390
          if (ipv4->GetNAddresses (index) > 1)
391
            {
392
              NS_LOG_WARN ("Underlying bridged NetDevice has multiple IP addresses; using first one.");
393
            }
394
          ipv4Address = ipv4->GetAddress (index, 0).GetLocal ();
395
396
          //
397
          // The net mask is sitting right there next to the ipv4 address.
398
          //
399
          ipv4Mask = ipv4->GetAddress (index, 0).GetMask ();
400
        }
381
401
382
      //
402
      //
383
      // The MAC address should also already be assigned and waiting for us in
403
      // The MAC address should also already be assigned and waiting for us in

Return to bug 782