Repository navigation
gtp_v2: allow building IE_Indication, IE_MMContext_EPS, and PCO_S_Nssai without explicit length - #5296
Open
pro-laxmi wants to merge 1 commit into
Open
gtp_v2: allow building IE_Indication, IE_MMContext_EPS, and PCO_S_Nssai without explicit length#5296pro-laxmi wants to merge 1 commit into
pro-laxmi wants to merge 1 commit into
Conversation
…ai without explicit length
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.
Description
When building
IE_Indication,IE_MMContext_EPS, orPCO_S_Nssaiwith default parameters or without manually calculating and passinglength,ConditionalFieldconditions evaluatepkt.length > ...whenpkt.lengthisNone. In Python 3, this raisesTypeError: '>' not supported between instances of 'NoneType' and 'int':Fix
IE_Indication: Set defaultlengthto 3 (matching the 3 mandatory octets of basic flags defined in 3GPP TS 29.274 Table 8.12-1: Octets 5–7). Dissection and explicit lengths (length=8) remain unchanged.IE_MMContext_EPS: InConditionalFieldandStrLenField("fields", ...), guardpkt.lengthagainstNone(pkt.length > 40 if pkt.length is not None else False) so the 41-octet base EPS context builds cleanly without an explicit length.PCO_S_Nssai: InConditionalField, guard againstpkt.length is None, defaulting mandatory SST toTrue, allowingPCO_Protocol.post_buildto automatically calculate the length.Tests
Added test cases in
test/contrib/gtp_v2.utsverifying thatIE_Indication(PS=1),IE_MMContext_EPS(), andPCO_S_Nssaibuild and dissect cleanly without requiring an explicit length parameter. Full unit tests pass viatest/run_tests -P "load_contrib('gtp_v2')" -t test/contrib/gtp_v2.uts.