Skip to content

Commit

Permalink
pfcp_packet.hrl: fix type hints for ipv4/ipv6 fields
Browse files Browse the repository at this point in the history
The types 'inet:ip4_address()' and 'inet:ip6_address()' define tuples
of 4 and 16 integers, respectively;  while the pfcplib API actually
expects the ipv4/ipv6 fields to hold binary() values (raw bytes).

This is confusing and makes Dialyzer go nuts about valid code.

Signed-off-by: Andreas Schultz <[email protected]>
  • Loading branch information
axilirator authored and RoadRunnr committed Jun 24, 2024
1 parent e23f349 commit e505c0a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions include/pfcp_packet.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

-record(f_teid, {
teid :: 'choose' | 0..16#ffffffff,
ipv6 :: undefined | 'choose' | inet:ip6_address(),
ipv4 :: undefined | 'choose' | inet:ip4_address(),
ipv6 :: undefined | 'choose' | << _:128 >>,
ipv4 :: undefined | 'choose' | << _:32 >>,
choose_id :: undefined | 0..16#ff
}).

Expand Down Expand Up @@ -50,8 +50,8 @@

-record(f_seid, {
seid :: 0..16#ffffffffffffffff,
ipv4 :: undefined | inet:ip4_address(),
ipv6 :: undefined | inet:ip6_address()
ipv4 :: undefined | << _:32 >>,
ipv6 :: undefined | << _:128 >>
}).

-record(node_id, {
Expand Down Expand Up @@ -99,17 +99,17 @@
n19 = false :: boolean(),
type :: 'GTP-U' | 'UDP' | 'IP' | 'RAW' | undefined,
teid :: undefined | 0..16#fffffffffffffff,
ipv4 :: undefined | inet:ip4_address() | binary(),
ipv6 :: undefined | inet:ip6_address() | binary(),
ipv4 :: undefined | << _:32 >>,
ipv6 :: undefined | << _:128 >>,
port :: undefined | 0..16#ffff,
c_tag :: undefined | binary(),
s_tag :: undefined | binary()
}).

-record(ue_ip_address, {
type :: undefined | 'src' | 'dst',
ipv4 :: undefined | 'choose' | inet:ip4_address(),
ipv6 :: undefined | 'choose' | inet:ip6_address(),
ipv4 :: undefined | 'choose' | << _:32 >>,
ipv6 :: undefined | 'choose' | << _:128 >>,
prefix_delegation :: undefined | 0..16#ff,
prefix_length :: undefined | 0..16#ff
}).
Expand All @@ -131,8 +131,8 @@
}).

-record(remote_gtp_u_peer, {
ipv4 :: undefined | inet:ip4_address(),
ipv6 :: undefined | inet:ip6_address(),
ipv4 :: undefined | << _:32 >>,
ipv6 :: undefined | << _:128 >>,
destination_interface :: undefined | binary(),
network_instance :: undefined | binary()
}).
Expand Down

0 comments on commit e505c0a

Please sign in to comment.