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

(-)a/src/internet-stack/icmpv6-header.cc (-5 / +25 lines)
 Lines 983-992    Link Here 
983
983
984
void Icmpv6DestinationUnreachable::Serialize (Buffer::Iterator start) const
984
void Icmpv6DestinationUnreachable::Serialize (Buffer::Iterator start) const
985
{
985
{
986
  const uint8_t *packet = m_packet->PeekData ();
986
  uint8_t *packet = new uint8_t[m_packet->GetSize ()];
987
  uint16_t checksum = 0;
987
  uint16_t checksum = 0;
988
  Buffer::Iterator i = start;
988
  Buffer::Iterator i = start;
989
989
990
  m_packet->CopyData (packet, m_packet->GetSize ());
991
990
  i.WriteU8 (GetType ());
992
  i.WriteU8 (GetType ());
991
  i.WriteU8 (GetCode ());
993
  i.WriteU8 (GetCode ());
992
  i.WriteHtonU16 (0);
994
  i.WriteHtonU16 (0);
 Lines 1000-1005    Link Here 
1000
  i = start;
1002
  i = start;
1001
  i.Next (2);
1003
  i.Next (2);
1002
  i.WriteU16 (checksum);
1004
  i.WriteU16 (checksum);
1005
1006
  delete[] packet;
1003
}
1007
}
1004
1008
1005
uint32_t Icmpv6DestinationUnreachable::Deserialize (Buffer::Iterator start)
1009
uint32_t Icmpv6DestinationUnreachable::Deserialize (Buffer::Iterator start)
 Lines 1078-1087    Link Here 
1078
1082
1079
void Icmpv6TooBig::Serialize (Buffer::Iterator start) const
1083
void Icmpv6TooBig::Serialize (Buffer::Iterator start) const
1080
{
1084
{
1081
  const uint8_t *packet = m_packet->PeekData ();
1085
  uint8_t *packet = new uint8_t[m_packet->GetSize ()];
1082
  uint16_t checksum = 0;
1086
  uint16_t checksum = 0;
1083
  Buffer::Iterator i = start;
1087
  Buffer::Iterator i = start;
1084
1088
1089
  m_packet->CopyData (packet, m_packet->GetSize ());
1090
1085
  i.WriteU8 (GetType ());
1091
  i.WriteU8 (GetType ());
1086
  i.WriteU8 (GetCode ());
1092
  i.WriteU8 (GetCode ());
1087
  i.WriteHtonU16 (0);
1093
  i.WriteHtonU16 (0);
 Lines 1095-1100    Link Here 
1095
  i = start;
1101
  i = start;
1096
  i.Next (2);
1102
  i.Next (2);
1097
  i.WriteU16 (checksum);
1103
  i.WriteU16 (checksum);
1104
1105
  delete[] packet;
1098
}
1106
}
1099
1107
1100
uint32_t Icmpv6TooBig::Deserialize (Buffer::Iterator start) 
1108
uint32_t Icmpv6TooBig::Deserialize (Buffer::Iterator start) 
 Lines 1162-1171    Link Here 
1162
1170
1163
void Icmpv6TimeExceeded::Serialize (Buffer::Iterator start) const
1171
void Icmpv6TimeExceeded::Serialize (Buffer::Iterator start) const
1164
{
1172
{
1165
  const uint8_t *packet = m_packet->PeekData ();
1173
  uint8_t *packet = new uint8_t[m_packet->GetSize ()];
1166
  uint16_t checksum = 0;
1174
  uint16_t checksum = 0;
1167
  Buffer::Iterator i = start;
1175
  Buffer::Iterator i = start;
1168
1176
1177
  m_packet->CopyData (packet, m_packet->GetSize ());
1178
1169
  i.WriteU8 (GetType ());
1179
  i.WriteU8 (GetType ());
1170
  i.WriteU8 (GetCode ());
1180
  i.WriteU8 (GetCode ());
1171
  i.WriteHtonU16 (0);
1181
  i.WriteHtonU16 (0);
 Lines 1179-1184    Link Here 
1179
  i = start;
1189
  i = start;
1180
  i.Next (2);
1190
  i.Next (2);
1181
  i.WriteU16 (checksum);
1191
  i.WriteU16 (checksum);
1192
1193
  delete[] packet;
1182
}
1194
}
1183
1195
1184
uint32_t Icmpv6TimeExceeded::Deserialize (Buffer::Iterator start)
1196
uint32_t Icmpv6TimeExceeded::Deserialize (Buffer::Iterator start)
 Lines 1257-1266    Link Here 
1257
1269
1258
void Icmpv6ParameterError::Serialize (Buffer::Iterator start) const 
1270
void Icmpv6ParameterError::Serialize (Buffer::Iterator start) const 
1259
{
1271
{
1260
  const uint8_t *packet = m_packet->PeekData ();
1272
  uint8_t *packet = new uint8_t[m_packet->GetSize ()];
1261
  uint16_t checksum = 0;
1273
  uint16_t checksum = 0;
1262
  Buffer::Iterator i = start;
1274
  Buffer::Iterator i = start;
1263
1275
1276
  m_packet->CopyData (packet, m_packet->GetSize ());
1277
1264
  i.WriteU8 (GetType ());
1278
  i.WriteU8 (GetType ());
1265
  i.WriteU8 (GetCode ());
1279
  i.WriteU8 (GetCode ());
1266
  i.WriteHtonU16 (0);
1280
  i.WriteHtonU16 (0);
 Lines 1274-1279    Link Here 
1274
  i = start;
1288
  i = start;
1275
  i.Next (2);
1289
  i.Next (2);
1276
  i.WriteU16 (checksum);
1290
  i.WriteU16 (checksum);
1291
1292
  delete[] packet;
1277
}
1293
}
1278
1294
1279
uint32_t Icmpv6ParameterError::Deserialize (Buffer::Iterator start) 
1295
uint32_t Icmpv6ParameterError::Deserialize (Buffer::Iterator start) 
 Lines 1749-1755    Link Here 
1749
  i.WriteU16 (0);
1765
  i.WriteU16 (0);
1750
  i.WriteU32 (0);
1766
  i.WriteU32 (0);
1751
1767
1752
  i.Write (m_packet->PeekData (), m_packet->GetSize ());
1768
  uint32_t size = m_packet->GetSize ();
1769
  uint8_t *packet = new uint8_t[size];
1770
  m_packet->CopyData (packet, size);
1771
  i.Write (packet, size);
1772
  delete[] packet;
1753
}
1773
}
1754
1774
1755
uint32_t Icmpv6OptionRedirected::Deserialize (Buffer::Iterator start)
1775
uint32_t Icmpv6OptionRedirected::Deserialize (Buffer::Iterator start)

Return to bug 925