Skip to content

Fix max hop limit for GBC packets#15

Open
Hugo-Domingos wants to merge 1 commit intoFundacio-i2CAT:masterfrom
Hugo-Domingos:fix/geonet-max-hop-limit
Open

Fix max hop limit for GBC packets#15
Hugo-Domingos wants to merge 1 commit intoFundacio-i2CAT:masterfrom
Hugo-Domingos:fix/geonet-max-hop-limit

Conversation

@Hugo-Domingos
Copy link

Fix: MHL hardcoded to 1 for GBC packets (DENM, GeoBroadcast) and comparison of the wrong field on the reception side.

Summary

The Maximum Hop Limit (MHL) field in the GeoNetworking Common Header was hardcoded to 1 for all non-Single Hop Broadcast packets, including GeoBroadcast (GBC) packets such as DENMs.

According to ETSI EN 302 636-4-1 V1.4.1 (2020-01), Section 10.3.4 Table 20, the MHL should be set from the max_hop_limit parameter in the GN-DATA.request primitive.

On the receiver side there was also a verification to check if the RHL is greater than MHL, which was being done on the 'itsGnDefaultHopLimit' instead of on the actual packet data.

Changes

  • geonet/common_header.py: Replaced hardcoded mhl = 1 with mhl = request.max_hop_limit for non-SHB packets.
  • geonet/service_access_point.py: Added max_hop_limit field to GNDataRequest (default: 10).
  • btp/service_access_point.py: Added max_hop_limit field to BTPDataRequest (default: 10), allowing upper layers to configure the hop limit.
  • btp/router.py: Passes max_hop_limit from the BTP request down to the GN request.
  • geonet/router.py: Fixed the RHL validation check on reception to compare basic_header.rhl > common_header.mhl instead of basic_header.rhl > mib.itsGnDefaultHopLimit, as specified in the standard.

Before (MHL = 1)

image

After (MHL = 10)

image

Test Plan

  • Verified on remote device that DENM packets are now sent with MHL = 10 and RHL = 10
  • Confirmed via packet capture (Wireshark) that the Common Header MHL field is correctly set

Copilot AI review requested due to automatic review settings March 11, 2026 20:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes GeoNetworking Maximum Hop Limit (MHL) handling for GeoBroadcast (GBC) packets by sourcing MHL from the request (instead of hardcoding 1) and corrects the receive-side hop limit validation to compare against the packet’s own MHL.

Changes:

  • Add max_hop_limit to GNDataRequest (default 10) to allow configuring MHL per request.
  • Set Common Header mhl from request.max_hop_limit for non-SHB packets.
  • Validate received packets using basic_header.rhl > common_header.mhl instead of comparing to MIB default.
  • Attempt to propagate max_hop_limit from BTP into GeoNetworking requests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/flexstack/geonet/service_access_point.py Adds max_hop_limit to GNDataRequest.
src/flexstack/geonet/common_header.py Uses request.max_hop_limit to initialize CommonHeader.mhl for non-SHB.
src/flexstack/geonet/router.py Fixes receive-side RHL/MHL validation to use packet MHL.
src/flexstack/btp/router.py Passes max_hop_limit from BTP request into GN request.
Comments suppressed due to low confidence (1)

src/flexstack/geonet/service_access_point.py:430

  • max_hop_limit was added to GNDataRequest, but it is not included in to_dict() / from_dict(). Any request serialized/deserialized (e.g., via JSON) will silently drop the configured hop limit and revert to the default. Add this field to the dict representation and parse it back (with a default for backward compatibility).
    max_hop_limit: int = 10

    def to_dict(self) -> dict:
        """
        Returns a dictionary representation of the GN Data Request.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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