Coverage Report

Created: 2025-08-29 07:34

/src/PcapPlusPlus/Tests/Fuzzers/ReadParsedPacket.h
Line
Count
Source (jump to first uncovered line)
1
#pragma once
2
3
#include <Packet.h>
4
#include <IPv4Layer.h>
5
#include <TelnetLayer.h>
6
#include <BgpLayer.h>
7
#include <DhcpLayer.h>
8
#include <DhcpV6Layer.h>
9
#include <DnsLayer.h>
10
#include <IcmpLayer.h>
11
#include <NtpLayer.h>
12
#include <SSLLayer.h>
13
#include <SSLHandshake.h>
14
#include <TcpLayer.h>
15
#include <SdpLayer.h>
16
#include <VrrpLayer.h>
17
#include <Sll2Layer.h>
18
#include <FtpLayer.h>
19
#include <GreLayer.h>
20
#include <GtpLayer.h>
21
#include <SomeIpSdLayer.h>
22
23
// Call some pcpp::Packet methods that are not invoked from general virtual methods
24
// as `pcpp::Packet::toString` or `pcpp::Packet::computeCalculateFields` to trigger possible crashes.
25
// The general rule is the functions do not modify the `parsedPacket`.
26
// If you made changes to PcapPlusPlus and the code doesn't compile - fix the method call as any other unit test
27
static void readParsedPacket(pcpp::Packet parsedPacket, pcpp::Layer* layer)
28
0
{
29
0
  if (parsedPacket.isPacketOfType(pcpp::Telnet))
30
0
  {
31
0
    if (auto telnetLayer = dynamic_cast<pcpp::TelnetLayer*>(layer))
32
0
    {
33
0
      telnetLayer->getFirstCommand();
34
0
      telnetLayer->getTotalNumberOfCommands();
35
36
0
      pcpp::TelnetLayer::TelnetCommand commandVal;
37
0
      do
38
0
      {
39
0
        commandVal = telnetLayer->getNextCommand();
40
0
        std::cout << "Telnet command is '" << telnetLayer->getTelnetCommandAsString(commandVal) << "'"
41
0
                  << std::endl;
42
0
        pcpp::TelnetLayer::TelnetOption option = telnetLayer->getOption();
43
0
        std::cout << "Telnet option is '" << telnetLayer->getTelnetOptionAsString(option) << "'" << std::endl;
44
45
0
        telnetLayer->getDataAsString(true);
46
0
        telnetLayer->getNumberOfCommands(commandVal);
47
0
        telnetLayer->getOption(commandVal);
48
0
        size_t length = 0;
49
0
        telnetLayer->getOptionData(length);
50
0
        telnetLayer->getOptionData(commandVal, length);
51
0
      } while (commandVal != pcpp::TelnetLayer::TelnetCommand::TelnetCommandEndOfPacket);
52
0
    }
53
0
  }
54
0
  if (parsedPacket.isPacketOfType(pcpp::ARP))
55
0
  {
56
0
    if (auto arpLayer = dynamic_cast<pcpp::ArpLayer*>(layer))
57
0
    {
58
0
      arpLayer->isReply();
59
0
      arpLayer->isRequest();
60
0
    }
61
0
  }
62
0
  if (parsedPacket.isPacketOfType(pcpp::SomeIP))
63
0
  {
64
0
    if (auto someipLayer = dynamic_cast<pcpp::SomeIpSdLayer*>(layer))
65
0
    {
66
0
      auto entries = someipLayer->getEntries();
67
0
      if (!entries.empty())
68
0
      {
69
0
        auto opts = someipLayer->getOptionsFromEntry(0);
70
0
        for (auto opt : opts)
71
0
          delete opt;
72
0
      }
73
74
0
      for (auto entry : entries)
75
0
      {
76
0
        entry->getNumOptions();
77
0
        entry->getServiceId();
78
0
        entry->getInstanceId();
79
0
        entry->getMajorVersion();
80
0
        entry->getMinorVersion();
81
0
        entry->getCounter();
82
0
        entry->getEventgroupId();
83
0
        delete entry;
84
0
      }
85
86
0
      someipLayer->getFlags();
87
0
      auto opts = someipLayer->getOptions();
88
0
      for (auto opt : opts)
89
0
      {
90
0
        opt->getType();
91
0
        if (auto v4opt = dynamic_cast<pcpp::SomeIpSdIPv4Option*>(opt))
92
0
        {
93
0
          v4opt->getIpAddress();
94
0
          v4opt->getPort();
95
0
          v4opt->getProtocol();
96
0
        }
97
0
        else if (auto v6opt = dynamic_cast<pcpp::SomeIpSdIPv6Option*>(opt))
98
0
        {
99
0
          v6opt->getIpAddress();
100
0
          v6opt->getPort();
101
0
          v6opt->getProtocol();
102
0
        }
103
0
        delete opt;
104
0
      }
105
0
    }
106
0
  }
107
0
  if (parsedPacket.isPacketOfType(pcpp::GTP))
108
0
  {
109
0
    if (auto gtpLayer = dynamic_cast<pcpp::GtpV1Layer*>(layer))
110
0
    {
111
0
      uint16_t value16 = 0;
112
0
      gtpLayer->getSequenceNumber(value16);
113
0
      uint8_t value8;
114
0
      gtpLayer->getNpduNumber(value8);
115
0
      gtpLayer->getMessageType();
116
0
      gtpLayer->getMessageTypeAsString();
117
0
      gtpLayer->isGTPUMessage();
118
0
      gtpLayer->isGTPCMessage();
119
0
      auto ext = gtpLayer->getNextExtension();
120
0
      ext.getExtensionType();
121
0
      ext.getContent();
122
0
      ext.getContentLength();
123
0
      ext.getNextExtension();
124
0
    }
125
0
  }
126
0
  if (parsedPacket.isPacketOfType(pcpp::GRE))
127
0
  {
128
0
    if (auto greLayer = dynamic_cast<pcpp::GreLayer*>(layer))
129
0
    {
130
0
      uint32_t value32 = 0;
131
0
      greLayer->getSequenceNumber(value32);
132
0
    }
133
0
  }
134
0
  if (parsedPacket.isPacketOfType(pcpp::GREv0))
135
0
  {
136
0
    if (auto greLayer = dynamic_cast<pcpp::GREv0Layer*>(layer))
137
0
    {
138
0
      uint16_t value16 = 0;
139
0
      greLayer->getChecksum(value16);
140
0
      greLayer->getOffset(value16);
141
0
      uint32_t value32 = 0;
142
0
      greLayer->getKey(value32);
143
0
    }
144
0
  }
145
0
  if (parsedPacket.isPacketOfType(pcpp::GREv1))
146
0
  {
147
0
    if (auto greLayer = dynamic_cast<pcpp::GREv1Layer*>(layer))
148
0
    {
149
0
      uint32_t value32 = 0;
150
0
      greLayer->getAcknowledgmentNum(value32);
151
0
    }
152
0
  }
153
0
  if (parsedPacket.isPacketOfType(pcpp::FTP))
154
0
  {
155
0
    if (auto ftpLayer = dynamic_cast<pcpp::FtpRequestLayer*>(layer))
156
0
    {
157
0
      ftpLayer->getCommandOption(false);
158
0
      ftpLayer->getCommandOption(true);
159
0
    }
160
0
    else if (auto ftpLayer = dynamic_cast<pcpp::FtpResponseLayer*>(layer))
161
0
    {
162
0
      ftpLayer->getStatusCode();
163
0
      ftpLayer->getStatusOption(false);
164
0
      ftpLayer->getStatusOption(true);
165
0
    }
166
0
  }
167
0
  if (parsedPacket.isPacketOfType(pcpp::SLL2))
168
0
  {
169
0
    if (auto sllLayer = dynamic_cast<pcpp::Sll2Layer*>(layer))
170
0
    {
171
0
      sllLayer->getLinkLayerAsMacAddress();
172
0
      sllLayer->getProtocolType();
173
0
      sllLayer->getInterfaceIndex();
174
0
      sllLayer->getArphrdType();
175
0
      sllLayer->getPacketType();
176
0
    }
177
0
  }
178
0
  if (parsedPacket.isPacketOfType(pcpp::VRRP))
179
0
  {
180
0
    if (auto vrrpLayer = dynamic_cast<pcpp::VrrpLayer*>(layer))
181
0
    {
182
0
      vrrpLayer->getIPAddresses();
183
0
      vrrpLayer->isChecksumCorrect();
184
0
      vrrpLayer->getChecksum();
185
0
      vrrpLayer->getPriorityAsEnum();
186
0
      vrrpLayer->getPriority();
187
0
      vrrpLayer->getType();
188
0
    }
189
0
  }
190
0
  if (parsedPacket.isPacketOfType(pcpp::VRRPv2))
191
0
  {
192
0
    if (auto vrrpLayer = dynamic_cast<pcpp::VrrpV2Layer*>(layer))
193
0
    {
194
0
      vrrpLayer->getAuthTypeAsEnum();
195
0
      vrrpLayer->getAdvInt();
196
0
    }
197
0
  }
198
0
  if (parsedPacket.isPacketOfType(pcpp::VRRPv3))
199
0
  {
200
0
    if (auto vrrpLayer = dynamic_cast<pcpp::VrrpV3Layer*>(layer))
201
0
    {
202
0
      vrrpLayer->getMaxAdvInt();
203
0
    }
204
0
  }
205
0
  if (parsedPacket.isPacketOfType(pcpp::TCP))
206
0
  {
207
0
    if (auto tcpLayer = dynamic_cast<pcpp::TcpLayer*>(layer))
208
0
    {
209
0
      auto tcpLayer2(*tcpLayer);
210
0
      tcpLayer2.insertTcpOptionAfter(pcpp::TcpOptionBuilder(pcpp::TcpOptionBuilder::NopEolOptionEnumType::Nop),
211
0
                                     pcpp::TcpOptionEnumType::Nop);
212
0
    }
213
0
  }
214
0
  if (parsedPacket.isPacketOfType(pcpp::SDP))
215
0
  {
216
0
    if (auto sdpLayer = dynamic_cast<pcpp::SdpLayer*>(layer))
217
0
    {
218
0
      sdpLayer->getOwnerIPv4Address();
219
0
      sdpLayer->getMediaPort("audio");
220
0
      sdpLayer->getFieldCount();
221
222
0
      auto sdpLayer2 = *sdpLayer;
223
0
      std::vector<std::string> audioAttributes;
224
0
      audioAttributes.push_back("rtpmap:8 PCMA/8000");
225
0
      sdpLayer2.addMediaDescription("audio", 6010, "RTP/AVP", "8 96", audioAttributes);
226
0
      sdpLayer2.addField(PCPP_SDP_PROTOCOL_VERSION_FIELD, "0");
227
0
      sdpLayer2.removeField(PCPP_SDP_PROTOCOL_VERSION_FIELD);
228
0
    }
229
0
  }
230
0
  if (parsedPacket.isPacketOfType(pcpp::SSL))
231
0
  {
232
0
    if (auto handshakeLayer = dynamic_cast<pcpp::SSLHandshakeLayer*>(layer))
233
0
    {
234
0
      if (auto clientHelloMessage = handshakeLayer->getHandshakeMessageOfType<pcpp::SSLClientHelloMessage>())
235
0
      {
236
0
        clientHelloMessage->getCompressionMethodsValue();
237
0
        clientHelloMessage->getSessionID();
238
0
        clientHelloMessage->getHandshakeType();
239
0
        clientHelloMessage->getHandshakeVersion();
240
241
0
        pcpp::SSLCipherSuite::getCipherSuiteByName("TLS_RSA_WITH_NULL_MD5");
242
0
        for (int i = 0; i < clientHelloMessage->getCipherSuiteCount(); i++)
243
0
        {
244
0
          clientHelloMessage->getCipherSuite(i);
245
0
          bool valid;
246
0
          clientHelloMessage->getCipherSuiteID(i, valid);
247
0
        }
248
0
        if (auto ext = clientHelloMessage->getExtensionOfType<pcpp::SSLServerNameIndicationExtension>())
249
0
          ext->getHostName();
250
0
        if (auto ext = clientHelloMessage->getExtensionOfType<pcpp::SSLSupportedVersionsExtension>())
251
0
          ext->getSupportedVersions();
252
253
0
        clientHelloMessage->getExtensionOfType(pcpp::SSL_EXT_SERVER_NAME);
254
0
        clientHelloMessage->getExtensionOfType((uint16_t)0);
255
256
0
        auto fingerprint = clientHelloMessage->generateTLSFingerprint();
257
0
        fingerprint.toMD5();
258
0
      }
259
0
      if (auto serverHelloMessage = handshakeLayer->getHandshakeMessageOfType<pcpp::SSLServerHelloMessage>())
260
0
      {
261
0
        serverHelloMessage->getCompressionMethodsValue();
262
0
        serverHelloMessage->getSessionID();
263
0
        serverHelloMessage->getCipherSuite();
264
265
0
        serverHelloMessage->getExtensionOfType<pcpp::SSLServerNameIndicationExtension>();
266
0
        serverHelloMessage->getExtensionOfType(pcpp::SSL_EXT_SERVER_NAME);
267
0
        serverHelloMessage->getExtensionOfType((uint16_t)0);
268
269
0
        serverHelloMessage->getHandshakeVersion();
270
0
        auto fingerprint = serverHelloMessage->generateTLSFingerprint();
271
0
        fingerprint.toMD5();
272
0
      }
273
0
      if (auto handshakeMessage = handshakeLayer->getHandshakeMessageOfType<pcpp::SSLHandshakeMessage>())
274
0
      {
275
0
        handshakeMessage->isMessageComplete();
276
0
      }
277
0
    }
278
0
  }
279
0
  if (parsedPacket.isPacketOfType(pcpp::NTP))
280
0
  {
281
0
    if (auto ntpLayer = dynamic_cast<pcpp::NtpLayer*>(layer))
282
0
    {
283
0
      ntpLayer->getLeapIndicator();
284
0
      ntpLayer->getMode();
285
0
      ntpLayer->getModeString();
286
0
      ntpLayer->getStratum();
287
0
      ntpLayer->getPollInterval();
288
0
      ntpLayer->getPrecision();
289
0
      ntpLayer->getRootDelay();
290
0
      ntpLayer->getRootDispersion();
291
0
      ntpLayer->getReferenceIdentifier();
292
0
      ntpLayer->getReferenceIdentifierString();
293
0
      ntpLayer->getReferenceTimestamp();
294
0
      ntpLayer->getOriginTimestamp();
295
0
      ntpLayer->getReceiveTimestamp();
296
0
      ntpLayer->getTransmitTimestamp();
297
298
0
      ntpLayer->getDigest();
299
0
      ntpLayer->getKeyID();
300
301
0
      ntpLayer->getPollIntervalInSecs();
302
0
      ntpLayer->getPrecisionInSecs();
303
0
      ntpLayer->getRootDelayInSecs();
304
0
      ntpLayer->getRootDispersionInSecs();
305
0
      ntpLayer->getReferenceTimestampInSecs();
306
0
      ntpLayer->getOriginTimestampInSecs();
307
0
      ntpLayer->getReceiveTimestampInSecs();
308
0
      ntpLayer->getTransmitTimestampInSecs();
309
310
0
      ntpLayer->getReferenceTimestampAsString();
311
0
      ntpLayer->getOriginTimestampAsString();
312
0
      ntpLayer->getReceiveTimestampAsString();
313
0
      ntpLayer->getTransmitTimestampAsString();
314
315
0
      auto ntpLayer2(*ntpLayer);
316
0
      ntpLayer2.setRootDelayInSecs(0.1);
317
0
      ntpLayer2.setReferenceTimestampInSecs(0.1);
318
0
    }
319
0
  }
320
0
  if (parsedPacket.isPacketOfType(pcpp::ICMP))
321
0
  {
322
0
    if (auto icmpLayer = dynamic_cast<pcpp::IcmpLayer*>(layer))
323
0
    {
324
0
      auto icmpLayer2(*icmpLayer);
325
326
0
      if (icmpLayer->isMessageOfType(pcpp::ICMP_TIMESTAMP_REPLY))
327
0
      {
328
0
        icmpLayer->getTimestampReplyData();
329
0
        timeval orig = { 16131, 171000 };
330
0
        timeval recv = { 16133, 474000 };
331
0
        timeval tran = { 16133, 474000 };
332
0
        icmpLayer2.setTimestampReplyData(14640, 0, orig, recv, tran);
333
0
      }
334
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_ADDRESS_MASK_REQUEST))
335
0
      {
336
0
        icmpLayer->getAddressMaskRequestData();
337
0
        icmpLayer2.setAddressMaskRequestData(45068, 1536, pcpp::IPv4Address::Zero);
338
0
      }
339
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_ADDRESS_MASK_REPLY))
340
0
      {
341
0
        icmpLayer->getAddressMaskReplyData();
342
0
        icmpLayer2.setAddressMaskReplyData(45068, 1536, pcpp::IPv4Address::Zero);
343
0
      }
344
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_DEST_UNREACHABLE))
345
0
      {
346
0
        icmpLayer->getDestUnreachableData();
347
0
        icmpLayer2.setDestUnreachableData(pcpp::IcmpHostUnreachable, 0, nullptr, nullptr);
348
0
      }
349
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_INFO_REPLY))
350
0
      {
351
0
        auto layerData = icmpLayer->getInfoReplyData();
352
0
        icmpLayer2.setInfoReplyData(layerData->id, layerData->sequence);
353
0
      }
354
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_INFO_REQUEST))
355
0
      {
356
0
        auto layerData = icmpLayer->getInfoRequestData();
357
0
        icmpLayer2.setInfoRequestData(layerData->id, layerData->sequence);
358
0
      }
359
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_PARAM_PROBLEM))
360
0
      {
361
0
        auto layerData = icmpLayer->getParamProblemData();
362
0
        icmpLayer2.setParamProblemData(layerData->code, layerData->pointer, nullptr, nullptr);
363
0
      }
364
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_TIME_EXCEEDED))
365
0
      {
366
0
        icmpLayer->getTimeExceededData();
367
0
        icmpLayer2.setTimeExceededData(1, nullptr, nullptr);
368
0
      }
369
0
      else if (icmpLayer->isMessageOfType(pcpp::ICMP_ROUTER_ADV))
370
0
      {
371
0
        icmpLayer->getRouterAdvertisementData();
372
0
        pcpp::icmp_router_address_structure addr1;
373
0
        addr1.setRouterAddress(pcpp::IPv4Address("192.168.144.2"), (uint32_t)0x08000000);
374
0
        std::vector<pcpp::icmp_router_address_structure> routerAddresses;
375
0
        routerAddresses.push_back(addr1);
376
0
        icmpLayer2.setRouterAdvertisementData(16, 200, routerAddresses);
377
0
      }
378
0
    }
379
0
  }
380
0
  if (parsedPacket.isPacketOfType(pcpp::DHCPv6))
381
0
  {
382
0
    if (auto dhcpLayer = dynamic_cast<pcpp::DhcpV6Layer*>(layer))
383
0
    {
384
0
      dhcpLayer->getTransactionID();
385
0
      if (dhcpLayer->getOptionCount() > 0)
386
0
      {
387
0
        pcpp::DhcpV6Option opt = dhcpLayer->getFirstOptionData();
388
0
        opt.getType();
389
0
        opt.getTotalSize();
390
0
        opt.getValueAsHexString();
391
0
        for (size_t i = 0; i < dhcpLayer->getOptionCount(); i++)
392
0
        {
393
0
          opt = dhcpLayer->getNextOptionData(opt);
394
0
        }
395
0
        dhcpLayer->getOptionData(pcpp::DHCPV6_OPT_CLIENTID);
396
0
      }
397
0
    }
398
0
  }
399
0
  if (parsedPacket.isPacketOfType(pcpp::DHCP))
400
0
  {
401
0
    if (auto dhcpLayer = dynamic_cast<pcpp::DhcpLayer*>(layer))
402
0
    {
403
0
      dhcpLayer->getOpCode();
404
0
      dhcpLayer->getDhcpHeader();
405
0
      dhcpLayer->getClientIpAddress();
406
0
      dhcpLayer->getYourIpAddress();
407
0
      dhcpLayer->getServerIpAddress();
408
0
      dhcpLayer->getGatewayIpAddress();
409
0
      dhcpLayer->getClientHardwareAddress();
410
0
      if (dhcpLayer->getOptionsCount() > 0)
411
0
      {
412
0
        pcpp::DhcpOption opt = dhcpLayer->getFirstOptionData();
413
0
        opt.getValueAsIpAddr();
414
0
        opt.getValueAsString();
415
0
        for (size_t i = 0; i < dhcpLayer->getOptionsCount(); i++)
416
0
        {
417
0
          opt = dhcpLayer->getNextOptionData(opt);
418
0
        }
419
0
      }
420
0
      dhcpLayer->getOptionData(pcpp::DHCPOPT_SUBNET_MASK);
421
0
    }
422
0
  }
423
0
  if (parsedPacket.isPacketOfType(pcpp::BGP))
424
0
  {
425
0
    if (auto bgpLayer = dynamic_cast<pcpp::BgpLayer*>(layer))
426
0
    {
427
0
      bgpLayer->getMessageTypeAsString();
428
0
      if (auto bgpOpenMsgLayer = dynamic_cast<pcpp::BgpOpenMessageLayer*>(bgpLayer))
429
0
      {
430
0
        std::vector<pcpp::BgpOpenMessageLayer::optional_parameter> optionalParams;
431
0
        bgpOpenMsgLayer->getOptionalParameters(optionalParams);
432
0
        std::vector<pcpp::BgpOpenMessageLayer::optional_parameter> optionalParams2(optionalParams);
433
0
        optionalParams2.push_back(pcpp::BgpOpenMessageLayer::optional_parameter(2, "010400010001"));
434
0
        optionalParams2.push_back(pcpp::BgpOpenMessageLayer::optional_parameter(2, "8000"));
435
0
        optionalParams2.push_back(pcpp::BgpOpenMessageLayer::optional_parameter(2, "0200"));
436
0
        optionalParams2.push_back(pcpp::BgpOpenMessageLayer::optional_parameter(2, "4600"));
437
0
        optionalParams2.push_back(pcpp::BgpOpenMessageLayer::optional_parameter(2, "410400000001"));
438
0
        bgpOpenMsgLayer->setOptionalParameters(optionalParams2);
439
0
        bgpOpenMsgLayer->clearOptionalParameters();
440
0
        bgpOpenMsgLayer->setOptionalParameters(optionalParams);
441
0
      }
442
0
      else if (auto bgpUpdateMsgLayer = dynamic_cast<pcpp::BgpUpdateMessageLayer*>(bgpLayer))
443
0
      {
444
0
        std::vector<pcpp::BgpUpdateMessageLayer::prefix_and_ip> withdrawnRoutes;
445
0
        bgpUpdateMsgLayer->getWithdrawnRoutes(withdrawnRoutes);
446
0
        std::vector<pcpp::BgpUpdateMessageLayer::prefix_and_ip> withdrawnRoutes2(withdrawnRoutes);
447
0
        withdrawnRoutes2.push_back(pcpp::BgpUpdateMessageLayer::prefix_and_ip(24, "40.1.1.0"));
448
0
        withdrawnRoutes2.push_back(pcpp::BgpUpdateMessageLayer::prefix_and_ip(24, "40.40.40.0"));
449
0
        withdrawnRoutes2.push_back(pcpp::BgpUpdateMessageLayer::prefix_and_ip(16, "103.103.0.0"));
450
0
        withdrawnRoutes2.push_back(pcpp::BgpUpdateMessageLayer::prefix_and_ip(24, "103.103.40.0"));
451
0
        bgpUpdateMsgLayer->setWithdrawnRoutes(withdrawnRoutes2);
452
0
        bgpUpdateMsgLayer->clearWithdrawnRoutes();
453
0
        bgpUpdateMsgLayer->setWithdrawnRoutes(withdrawnRoutes);
454
455
0
        std::vector<pcpp::BgpUpdateMessageLayer::prefix_and_ip> nlriVec;
456
0
        bgpUpdateMsgLayer->getNetworkLayerReachabilityInfo(nlriVec);
457
0
        std::vector<pcpp::BgpUpdateMessageLayer::prefix_and_ip> nlriVec2(nlriVec);
458
0
        nlriVec2.push_back(pcpp::BgpUpdateMessageLayer::prefix_and_ip(24, "40.1.1.0"));
459
0
        bgpUpdateMsgLayer->setNetworkLayerReachabilityInfo(nlriVec2);
460
0
        bgpUpdateMsgLayer->clearNetworkLayerReachabilityInfo();
461
0
        bgpUpdateMsgLayer->setNetworkLayerReachabilityInfo(nlriVec);
462
463
0
        std::vector<pcpp::BgpUpdateMessageLayer::path_attribute> pathAttributes;
464
0
        bgpUpdateMsgLayer->getPathAttributes(pathAttributes);
465
0
        std::vector<pcpp::BgpUpdateMessageLayer::path_attribute> pathAttributes2(pathAttributes);
466
0
        pathAttributes2.push_back(pcpp::BgpUpdateMessageLayer::path_attribute(0x40, 1, "02"));
467
0
        pathAttributes2.push_back(
468
0
            pcpp::BgpUpdateMessageLayer::path_attribute(0x40, 2, "02030000000a0000001400000028"));
469
0
        pathAttributes2.push_back(pcpp::BgpUpdateMessageLayer::path_attribute(0x40, 3, "1e031e03"));
470
0
        bgpUpdateMsgLayer->setPathAttributes(pathAttributes2);
471
0
        bgpUpdateMsgLayer->clearPathAttributes();
472
0
        bgpUpdateMsgLayer->setPathAttributes(pathAttributes);
473
0
      }
474
0
      else if (auto bgpNotificationMsgLayer = dynamic_cast<pcpp::BgpNotificationMessageLayer*>(bgpLayer))
475
0
      {
476
0
        bgpNotificationMsgLayer->getNotificationDataAsHexString();
477
0
      }
478
0
    }
479
0
  }
480
0
  if (parsedPacket.isPacketOfType(pcpp::DNS))
481
0
  {
482
0
    if (auto dnsLayer = dynamic_cast<pcpp::DnsLayer*>(layer))
483
0
    {
484
0
      dnsLayer->addQuery("mail-attachment.googleusercontent.com", pcpp::DNS_TYPE_A, pcpp::DNS_CLASS_IN);
485
0
      dnsLayer->removeQuery("a", true);
486
0
      dnsLayer->removeQuery("mail-attachment.googleusercontent.com", false);
487
0
      pcpp::IPv4DnsResourceData ipv4DnsData(std::string("151.249.90.217"));
488
0
      dnsLayer->addAnswer("assets.pinterest.com.cdngc.net", pcpp::DNS_TYPE_A, pcpp::DNS_CLASS_IN, 3,
489
0
                          &ipv4DnsData);
490
0
      dnsLayer->removeAnswer("a", true);
491
0
      dnsLayer->removeAnswer("assets.pinterest.com.cdngc.net", false);
492
0
      dnsLayer->addAuthority("Yaels-iPhone.local", pcpp::DNS_TYPE_A, pcpp::DNS_CLASS_IN, 120, &ipv4DnsData);
493
0
      dnsLayer->removeAuthority("a", true);
494
0
      dnsLayer->removeAuthority("Yaels-iPhone.local", false);
495
0
      pcpp::GenericDnsResourceData genericData("0004000800df581faa4f3f9d");
496
0
      dnsLayer->addAdditionalRecord("abc", pcpp::DNS_TYPE_OPT, 0xa005, 0x1194, &genericData);
497
0
      dnsLayer->removeAdditionalRecord("a", true);
498
0
      dnsLayer->removeAdditionalRecord("abc", false);
499
500
0
      auto add = dnsLayer->getFirstAdditionalRecord();
501
0
      while (add != nullptr)
502
0
      {
503
0
        add = dnsLayer->getNextAdditionalRecord(add);
504
0
      }
505
506
0
      auto answer = dnsLayer->getFirstAnswer();
507
0
      while (answer != nullptr)
508
0
      {
509
0
        answer = dnsLayer->getNextAnswer(answer);
510
0
      }
511
512
0
      auto auth = dnsLayer->getFirstAuthority();
513
0
      while (auth != nullptr)
514
0
      {
515
0
        auth = dnsLayer->getNextAuthority(auth);
516
0
      }
517
518
0
      pcpp::DnsLayer other(*dnsLayer);
519
0
      other = *dnsLayer;
520
0
    }
521
0
  }
522
0
}
Unexecuted instantiation: FuzzTarget.cpp:readParsedPacket(pcpp::Packet, pcpp::Layer*)
Unexecuted instantiation: FuzzTarget.cpp:readParsedPacket(pcpp::Packet, pcpp::Layer*)