diff --git a/src/gtp_packet.erl b/src/gtp_packet.erl index 8837afa..631a068 100644 --- a/src/gtp_packet.erl +++ b/src/gtp_packet.erl @@ -171,6 +171,15 @@ decode_v2_msg(<>, 1, Type) -> decode_v2_msg(<>, 0, Type) -> #gtp{version = v2, type = message_type_v2(Type), tei = undefined, seq_no = SeqNo, ie = IEs}. +%% only intended for domain names, no support for anything outside +%% of the allowed character range +to_lower_char(C) when C >= $A andalso C =< $Z -> + C bor 16#20; +to_lower_char(C) -> C. + +to_lower(BinStr) when is_binary(BinStr) -> + << << (to_lower_char(C)) >> || << C >> <= BinStr >>. + %%%=================================================================== %%% Internal functions %%%=================================================================== @@ -379,7 +388,7 @@ decode_v1_uli(<>, Instance) - end. decode_fqdn(FQDN) -> - [ Part || <> <= FQDN ]. + [ to_lower(Part) || <> <= FQDN ]. decode_isdn_address_string(<<>>) -> {isdn_address, 1, 1, 1, <<"000000000000000">>}; diff --git a/test/property_test/gtplib_prop.erl b/test/property_test/gtplib_prop.erl index d0d977f..74da81e 100644 --- a/test/property_test/gtplib_prop.erl +++ b/test/property_test/gtplib_prop.erl @@ -170,7 +170,7 @@ dns_label() -> ?LET(I, int_range(1,64), vector(I, oneof( - lists:seq($A, $Z) ++ lists:seq($a, $z) ++ lists:seq($0, $9) ++ [$-]))). + lists:seq($a, $z) ++ lists:seq($0, $9) ++ [$-]))). dns_name_list() -> ?SUCHTHAT(N,