mosers
/
eaas-vde-proxy
Archiviert
1
0
Fork 0
1 Customize
MrMcX hat diese Seite bearbeitet vor 3 Jahren

How to customize the code

Modify packet data for other protocols:

The protocols are handled in pipeForward. Inside its for loop, layers are handled from low to high. If a layer is not defined here, its contents will be forwarded without any modification. Currently it is expected that every single packet has an Ethernet layer. After the handling of the Ethernet frame in the block commented with "Handle Ethernet frame", higher protocols are implemented. If a protocol builds on another protocol, it is nested inside its if clause.

Implemented protocols besides Ethernet are:

  • IPv4
    • DHCP
    • ICMP
    • TCP
    • UDP
      • NBNS/NBDS: only binary filtering
  • IPv6: is currently dropped
  • ARP

Extend use of binary filtering

Unsupported protocols can be modified using filtering for binary values. This is done using the filterPayload method. To use this in an additional protocol, filterPayload should be called from pipeForward where the respective protocol would be handled as shown below for the NBNS/NBDS protocols:

if (udpPacket.SrcPort == 137 && udpPacket.DstPort == 137) || (udpPacket.SrcPort == 138 && udpPacket.DstPort == 138) {
    filterPayload(prefix, &udpPacket.Payload)
}

If additional values should be filtered, they need to be added as byte slices to vmVals and netVals in the filterPayload method, where vmVals contains the values which should be sent to the VM and netVals those which should be sent to the network.