Skip to content

Update to GeoNet with current standards (Version 1)#1392

Open
danieluliedguevara wants to merge 2 commits intothe-tcpdump-group:masterfrom
danieluliedguevara:master
Open

Update to GeoNet with current standards (Version 1)#1392
danieluliedguevara wants to merge 2 commits intothe-tcpdump-group:masterfrom
danieluliedguevara:master

Conversation

@danieluliedguevara
Copy link

This PR updates ETSI GeoNetworking protocol to version 1 (ETSI EN 302 636-4-1 V1.4.1 (2020-01)).

The update includes dissectors for GeoNet Beacon messages and TopoScopeBcast-SH. Additionally, the Basic Transport Protocol (ETSI EN 302 636-5-1 V2.2.1 (2019-05)) has also been updated. It includes BTP-A and BTP-B in all its variants.

This PR updates ETSI GeoNetworking protocol to version 1 (ETSI EN 302 636-4-1 V1.4.1 (2020-01)). The update includes dissectors for GeoNet Beacon messages and TopoScopeBcast-SH. Additionally, the Basic Transport Protocol (ETSI EN 302 636-5-1 V2.2.1 (2019-05)) has also been updated. It includes BTP-A and BTP-B in all its variants.
@danieluliedguevara
Copy link
Author

@infrastation just a reminder of this PR! Thank you!

case HT_BEACON:
process_beacon_header_from_bytes(ndo, bp, length);
return;
break;
Copy link
Member

Choose a reason for hiding this comment

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

So return or break?

Choose a reason for hiding this comment

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

Done!

print-geonet.c Outdated
lon = GET_BE_S_4(*bp);
*bp += 4;
*length -= 4;
uint32_t value = GET_BE_U_4(*bp);
Copy link
Member

Choose a reason for hiding this comment

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

I remember commenting on this before: would it be simpler to fetch one field at a time?

Choose a reason for hiding this comment

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

Yes, the issue here is that some values, e.g., PAI, are 1 bit long. Which means that there must be some kind of bitwise operation. Although I've removed the bitwise operation for h (heading).

print-geonet.c Outdated
}

/* Process Long Position Vector as per Section 9.5.2 of ETSI EN 302 636-4-1 V1.4.1 (2020-01)*/
static void process_long_position_vector_from_bytes(netdissect_options *ndo, const u_char **bp, u_int *length)
Copy link
Member

Choose a reason for hiding this comment

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

Here and elsewhere: the common convention is to return the processed/consumed number of bytes from a helper function, then the calling function can increment bp and decrement length once.

Choose a reason for hiding this comment

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

Done, please review and see if the solution I've proposed is the "common convention" way of doing it.

print-geonet.c Outdated
(*bp)++;
(*length)--;
version = (value >> 4) & FOUR_BITS_MASK;
if (!is_value_in_list(version, implemented_gn_versions, IMPLEMENTED_GN_VERSIONS_NUM))
Copy link
Member

Choose a reason for hiding this comment

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

Please do not over-engineer this, an if would do the job just fine.

Choose a reason for hiding this comment

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

Done!

print-geonet.c Outdated
const char *next_header_text = tok2str(common_header_next_header_values, "Unknown", *next_header);
const char *header_type_text = tok2str(header_type_tok, "Unknown", HT_HST(*header_type, *header_subtype));
const char *flags_text = tok2str(flags_text_from_bytes, "Unknown", flags);
if (ndo->ndo_vflag == 1)
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a switch block.

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@infrastation infrastation left a comment

Choose a reason for hiding this comment

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

Thank you for waiting. This requires a bit more work, as noted.

Including bitwise operation simplifications, and other related tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants