Skip to content

Commit

Permalink
GTPv2: Fix typo in ChargingCharacteristics (#4203)
Browse files Browse the repository at this point in the history
* Fix typo in ChargingCharacteristics

* Add deprecated_fields to ChargingCharacteristics
  • Loading branch information
MarkMarkyMarkus committed Jan 30, 2024
1 parent e2e4d2d commit 0137bbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion scapy/contrib/gtp_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1360,11 +1360,14 @@ class IE_ChargingID(gtp.IE_Base):

class IE_ChargingCharacteristics(gtp.IE_Base):
name = "IE Charging Characteristics"
deprecated_fields = {
"ChargingCharacteristric": ("ChargingCharacteristic", "2.6.0")
}
fields_desc = [ByteEnumField("ietype", 95, IEType),
ShortField("length", None),
BitField("CR_flag", 0, 4),
BitField("instance", 0, 4),
XShortField("ChargingCharacteristric", 0)]
XShortField("ChargingCharacteristic", 0)]


class IE_PDN_type(gtp.IE_Base):
Expand Down
6 changes: 3 additions & 3 deletions test/contrib/gtp_v2.uts
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,12 @@ ie.ietype == 94 and ie.ChargingID == 956321605
h = "3333333333332222222222228100a384080045b8011800000000fc1193150a2a00010a2a00027be5084b010444c4482000f82fd783953790a2000100080002081132547600004c0006001111111111114b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a001961616161616161616161616161616161616161616161616161800001000063000100014f000500017f0000034d000400000800007f00010000480008000000c3500002e6304e001a008080211001000010810600000000830600000000000d00000a005d001f00490001000750001600190700000000000000000000000000000000000000007200020014005f0002000a008e80b09f"
gtp = Ether(hex_bytes(h))
ie = gtp.IE_list[18]
ie.ChargingCharacteristric == 0xa00
ie.ChargingCharacteristic == 0xa00

= IE_ChargingCharacteristics, basic instantiation
ie = IE_ChargingCharacteristics(
ietype='Charging Characteristics', length=2, ChargingCharacteristric=0xa00)
ie.ietype == 95 and ie.ChargingCharacteristric == 0xa00
ietype='Charging Characteristics', length=2, ChargingCharacteristic=0xa00)
ie.ietype == 95 and ie.ChargingCharacteristic == 0xa00

= IE_PDN_type, dissection
h = "3333333333332222222222228100a384080045b800ed00000000fc1193430a2a00010a2a00027f61084b00d91c47482000cd140339f4d99f66000100080002081132547600004b000800000000000001e24056000d001832f420303932f4200001e2405300030032f4205200010006570009008a000010927f0000025700090187000010927f00000247001a00196161616161616161616161616161616161616161616161616163000100014f000500017f0000034d0004000808000048000800000017000000a4105d002c0049000100e55700090385000010927f00000250001600580700000000000000000000000000000000000000007200020014005311004c"
Expand Down

0 comments on commit 0137bbb

Please sign in to comment.