fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40124?usp=email )
Change subject: osmo_dia2gsup: add and use parse_addr/1
......................................................................
osmo_dia2gsup: add and use parse_addr/1
Change-Id: If02c3486c937595fcc0d3813ab64445ebccb746e
---
M src/osmo_dia2gsup.erl
1 file changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup refs/changes/24/40124/1
diff --git a/src/osmo_dia2gsup.erl b/src/osmo_dia2gsup.erl
index 7c4f2c1..4986e7d 100644
--- a/src/osmo_dia2gsup.erl
+++ b/src/osmo_dia2gsup.erl
@@ -106,7 +106,7 @@
Port = get_env(diameter_port, 3868),
Proto = get_env(diameter_proto, sctp),
ConnectTimer = get_env(diameter_connect_timer, 30000),
- listen(?SVC_NAME, {address, Proto, element(2,inet:parse_address(Ip)), Port}, {timer,
ConnectTimer}),
+ listen(?SVC_NAME, {address, Proto, parse_addr(Ip), Port}, {timer, ConnectTimer}),
lager:info("Diameter HSS Application started on IP ~s, ~p port ~p~n", [Ip,
Proto, Port]),
{ok, State}.
@@ -156,3 +156,16 @@
tmod(tcp) -> diameter_tcp;
tmod(sctp) -> diameter_sctp.
+
+parse_addr(AddrStr) when is_list(AddrStr) ->
+ {ok, Addr} = inet:parse_address(AddrStr),
+ Addr;
+
+parse_addr(addr) ->
+ case addr of
+ any -> any;
+ localhost -> localhost;
+ _ ->
+ true = inet:is_ip_address(addr),
+ addr
+ end.
--
To view, visit
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40124?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo_dia2gsup
Gerrit-Branch: master
Gerrit-Change-Id: If02c3486c937595fcc0d3813ab64445ebccb746e
Gerrit-Change-Number: 40124
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>