Skip to content

Fix silent cast of ProtocolTypeFamily to ProtocolType in Packet ctor.#2099

Open
Dimi1010 wants to merge 2 commits intoseladb:devfrom
Dimi1010:bugfix/packet-proto-family
Open

Fix silent cast of ProtocolTypeFamily to ProtocolType in Packet ctor.#2099
Dimi1010 wants to merge 2 commits intoseladb:devfrom
Dimi1010:bugfix/packet-proto-family

Conversation

@Dimi1010
Copy link
Copy Markdown
Collaborator

@Dimi1010 Dimi1010 commented Apr 11, 2026

This PR changes the signature of the full Packet parsing constructor to use ProtocolTypeFamily instead of ProtocolType.

This is done to allow protocol "family" constants to be used in the main signature. Previously used family constants (uint32_t) were silently narrowed to the first protocol of the family (uint8_t). (e.g "IP" family would be treated as only "IPv4") if used in the full constructor signature.

@Dimi1010 Dimi1010 added the bug label Apr 11, 2026
@Dimi1010 Dimi1010 changed the title Fix silent downcast of ProtocolTypeFamily to ProtocolType in Packet ctor. Fix silent cast of ProtocolTypeFamily to ProtocolType in Packet ctor. Apr 11, 2026
@Dimi1010 Dimi1010 marked this pull request as ready for review April 11, 2026 09:21
@Dimi1010 Dimi1010 requested a review from seladb as a code owner April 11, 2026 09:21
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.93%. Comparing base (0b83e76) to head (5120e8f).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2099   +/-   ##
=======================================
  Coverage   83.93%   83.93%           
=======================================
  Files         316      316           
  Lines       57024    57021    -3     
  Branches    11797    11794    -3     
=======================================
- Hits        47863    47861    -2     
- Misses       7941     7995   +54     
+ Partials     1220     1165   -55     
Flag Coverage Δ
alpine320 76.63% <100.00%> (+<0.01%) ⬆️
fedora42 76.20% <100.00%> (+0.02%) ⬆️
macos-14 82.02% <100.00%> (-0.01%) ⬇️
macos-15 82.02% <100.00%> (+<0.01%) ⬆️
mingw32 70.73% <100.00%> (+<0.01%) ⬆️
mingw64 70.71% <100.00%> (+0.09%) ⬆️
npcap ?
rhel94 76.01% <100.00%> (+<0.01%) ⬆️
ubuntu2004 59.75% <100.00%> (+<0.01%) ⬆️
ubuntu2004-zstd 59.85% <100.00%> (-0.02%) ⬇️
ubuntu2204 76.04% <100.00%> (-0.01%) ⬇️
ubuntu2204-icpx 59.08% <100.00%> (-0.03%) ⬇️
ubuntu2404 76.30% <100.00%> (+<0.01%) ⬆️
ubuntu2404-arm64 76.34% <100.00%> (+0.02%) ⬆️
unittest 83.93% <100.00%> (+<0.01%) ⬆️
windows-2022 85.58% <100.00%> (+0.11%) ⬆️
windows-2025 85.61% <100.00%> (+0.12%) ⬆️
winpcap 85.61% <100.00%> (-0.08%) ⬇️
xdp 52.71% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Owner

@seladb seladb left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants