Fix max hop limit for GBC packets#15
Open
Hugo-Domingos wants to merge 1 commit intoFundacio-i2CAT:masterfrom
Open
Fix max hop limit for GBC packets#15Hugo-Domingos wants to merge 1 commit intoFundacio-i2CAT:masterfrom
Hugo-Domingos wants to merge 1 commit intoFundacio-i2CAT:masterfrom
Conversation
There was a problem hiding this comment.
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_limittoGNDataRequest(default10) to allow configuring MHL per request. - Set Common Header
mhlfromrequest.max_hop_limitfor non-SHB packets. - Validate received packets using
basic_header.rhl > common_header.mhlinstead of comparing to MIB default. - Attempt to propagate
max_hop_limitfrom 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_limitwas added toGNDataRequest, but it is not included into_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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
1for 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_limitparameter 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 hardcodedmhl = 1withmhl = request.max_hop_limitfor non-SHB packets.geonet/service_access_point.py: Addedmax_hop_limitfield toGNDataRequest(default: 10).btp/service_access_point.py: Addedmax_hop_limitfield toBTPDataRequest(default: 10), allowing upper layers to configure the hop limit.btp/router.py: Passesmax_hop_limitfrom the BTP request down to the GN request.geonet/router.py: Fixed the RHL validation check on reception to comparebasic_header.rhl > common_header.mhlinstead ofbasic_header.rhl > mib.itsGnDefaultHopLimit, as specified in the standard.Before (MHL = 1)
After (MHL = 10)
Test Plan