Lines 349-356
UdpSocketImpl::DoSendTo (Ptr<Packet> p,
|
Link Here
|
---|
|
349 |
} |
349 |
} |
350 |
} |
350 |
} |
351 |
// |
351 |
// |
352 |
// If dest is sent to the limited broadcast address (all ones), |
352 |
// If dest is set to the limited broadcast address (all ones), |
353 |
// convert it to send a copy of the packet out of every interface |
353 |
// convert it to send a copy of the packet out of every |
|
|
354 |
// interface as a subnet-directed broadcast. |
355 |
// Exception: if the interface has a /32 address, there is no |
356 |
// valid subnet-directed broadcast, so send it as limited broadcast |
357 |
// Note also that some systems will only send limited broadcast packets |
358 |
// out of the "default" interface; here we send it out all interfaces |
354 |
// |
359 |
// |
355 |
if (dest.IsBroadcast ()) |
360 |
if (dest.IsBroadcast ()) |
356 |
{ |
361 |
{ |
Lines 359-371
UdpSocketImpl::DoSendTo (Ptr<Packet> p,
|
Link Here
|
---|
|
359 |
{ |
364 |
{ |
360 |
Ipv4Address addri = ipv4->GetAddress (i); |
365 |
Ipv4Address addri = ipv4->GetAddress (i); |
361 |
Ipv4Mask maski = ipv4->GetNetworkMask (i); |
366 |
Ipv4Mask maski = ipv4->GetNetworkMask (i); |
362 |
Ipv4Address bcast = addri.GetSubnetDirectedBroadcast (maski); |
367 |
if (maski == Ipv4Mask::GetOnes ()) |
363 |
NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << bcast |
368 |
{ |
364 |
<< " (mask is " << maski << ")"); |
369 |
// if the network mask is 255.255.255.255, do not convert dest |
365 |
m_udp->Send (p->Copy (), addri, bcast, |
370 |
NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << dest |
366 |
m_endPoint->GetLocalPort (), port); |
371 |
<< " (mask is " << maski << ")"); |
367 |
NotifyDataSent (p->GetSize ()); |
372 |
m_udp->Send (p->Copy (), addri, dest, |
368 |
NotifySend (GetTxAvailable ()); |
373 |
m_endPoint->GetLocalPort (), port); |
|
|
374 |
NotifyDataSent (p->GetSize ()); |
375 |
NotifySend (GetTxAvailable ()); |
376 |
} |
377 |
else |
378 |
{ |
379 |
// Convert to subnet-directed broadcast |
380 |
Ipv4Address bcast = addri.GetSubnetDirectedBroadcast (maski); |
381 |
NS_LOG_LOGIC ("Sending one copy from " << addri << " to " << bcast |
382 |
<< " (mask is " << maski << ")"); |
383 |
m_udp->Send (p->Copy (), addri, bcast, |
384 |
m_endPoint->GetLocalPort (), port); |
385 |
NotifyDataSent (p->GetSize ()); |
386 |
NotifySend (GetTxAvailable ()); |
387 |
} |
369 |
} |
388 |
} |
370 |
NS_LOG_LOGIC ("Limited broadcast end."); |
389 |
NS_LOG_LOGIC ("Limited broadcast end."); |
371 |
return p->GetSize(); |
390 |
return p->GetSize(); |