LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2007-2009 Strasbourg University | 3 * Copyright (c) 2007-2009 Strasbourg University |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 { | 263 { |
264 /* calculate checksum here for ICMPv6 echo request (sent by ping6)······· | 264 /* calculate checksum here for ICMPv6 echo request (sent by ping6)······· |
265 * as we cannot determine source IPv6 address at application level······· | 265 * as we cannot determine source IPv6 address at application level······· |
266 */ | 266 */ |
267 uint8_t type; | 267 uint8_t type; |
268 p->CopyData (&type, sizeof(type)); | 268 p->CopyData (&type, sizeof(type)); |
269 if (type == Icmpv6Header::ICMPV6_ECHO_REQUEST) | 269 if (type == Icmpv6Header::ICMPV6_ECHO_REQUEST) |
270 { | 270 { |
271 Icmpv6Echo chdr (1); | 271 Icmpv6Echo chdr (1); |
272 p->RemoveHeader (chdr); | 272 p->RemoveHeader (chdr); |
273 chdr.CalculatePseudoHeaderChecksum (route->GetSource (), dst,
static_cast<uint16_t>(p->GetSize () + chdr.GetSerializedSize ()), (uint8_t)Icmpv
6L4Protocol::GetStaticProtocolNumber ()); | 273 chdr.CalculatePseudoHeaderChecksum (route->GetSource (), dst,
p->GetSize () + chdr.GetSerializedSize (), (uint8_t)Icmpv6L4Protocol::GetStaticP
rotocolNumber ()); |
274 p->AddHeader (chdr); | 274 p->AddHeader (chdr); |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 uint32_t pktSize = p->GetSize (); | 278 uint32_t pktSize = p->GetSize (); |
279 if (m_src.IsAny ()) | 279 if (m_src.IsAny ()) |
280 { | 280 { |
281 ipv6->Send (p, route->GetSource (), dst, static_cast<uint8_t>(m_pr
otocol), route); | 281 ipv6->Send (p, route->GetSource (), dst, static_cast<uint8_t> (m_p
rotocol), route); |
282 } | 282 } |
283 else | 283 else |
284 { | 284 { |
285 ipv6->Send (p, m_src, dst, static_cast<uint8_t>(m_protocol), route
); | 285 ipv6->Send (p, m_src, dst, static_cast<uint8_t> (m_protocol), rout
e); |
286 } | 286 } |
287 // Return only payload size (as Linux does). | 287 // Return only payload size (as Linux does). |
288 NotifyDataSent (pktSize); | 288 NotifyDataSent (pktSize); |
289 NotifySend (GetTxAvailable ()); | 289 NotifySend (GetTxAvailable ()); |
290 return pktSize; | 290 return pktSize; |
291 } | 291 } |
292 else | 292 else |
293 { | 293 { |
294 NS_LOG_DEBUG ("No route, dropped!"); | 294 NS_LOG_DEBUG ("No route, dropped!"); |
295 } | 295 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 /* packet filtered */ | 430 /* packet filtered */ |
431 return false; | 431 return false; |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 // Should check via getsockopt (). | 435 // Should check via getsockopt (). |
436 if (IsRecvPktInfo ()) | 436 if (IsRecvPktInfo ()) |
437 { | 437 { |
438 Ipv6PacketInfoTag tag; | 438 Ipv6PacketInfoTag tag; |
439 copy->RemovePacketTag (tag); | 439 copy->RemovePacketTag (tag); |
440 tag.SetRecvIf (device->GetIfIndex ()); | 440 tag.SetRecvIf (static_cast<uint8_t> (device->GetIfIndex ())); |
441 copy->AddPacketTag (tag); | 441 copy->AddPacketTag (tag); |
442 } | 442 } |
443 | 443 |
444 // Check only version 6 options | 444 // Check only version 6 options |
445 if (IsIpv6RecvTclass ()) | 445 if (IsIpv6RecvTclass ()) |
446 { | 446 { |
447 SocketIpv6TclassTag ipTclassTag; | 447 SocketIpv6TclassTag ipTclassTag; |
448 ipTclassTag.SetTclass (hdr.GetTrafficClass ()); | 448 ipTclassTag.SetTclass (hdr.GetTrafficClass ()); |
449 copy->AddPacketTag (ipTclassTag); | 449 copy->AddPacketTag (ipTclassTag); |
450 } | 450 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 515 } |
516 | 516 |
517 bool | 517 bool |
518 Ipv6RawSocketImpl::Icmpv6FilterWillBlock(uint8_t type) | 518 Ipv6RawSocketImpl::Icmpv6FilterWillBlock(uint8_t type) |
519 { | 519 { |
520 return (((m_icmpFilter.icmpv6Filt[(type) >> 5]) & (uint32_t(1) << ((type) & 31
))) == 0); | 520 return (((m_icmpFilter.icmpv6Filt[(type) >> 5]) & (uint32_t(1) << ((type) & 31
))) == 0); |
521 } | 521 } |
522 | 522 |
523 } /* namespace ns3 */ | 523 } /* namespace ns3 */ |
524 | 524 |
LEFT | RIGHT |