diff --git a/include/zenoh-pico/system/link/raweth.h b/include/zenoh-pico/system/link/raweth.h index e73a647c3..d2009144e 100644 --- a/include/zenoh-pico/system/link/raweth.h +++ b/include/zenoh-pico/system/link/raweth.h @@ -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 @@ -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; diff --git a/src/transport/raweth/tx.c b/src/transport/raweth/tx.c index 2c6866f36..772c71d8c 100644 --- a/src/transport/raweth/tx.c +++ b/src/transport/raweth/tx.c @@ -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)));