OpenCyphal / OpenCyphal/pycyphal

UDP endpoint mapping uses incorrect masking values.

Open
#304 0 comments 1 reaction 1 assignee View on GitHub

@maksimdrachov is already working on this.

Since Jun 29, 2023.

class-defect domain-transport-udp severity-minor
Dominant language
Python
Stars
142
Forks
110
PR merge metrics
No merged PRs in 30d

Description

---
 pycyphal/transport/udp/_ip/_endpoint_mapping.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pycyphal/transport/udp/_ip/_endpoint_mapping.py b/pycyphal/transport/udp/_ip/_endpoint_mapping.py
index 6b4168d..f3cf6cc 100644
--- a/pycyphal/transport/udp/_ip/_endpoint_mapping.py
+++ b/pycyphal/transport/udp/_ip/_endpoint_mapping.py
@@ -22,9 +22,9 @@ FIXED_MASK_PREFIX = 0b_11111111_11111111_00000000_00000000
 Masks the 16 most significant bits of the multicast group address. To check whether the address is Cyphal/UDP.
 """
 
-SUBJECT_ID_MASK = 2**15 - 1
+SUBJECT_ID_MASK = 0b_00000000_00000000_00011111_11111111
 """
-Masks the 14 least significant bits of the multicast group address (v4/v6) that represent the subject-ID. (Message)
+Masks the 13 least significant bits of the multicast group address (v4/v6) that represent the subject-ID. (Message)
 """
 
 DESTINATION_NODE_ID_MASK = 0xFFFF
@@ -38,7 +38,7 @@ SNM_BIT_MASK = 0b_00000000_00000001_00000000_00000000
 Service, Not Message: Masks the bit that determines whether the address represents a Message (=0) or Service (=1)
 """
 
-CYPHAL_UDP_IPV4_ADDRESS_VERSION = 0b_00000000_00100000_00000000_00000000
+CYPHAL_UDP_IPV4_ADDRESS_VERSION = 0b_00000000_01000000_00000000_00000000
 """
 Cyphal/UDP uses this bit to isolate IP header version 0 traffic
 (note that the IP header version is not, necessarily, the same as the Cyphal Header version)
-- 
2.37.5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.