Skip to content

Commit

Permalink
fix: add missing vlan ether type field
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Nov 30, 2023
1 parent 9283187 commit 07f8992
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions include/zenoh-pico/system/link/raweth.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

#if Z_FEATURE_RAWETH_TRANSPORT == 1

// Ethernet types
#define _ZP_ETH_TYPE_VLAN 0x8100
// Ethernet types (big endian)
#define _ZP_ETH_TYPE_VLAN 0x0081

// Address Sizes
#define _ZP_MAC_ADDR_LENGTH 6
Expand All @@ -41,6 +41,7 @@ typedef struct {
typedef struct {
uint8_t dmac[_ZP_MAC_ADDR_LENGTH]; // Destination mac address
uint8_t smac[_ZP_MAC_ADDR_LENGTH]; // Source mac address
uint16_t vlan_type; // Vlan ethtype
uint16_t tag; // Vlan tag
uint16_t ethtype; // Ethertype of frame
} _zp_eth_vlan_header_t;
Expand Down
3 changes: 2 additions & 1 deletion src/transport/raweth/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ static int8_t __unsafe_z_raweth_write_header(_z_link_t *zl, _z_wbuf_t *wbf) {
memset(&header, 0, sizeof(header));
memcpy(&header.dmac, &resocket->_dmac, _ZP_MAC_ADDR_LENGTH);
memcpy(&header.smac, &resocket->_smac, _ZP_MAC_ADDR_LENGTH);
header.tag = _ZP_ETH_TYPE_VLAN;
header.vlan_type = _ZP_ETH_TYPE_VLAN;
header.tag = resocket->_vlan;
header.ethtype = _ZP_RAWETH_CFG_ETHTYPE;
// Write header
_Z_RETURN_IF_ERR(_z_wbuf_write_bytes(wbf, (uint8_t *)&header, 0, sizeof(header)));
Expand Down

0 comments on commit 07f8992

Please sign in to comment.