|
|
| 51 |
UintegerValue (0), |
51 |
UintegerValue (0), |
| 52 |
MakeUintegerAccessor (&Ipv6RawSocketImpl::m_protocol), |
52 |
MakeUintegerAccessor (&Ipv6RawSocketImpl::m_protocol), |
| 53 |
MakeUintegerChecker<uint16_t> ()) |
53 |
MakeUintegerChecker<uint16_t> ()) |
| 54 |
.AddAttribute ("IcmpFilter", "Any ICMPv6 header whose type field matches a bit in this filter is dropped.", |
|
|
| 55 |
UintegerValue (0), |
| 56 |
MakeUintegerAccessor (&Ipv6RawSocketImpl::m_icmpFilter), |
| 57 |
MakeUintegerChecker<uint32_t> ()) |
| 58 |
; |
54 |
; |
| 59 |
return tid; |
55 |
return tid; |
| 60 |
} |
56 |
} |
|
|
| 69 |
m_protocol = 0; |
65 |
m_protocol = 0; |
| 70 |
m_shutdownSend = false; |
66 |
m_shutdownSend = false; |
| 71 |
m_shutdownRecv = false; |
67 |
m_shutdownRecv = false; |
|
|
68 |
Icmpv6FilterSetPassAll(); |
| 72 |
} |
69 |
} |
| 73 |
|
70 |
|
| 74 |
Ipv6RawSocketImpl::~Ipv6RawSocketImpl () |
71 |
Ipv6RawSocketImpl::~Ipv6RawSocketImpl () |
|
|
| 328 |
copy->PeekHeader (icmpHeader); |
325 |
copy->PeekHeader (icmpHeader); |
| 329 |
uint8_t type = icmpHeader.GetType (); |
326 |
uint8_t type = icmpHeader.GetType (); |
| 330 |
|
327 |
|
| 331 |
if ((1 << type) & m_icmpFilter) |
328 |
if (Icmpv6FilterWillBlock(type)) |
| 332 |
{ |
329 |
{ |
| 333 |
/* packet filtered */ |
330 |
/* packet filtered */ |
| 334 |
return false; |
331 |
return false; |
|
|
| 372 |
return true; |
369 |
return true; |
| 373 |
} |
370 |
} |
| 374 |
|
371 |
|
|
|
372 |
void |
| 373 |
Ipv6RawSocketImpl::Icmpv6FilterSetPassAll() |
| 374 |
{ |
| 375 |
memset(&m_icmpFilter, 0xff, sizeof(icmpv6Filter)); |
| 376 |
} |
| 377 |
|
| 378 |
void |
| 379 |
Ipv6RawSocketImpl::Icmpv6FilterSetBlockAll() |
| 380 |
{ |
| 381 |
memset(&m_icmpFilter, 0x00, sizeof(icmpv6Filter)); |
| 382 |
} |
| 383 |
|
| 384 |
void |
| 385 |
Ipv6RawSocketImpl::Icmpv6FilterSetPass(uint8_t type) |
| 386 |
{ |
| 387 |
(m_icmpFilter.icmpv6Filt[(type) >> 5]) |= (uint32_t(1) << ((type) & 31)); |
| 388 |
} |
| 389 |
|
| 390 |
void |
| 391 |
Ipv6RawSocketImpl::Icmpv6FilterSetBlock(uint8_t type) |
| 392 |
{ |
| 393 |
(m_icmpFilter.icmpv6Filt[(type) >> 5]) &= ~(uint32_t(1) << ((type) & 31)); |
| 394 |
} |
| 395 |
|
| 396 |
bool |
| 397 |
Ipv6RawSocketImpl::Icmpv6FilterWillPass(uint8_t type) |
| 398 |
{ |
| 399 |
return (((m_icmpFilter.icmpv6Filt[(type) >> 5]) & (uint32_t(1) << ((type) & 31))) != 0); |
| 400 |
} |
| 401 |
|
| 402 |
bool |
| 403 |
Ipv6RawSocketImpl::Icmpv6FilterWillBlock(uint8_t type) |
| 404 |
{ |
| 405 |
return (((m_icmpFilter.icmpv6Filt[(type) >> 5]) & (uint32_t(1) << ((type) & 31))) == 0); |
| 406 |
} |
| 407 |
|
| 375 |
} /* namespace ns3 */ |
408 |
} /* namespace ns3 */ |
| 376 |
|
409 |
|