Skip to content

Commit

Permalink
nathelper: allow port to be specified in force_socket, fixes kamailio…
Browse files Browse the repository at this point in the history
  • Loading branch information
tverlaan committed Jan 13, 2018
1 parent 447d49f commit bebf08e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/modules/nathelper/doc/nathelper_admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<title>Set <varname>force_socket</varname> parameter</title>
<programlisting format="linespecific">
...
modparam("nathelper", "force_socket", "localhost:33333")
modparam("nathelper", "force_socket", "127.0.0.1:5060")
...
</programlisting>
</example>
Expand Down
11 changes: 9 additions & 2 deletions src/modules/nathelper/nathelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ mod_init(void)
struct in_addr addr;
pv_spec_t avp_spec;
str s;
int port, proto;
str host;

if(nathelper_rpc_init()<0)
{
Expand All @@ -453,8 +455,13 @@ mod_init(void)
rcv_avp_type = 0;
}

if (force_socket_str.s && force_socket_str.len>0) {
force_socket=grep_sock_info(&force_socket_str,0,0);
if(force_socket_str.s && force_socket_str.len > 0) {
if(parse_phostport(force_socket_str.s, &host.s, &host.len, &port, &proto) == 0) {
force_socket = grep_sock_info(&host, port, proto);
if(force_socket == 0) {
LM_ERR("non-local force_socket <%s>\n", force_socket_str.s);
}
}
}

/* create raw socket? */
Expand Down

0 comments on commit bebf08e

Please sign in to comment.