From aba7bf6af1dc7a00b4933f427ba02c639f43bf52 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 22 Jun 2024 04:47:32 +0700 Subject: [PATCH] pfcp_packet.hrl: fix type hints for ipv4/ipv6 fields 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 --- include/pfcp_packet.hrl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/pfcp_packet.hrl b/include/pfcp_packet.hrl index 11c09da..0d3e3ac 100644 --- a/include/pfcp_packet.hrl +++ b/include/pfcp_packet.hrl @@ -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 }). @@ -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, { @@ -99,8 +99,8 @@ 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() @@ -108,8 +108,8 @@ -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 }). @@ -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() }).