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

(-)a/src/internet-stack/udp-socket-impl.cc (-4 / +22 lines)
 Lines 66-71    Link Here 
66
    m_rxAvailable (0)
66
    m_rxAvailable (0)
67
{
67
{
68
  NS_LOG_FUNCTION_NOARGS ();
68
  NS_LOG_FUNCTION_NOARGS ();
69
  m_allowBroadcast = false;
69
}
70
}
70
71
71
UdpSocketImpl::~UdpSocketImpl ()
72
UdpSocketImpl::~UdpSocketImpl ()
 Lines 370-375    Link Here 
370
  //
371
  //
371
  if (dest.IsBroadcast ())
372
  if (dest.IsBroadcast ())
372
    {
373
    {
374
      if (!m_allowBroadcast)
375
        {
376
          m_errno = ERROR_OPNOTSUPP;
377
          return -1;
378
        }
373
      NS_LOG_LOGIC ("Limited broadcast start.");
379
      NS_LOG_LOGIC ("Limited broadcast start.");
374
      for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ )
380
      for (uint32_t i = 0; i < ipv4->GetNInterfaces (); i++ )
375
        {
381
        {
 Lines 431-436    Link Here 
431
      if (route != 0)
437
      if (route != 0)
432
        {
438
        {
433
          NS_LOG_LOGIC ("Route exists");
439
          NS_LOG_LOGIC ("Route exists");
440
          if (!m_allowBroadcast)
441
            {
442
              uint32_t outputIfIndex = ipv4->GetInterfaceForDevice (route->GetOutputDevice ());
443
              uint32_t ifNAddr = ipv4->GetNAddresses (outputIfIndex);
444
              for (uint32_t addrI = 0; addrI < ifNAddr; ++addrI)
445
                {
446
                  Ipv4InterfaceAddress ifAddr = ipv4->GetAddress (outputIfIndex, addrI);
447
                  if (dest == ifAddr.GetBroadcast ())
448
                    {
449
                      m_errno = ERROR_OPNOTSUPP;
450
                      return -1;
451
                    }
452
                }
453
            }
454
          
434
          header.SetSource (route->GetSource ());
455
          header.SetSource (route->GetSource ());
435
          m_udp->Send (p->Copy (), header.GetSource (), header.GetDestination (),
456
          m_udp->Send (p->Copy (), header.GetSource (), header.GetDestination (),
436
                       m_endPoint->GetLocalPort (), port, route);
457
                       m_endPoint->GetLocalPort (), port, route);
 Lines 706-715    Link Here 
706
void
727
void
707
UdpSocketImpl::SetAllowBroadcast (bool allowBroadcast)
728
UdpSocketImpl::SetAllowBroadcast (bool allowBroadcast)
708
{
729
{
709
  if (!allowBroadcast)
730
  m_allowBroadcast = allowBroadcast;
710
    {
711
      NS_FATAL_ERROR ("not implemented");
712
    }
713
}
731
}
714
732
715
bool
733
bool
(-)a/src/internet-stack/udp-socket-impl.h (-1 / +2 lines)
 Lines 120-126    Link Here 
120
  bool m_shutdownSend;
120
  bool m_shutdownSend;
121
  bool m_shutdownRecv;
121
  bool m_shutdownRecv;
122
  bool m_connected;
122
  bool m_connected;
123
123
  bool m_allowBroadcast;
124
  
124
  std::queue<Ptr<Packet> > m_deliveryQueue;
125
  std::queue<Ptr<Packet> > m_deliveryQueue;
125
  uint32_t m_rxAvailable;
126
  uint32_t m_rxAvailable;
126
  
127
  

Return to bug 943