EthernetLayer ethernetLayer = new EthernetLayer
{
Source = SourceMac,
Destination = DestinationMac,
};
// IPv4 Layer
IpV4Layer ipV4Layer = new IpV4Layer
{
Source = SourceIpv4Add,
CurrentDestination = DestinationIpv4Add,
Ttl = 128,
Fragmentation = new IpV4Fragmentation(IpV4FragmentationOptions.DoNotFragment, 0),
Identification = 12,
};
// TCP Layer
TcpLayer tcpLayer = new TcpLayer
{
SourcePort = _sourcePort,
DestinationPort = _destinationPort,
SequenceNumber = _seqNumber,
ControlBits = TcpControlBits.Synchronize,
Window = _windowSize,
};
PayloadLayer payloadlayer = new PayloadLayer
{
Data = new Datagram(Encoding.ASCII.GetBytes("Hello Donnie"))
};
Packet syn = PacketBuilder.Build(DateTime.Now, ethernetLayer, ipV4Layer, tcpLayer, payloadlayer);
communicator.SendPacket(syn);
This packet has a total length of 58 bytes but I need to add 2 bytes of padding to the Ethernet layer so that the packet length is 60 bytes. How would I accomplish this in Pcap.net