Skip to content

Fix wrong length in the LR node IDs#47

Merged
lmolina merged 5 commits intoSiliconLabs:mainfrom
lmolina:bugfix/lamolina/ZGW-3457-cannot-send-user-set-wrong-length/main
Apr 16, 2026
Merged

Fix wrong length in the LR node IDs#47
lmolina merged 5 commits intoSiliconLabs:mainfrom
lmolina:bugfix/lamolina/ZGW-3457-cannot-send-user-set-wrong-length/main

Conversation

@lmolina
Copy link
Copy Markdown
Collaborator

@lmolina lmolina commented Mar 20, 2026

Note

Medium Risk
Changes core transport send/callback behavior and widens ZW_SendData_Bridge node ID types to 16-bit, which could impact TX queue advancement and bridge transmissions if assumptions elsewhere still use 8-bit IDs.

Overview
Fixes Long Range node ID truncation by updating the ZIPGW Transport Service ZW_SendData_Bridge prototype to take 16-bit source/destination node IDs and adds a regression test to ensure LR destination IDs (e.g., 257) are preserved through the TS send path.

Adjusts ZW_SendDataAppl low-level callback handling so TRANSMIT_COMPLETE_FAIL pops/frees the current session and posts SEND_EVENT_SEND_NEXT_LL when no resend is pending, preventing the queue from stalling; adds UNIT_TEST seam helpers plus a dedicated unit test for this failure/resend behavior.

Extends the test build to support on-demand CMock-based mock regeneration (downloads/verifies CMock, runs Ruby generator) and adds ruby to the build dependencies, including a small Unity compatibility shim for legacy CMock detail macros.

Reviewed by Cursor Bugbot for commit 59cdbf9. Bugbot is set up for automated code reviews on this repo. Configure here.

@lmolina lmolina force-pushed the bugfix/lamolina/ZGW-3457-cannot-send-user-set-wrong-length/main branch 3 times, most recently from 4ec7e55 to 7452f01 Compare March 25, 2026 11:42
@michael-correia
Copy link
Copy Markdown

Does ZW_Abort_SendRequest have this same problem?

lmolina added a commit that referenced this pull request Apr 1, 2026
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 1, 2026
With Z-Wave LR, the node ID change the representation from 8-bit to
16-bit. Different bugs have appear because of the incorrect or
representation. Therefore, we are adding debug logs on the transport
service bridge to debug and follow the correct representation of node
IDs.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 1, 2026
Ensure test builds have access CMock generator by downloading it into
the build folder.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 1, 2026
Transport Service ZIPGW bridge path was narrowing the node IDs from
16-bit to 8-bits.

Add a standalong test that uses the flags used to build the Z/IP Gateway
and avoid the specific NEW_TEST_T2, as the test would result in
different `ZW_SendData_Bridge` object.

Use CMock to simplify mocking and to easy eventual new tests.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 1, 2026
Transport service (TS) fails to deliver a fragmented frame it called
send_data_callback_func(TRANSMIT_COMPLETE_FAIL), in this case the TS
does not pop the falied session. Therefore, subsequent sends appended a
fresh frame to the tail while the element in the top stales and stays in
the head, causing all following commands to be re-driven through TS.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
@lmolina lmolina force-pushed the bugfix/lamolina/ZGW-3457-cannot-send-user-set-wrong-length/main branch from 7452f01 to 3940989 Compare April 1, 2026 21:08
@lmolina
Copy link
Copy Markdown
Collaborator Author

lmolina commented Apr 1, 2026

Does ZW_Abort_SendRequest have this same problem?

Yes, thanks for highlighting the issue.

I'll prepare a dedicated PR to address this and node ID conversion issues.

lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 3, 2026
Before the fix, TRANSMIT_COMPLETE_FAIL with resend_counter==0 left
the session in send_data_list, causing every subsequent
SEND_EVENT_SEND_NEXT_LL to re-drive the same stuck session through
Transport Service.

The implementation adds UNIT_TEST-guarded seam functions to
ZW_SendDataAppl.c that expose private/static states. The test uses wraps
to replace process_post and zw_frame_buffer_free. Choose this solution
over CMock for sake of simplicity.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 3, 2026
Transport Service ZIPGW bridge path was narrowing the node IDs from
16-bit to 8-bits.

Add a standalong test that uses the flags used to build the Z/IP Gateway
and avoid the specific NEW_TEST_T2, as the test would result in
different `ZW_SendData_Bridge` object.

Use CMock to simplify mocking and to easy eventual new tests.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 3, 2026
Transport service (TS) fails to deliver a fragmented frame it called
send_data_callback_func(TRANSMIT_COMPLETE_FAIL), in this case the TS
does not pop the falied session. Therefore, subsequent sends appended a
fresh frame to the tail while the element in the top stales and stays in
the head, causing all following commands to be re-driven through TS.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 3, 2026
Before the fix, TRANSMIT_COMPLETE_FAIL with resend_counter==0 left
the session in send_data_list, causing every subsequent
SEND_EVENT_SEND_NEXT_LL to re-drive the same stuck session through
Transport Service.

The implementation adds UNIT_TEST-guarded seam functions to
ZW_SendDataAppl.c that expose private/static states. The test uses wraps
to replace process_post and zw_frame_buffer_free. Choose this solution
over CMock for sake of simplicity.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
@lmolina lmolina force-pushed the bugfix/lamolina/ZGW-3457-cannot-send-user-set-wrong-length/main branch from 3d71e6a to 4418620 Compare April 3, 2026 12:54
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 3, 2026
Transport Service ZIPGW bridge path was narrowing the node IDs from
16-bit to 8-bits.

Add a standalong test that uses the flags used to build the Z/IP Gateway
and avoid the specific NEW_TEST_T2, as the test would result in
different `ZW_SendData_Bridge` object.

Use CMock to simplify mocking and to easy eventual new tests.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 3, 2026
Transport service (TS) fails to deliver a fragmented frame it called
send_data_callback_func(TRANSMIT_COMPLETE_FAIL), in this case the TS
does not pop the falied session. Therefore, subsequent sends appended a
fresh frame to the tail while the element in the top stales and stays in
the head, causing all following commands to be re-driven through TS.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit to lmolina/zipgateway that referenced this pull request Apr 3, 2026
Before the fix, TRANSMIT_COMPLETE_FAIL with resend_counter==0 left
the session in send_data_list, causing every subsequent
SEND_EVENT_SEND_NEXT_LL to re-drive the same stuck session through
Transport Service.

The implementation adds UNIT_TEST-guarded seam functions to
ZW_SendDataAppl.c that expose private/static states. The test uses wraps
to replace process_post and zw_frame_buffer_free. Choose this solution
over CMock for sake of simplicity.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
@lmolina lmolina force-pushed the bugfix/lamolina/ZGW-3457-cannot-send-user-set-wrong-length/main branch from 4418620 to 59cdbf9 Compare April 3, 2026 13:43
@lmolina
Copy link
Copy Markdown
Collaborator Author

lmolina commented Apr 13, 2026

@BugBot run

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 13, 2026

Bugbot couldn't run

Bugbot is not enabled for your user on this team.

Ask your team administrator to increase your team's hard limit for Bugbot seats or add you to the allowlist in the Cursor dashboard.

@lmolina
Copy link
Copy Markdown
Collaborator Author

lmolina commented Apr 15, 2026

@BugBot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 59cdbf9. Configure here.

Comment thread src/transport/ZW_SendDataAppl.c
lmolina added 5 commits April 16, 2026 12:57
With Z-Wave LR, the node ID change the representation from 8-bit to
16-bit. Different bugs have appear because of the incorrect or
representation. Therefore, we are adding debug logs on the transport
service bridge to debug and follow the correct representation of node
IDs.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
Ensure test builds have access CMock generator by downloading it into
the build folder.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
Transport Service ZIPGW bridge path was narrowing the node IDs from
16-bit to 8-bits.

Add a standalong test that uses the flags used to build the Z/IP Gateway
and avoid the specific NEW_TEST_T2, as the test would result in
different `ZW_SendData_Bridge` object.

Use CMock to simplify mocking and to easy eventual new tests.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
Transport service (TS) fails to deliver a fragmented frame it called
send_data_callback_func(TRANSMIT_COMPLETE_FAIL), in this case the TS
does not pop the falied session. Therefore, subsequent sends appended a
fresh frame to the tail while the element in the top stales and stays in
the head, causing all following commands to be re-driven through TS.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
Before the fix, TRANSMIT_COMPLETE_FAIL with resend_counter==0 left
the session in send_data_list, causing every subsequent
SEND_EVENT_SEND_NEXT_LL to re-drive the same stuck session through
Transport Service.

The implementation adds UNIT_TEST-guarded seam functions to
ZW_SendDataAppl.c that expose private/static states. The test uses wraps
to replace process_post and zw_frame_buffer_free. Choose this solution
over CMock for sake of simplicity.

Relates-to: ZGW-3457
Origin: SiliconLabs#47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
@lmolina lmolina force-pushed the bugfix/lamolina/ZGW-3457-cannot-send-user-set-wrong-length/main branch from 59cdbf9 to 3df7e92 Compare April 16, 2026 10:58
@lmolina lmolina merged commit 9a77dd7 into SiliconLabs:main Apr 16, 2026
1 check passed
lmolina added a commit that referenced this pull request Apr 16, 2026
With Z-Wave LR, the node ID change the representation from 8-bit to
16-bit. Different bugs have appear because of the incorrect or
representation. Therefore, we are adding debug logs on the transport
service bridge to debug and follow the correct representation of node
IDs.

Relates-to: ZGW-3457
Origin: #47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit that referenced this pull request Apr 16, 2026
Ensure test builds have access CMock generator by downloading it into
the build folder.

Relates-to: ZGW-3457
Origin: #47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit that referenced this pull request Apr 16, 2026
Transport Service ZIPGW bridge path was narrowing the node IDs from
16-bit to 8-bits.

Add a standalong test that uses the flags used to build the Z/IP Gateway
and avoid the specific NEW_TEST_T2, as the test would result in
different `ZW_SendData_Bridge` object.

Use CMock to simplify mocking and to easy eventual new tests.

Relates-to: ZGW-3457
Origin: #47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
lmolina added a commit that referenced this pull request Apr 16, 2026
Transport service (TS) fails to deliver a fragmented frame it called
send_data_callback_func(TRANSMIT_COMPLETE_FAIL), in this case the TS
does not pop the falied session. Therefore, subsequent sends appended a
fresh frame to the tail while the element in the top stales and stays in
the head, causing all following commands to be re-driven through TS.

Relates-to: ZGW-3457
Origin: #47
Signed-off-by: Laudin Molina Troconis <laudin.molinatroconis@silabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants