diff --git a/src/transport/raweth/config.c b/src/transport/raweth/config.c index 9497a3d9a..486853b1d 100644 --- a/src/transport/raweth/config.c +++ b/src/transport/raweth/config.c @@ -27,9 +27,10 @@ const uint8_t _ZP_RAWETH_CFG_SMAC[_ZP_MAC_ADDR_LENGTH] = {0x30, 0x03, 0xc8, 0x37 // Should be generated const _zp_raweth_cfg_entry _ZP_RAWETH_CFG_ARRAY[] = { - {{0, {0}, ""}, 0x0000, {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, false}, // Default mac addr - {{0, {0}, "some/key/expr"}, 0x8c00, {0x00, 0x11, 0x22, 0x33, 0x44, 0x55}, true}, // entry1 - {{0, {0}, "another/keyexpr"}, 0x4300, {0x01, 0x23, 0x45, 0x67, 0x89, 0xab}, true}, // entry2 + {{0, {0}, ""}, 0x0000, {0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}, false}, // Default mac addr + {{0, {0}, "some/key/expr"}, 0x8c00, {0x00, 0x11, 0x22, 0x33, 0x44, 0x55}, true}, // entry1 + {{0, {0}, "demo/example/zenoh-pico-pub"}, 0xab00, {0x41, 0x55, 0xa8, 0x00, 0x9d, 0xc0}, true}, // entry2 + {{0, {0}, "another/keyexpr"}, 0x4300, {0x01, 0x23, 0x45, 0x67, 0x89, 0xab}, true}, // entry3 }; // Should be generated diff --git a/src/transport/raweth/tx.c b/src/transport/raweth/tx.c index 772c71d8c..3c32f20e9 100644 --- a/src/transport/raweth/tx.c +++ b/src/transport/raweth/tx.c @@ -50,7 +50,8 @@ int8_t _zp_raweth_set_socket(const _z_keyexpr_t *keyexpr, _z_raweth_socket_t *so ret = _Z_ERR_GENERIC; // Key not found case for (int i = 1; i < _ZP_RAWETH_CFG_SIZE; i++) { // Find matching keyexpr - if (!zp_keyexpr_intersect_null_terminated(keyexpr->_suffix, _ZP_RAWETH_CFG_ARRAY[i]._keyexpr._suffix)) { + if (zp_keyexpr_intersect_null_terminated(keyexpr->_suffix, _ZP_RAWETH_CFG_ARRAY[i]._keyexpr._suffix) != + _Z_RES_OK) { continue; } // Store data into socket @@ -61,6 +62,7 @@ int8_t _zp_raweth_set_socket(const _z_keyexpr_t *keyexpr, _z_raweth_socket_t *so memcpy(&sock->_vlan, &vlan, sizeof(vlan)); } ret = _Z_RES_OK; + break; } } return ret; @@ -149,7 +151,7 @@ int8_t _z_raweth_link_send_t_msg(const _z_link_t *zl, const _z_transport_message // Discard const qualifier _z_link_t *mzl = (_z_link_t *)zl; // Set socket info - _zp_raweth_set_socket(NULL, &mzl->_socket._raweth); + _Z_RETURN_IF_ERR(_zp_raweth_set_socket(NULL, &mzl->_socket._raweth)); // Write the message header _Z_RETURN_IF_ERR(__unsafe_z_raweth_write_header(mzl, &wbf)); // Encode the session message @@ -178,7 +180,7 @@ int8_t _z_raweth_send_t_msg(_z_transport_multicast_t *ztm, const _z_transport_me _z_mutex_lock(&ztm->_mutex_tx); #endif // Set socket info - _zp_raweth_set_socket(NULL, &ztm->_link._socket._raweth); + _Z_RETURN_IF_ERR(_zp_raweth_set_socket(NULL, &ztm->_link._socket._raweth)); // Write the message header _Z_RETURN_IF_ERR(__unsafe_z_raweth_write_header(&ztm->_link, &ztm->_wbuf)); // Encode the session message @@ -233,7 +235,7 @@ int8_t _z_raweth_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg, break; } // Set socket info - _zp_raweth_set_socket(keyexpr, &ztm->_link._socket._raweth); + _Z_RETURN_IF_ERR(_zp_raweth_set_socket(keyexpr, &ztm->_link._socket._raweth)); // Write the eth header _Z_RETURN_IF_ERR(__unsafe_z_raweth_write_header(&ztm->_link, &ztm->_wbuf)); // Set the frame header