diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-19 14:04:23 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-19 14:04:23 +0200 |
commit | 7af4962e071a69a48231abede1701ca65cb620fe (patch) | |
tree | 5f62a6bdc037e14b4418c19f76c0d0025d358dec /openbsc/src/gprs/gb_proxy_main.c | |
parent | ab1d5626ace2adfb44ab2534098efa0076604b21 (diff) |
[SGSN] Gb Proxy: Simplify configuration
Almost all parameters about the SGSNs NS-VC can be specified in the NS
protocol node. All that needs to remain in the gbproxy config node
is "nsip sgsn nsei XXX".
Diffstat (limited to 'openbsc/src/gprs/gb_proxy_main.c')
-rw-r--r-- | openbsc/src/gprs/gb_proxy_main.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/openbsc/src/gprs/gb_proxy_main.c b/openbsc/src/gprs/gb_proxy_main.c index 02b31815a..68d07ae32 100644 --- a/openbsc/src/gprs/gb_proxy_main.c +++ b/openbsc/src/gprs/gb_proxy_main.c @@ -188,7 +188,6 @@ extern void *tall_msgb_ctx; int main(int argc, char **argv) { struct gsm_network dummy_network; - struct sockaddr_in sin; int rc; tall_bsc_ctx = talloc_named_const(NULL, 0, "nsip_proxy"); @@ -207,7 +206,7 @@ int main(int argc, char **argv) vty_init("Osmocom Gb Proxy", PACKAGE_VERSION, openbsc_copyright); logging_vty_add_cmds(); - gbproxy_vty_init(); + gbproxy_vty_init(); handle_options(argc, argv); @@ -232,15 +231,18 @@ int main(int argc, char **argv) exit(2); } - nsip_listen(bssgp_nsi, gbcfg.nsip_listen_port); - - /* 'establish' the outgoing connection to the SGSN */ - sin.sin_family = AF_INET; - sin.sin_port = htons(gbcfg.nsip_sgsn_port); - sin.sin_addr.s_addr = htonl(gbcfg.nsip_sgsn_ip); - nsip_connect(bssgp_nsi, &sin, gbcfg.nsip_sgsn_nsei, - gbcfg.nsip_sgsn_nsvci); + if (!nsvc_by_nsei(gbcfg.nsi, gbcfg.nsip_sgsn_nsei)) { + LOGP(DGPRS, LOGL_FATAL, "You cannot proxy to NSEI %u " + "without creating that NSEI before\n", + gbcfg.nsip_sgsn_nsei); + exit(2); + } + rc = nsip_listen(bssgp_nsi, gbcfg.nsip_listen_port); + if (rc < 0) { + LOGP(DGPRS, LOGL_FATAL, "Cannot bind/listen on NSIP socket\n"); + exit(2); + } /* Reset all the persistent NS-VCs that we've read from the config */ gbprox_reset_persistent_nsvcs(bssgp_nsi); |