diff options
Diffstat (limited to 'src/osmo-bsc_nat/bsc_nat.c')
-rw-r--r-- | src/osmo-bsc_nat/bsc_nat.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/osmo-bsc_nat/bsc_nat.c b/src/osmo-bsc_nat/bsc_nat.c index c1c791392..2f8d32563 100644 --- a/src/osmo-bsc_nat/bsc_nat.c +++ b/src/osmo-bsc_nat/bsc_nat.c @@ -46,7 +46,6 @@ #include <osmocom/bsc/bsc_msg_filter.h> #include <osmocom/bsc/ipaccess.h> #include <osmocom/bsc/abis_nm.h> -#include <osmocom/bsc/socket.h> #include <osmocom/bsc/vty.h> #include <osmocom/ctrl/control_cmd.h> @@ -59,6 +58,7 @@ #include <osmocom/core/application.h> #include <osmocom/core/talloc.h> #include <osmocom/core/stats.h> +#include <osmocom/core/socket.h> #include <osmocom/gsm/tlv.h> #include <osmocom/gsm/gsm0808.h> @@ -80,7 +80,7 @@ #define SCCP_CLOSE_TIME_TIMEOUT 19 static const char *config_file = "bsc-nat.cfg"; -static struct in_addr local_addr; +static const char *local_addr; static struct osmo_fd bsc_listen; static const char *msc_ip = NULL; static struct osmo_timer_list sccp_close; @@ -1507,7 +1507,7 @@ static void handle_options(int argc, char **argv) msc_ip = optarg; break; case 'l': - inet_aton(optarg, &local_addr); + local_addr = optarg; break; default: /* ignore */ @@ -1693,7 +1693,7 @@ int main(int argc, char **argv) /* parse options */ - local_addr.s_addr = INADDR_ANY; + local_addr = NULL; handle_options(argc, argv); nat->include_base = dirname(talloc_strdup(tall_bsc_ctx, config_file)); @@ -1757,8 +1757,10 @@ int main(int argc, char **argv) bsc_msc_connect(nat->msc_con); /* wait for the BSC */ - rc = make_sock(&bsc_listen, IPPROTO_TCP, ntohl(local_addr.s_addr), - 5000, 0, ipaccess_listen_bsc_cb, nat); + bsc_listen.cb = ipaccess_listen_bsc_cb; + bsc_listen.data = nat; + rc = osmo_sock_init_ofd(&bsc_listen, AF_INET, SOCK_STREAM, IPPROTO_TCP, + local_addr, 5000, OSMO_SOCK_F_BIND); if (rc != 0) { fprintf(stderr, "Failed to listen for BSC.\n"); exit(1); |