Ethernet operations

1. Has Ethernet frame

Description

Checks if a packet has or not an Ethernet frame.

Format

 hasether(arg_1) → result

  • arg_1 : Packet
  • result : Boolean

Examples

  Example 1

 pkt → packet field name

hasether(pkt), where pkt is a packet with an Ethernet frame

  • arg_1 : pkt
  • result : true
  Example 2

 pkt → packet field name

 hasether(pkt), where pkt is a packet without an Ethernet frame

  • arg_1 : pkt
  • result : false

2. Ethernet destination MAC address

Description

Returns the destination MAC address of an Ethernet frame.

Format

etherdst(arg_1) → result

  • arg_1 : Packet
  • result : MAC

Examples

  Example 1

pkt → packet field name

etherdst(pkt)

  • arg_1 : pkt
  • result : ff:ff:ff:ff:ff:ff
  Example 2

pkt → packet field name

 etherdst(pkt)

  • arg_1 : pkt
  • result : 01:00:5e:00:00:01

3. Ethernet payload

Description

Returns the payload of an Ethernet frame.

Format

etherpayload(arg_1) → result

  • arg_1 : Packet
  • result : Byte array

Examples

  Example 1

pkt → packet field name

etherpayload(pkt)

  • arg_1 : pkt
  • result : 4500002C201100004011B0E 1C0A8107FC0A817FFFD6721 A40018A447424A4E5002010 00000000000000000000000
  Example 2

 pkt → packet field name

etherpayload(pkt)

  • arg_1 : pkt
  • result : 450000CAE995400028066E0 83433F531C0A8108301BBDA E2F9AB5E5DA4C7A22F80180 254D04700000101080A1739 0FF133F094EC17030300913 BF037E2C63CA8DEE5D14C92 D52CF3C7ED7A0D1A329642C 206026547EB6A811CEFE99D E8BCB8F5E7BAFF96045EDD3 4F0DFCB0B5141FCE3DFDA94 D8C48065E6B9293E0A357F6 4C601A687EED271BDE21791 FB00151B4B53F4E9A90F779 5047CD05E4AB6D9076F9F16 2BED039266EF2F6D52ED222 50BFAA1E188E18397ADA733 1A048DF08702992ADB5EA78 B98A561B7AC6A

4. Ethernet source MAC address 

Description

Returns the source MAC address of an Ethernet frame.

Format

 ethersrc(arg_1) → result

  • arg_1 : Packet
  • result : MAC

Examples

  Example 1

 pkt → packet field name

ethersrc(pkt)

  •  arg_1 : pkt
  • result : c8:bc:c8:a6:4c:b7
  Example 2

 pkt → packet field name

 ethersrc(pkt)

  • arg_1 : pkt
  • result : ac:7f:3e:e6:39:78

5. Ethernet status 

Description

Returns the status of an Ethernet packet.

  Check here the packet status codes
  • OK → The packet has been parsed without problems
  • UNPARSED → Unparded packet.
  • UNDERFLOW → The packet is smaller than its outer payload.
  • OVERFLOW → The packet is bigger than the payload.
  • CRC_UNAVAILABLE → CRC cannot be declared due to the lack of data.
  • BAD_CRC → CRC does not match.
  • HEADER_BAD → Header has inconsistent values.
  • TOO_SHORT → There is not enough data to fill the header.

Format

etherstatus(arg_1) → result

  • arg_1 : Packet
  • result : String

Examples

  Example 1

pkt → packet field name

etherstatus(pkt)

  • arg_1 : pkt
  • result : OK
  Example 2

 pkt → packet field name

 etherstatus(pkt)

  • arg_1 : pkt
  • result : HEADER_BAD

6. Ethernet tag

Returns the tag of an Ethernet Frame.

7. Ethertype

Description

Returns the EtherType of the Ethernet frame of a packet.

  Check here the most common EtherType values
  • IPv4 → 0x0800
  • ARP → 0x0806
  • VLAN tagged frme (IEEE 802.1Q) → 0x8100
  • IPv6 → 0x86DD

Format

ethertype(arg_1) → result

  • arg_1 : Packet
  • result : Integer

Examples

  Example 1

 pkt → packet field name

ethertype(pkt)

  • arg_1 : pkt
  • result : 2048 (0x800)
  Example 2

 pkt → packet field name

ethertype(pkt)

  • arg_1 : pkt
  • result : 2054 (0x806)
The result of this operation is a decimal number (base 10).

Have we answered your question?

If not, please contact our technical support team via email by clicking the button below.

CONTACT US