diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2011-04-07 18:47:39 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-04-07 23:28:00 +0200 |
commit | 9f1294d6238e7ae00d52017dbe89ed16050f6121 (patch) | |
tree | c16a5b8cdc08facbf179d765e9fed3684d0527bb /openbsc/src/ipaccess | |
parent | c281b4e85abfe615c9cbebfe1c156eb125f5fe21 (diff) |
ipaccess-proxy: remove hardcoded IP for options `-l' and `-b'
This patch removes the hardcoded IP addresses for options `-l'
and `-b'.
Diffstat (limited to 'openbsc/src/ipaccess')
-rw-r--r-- | openbsc/src/ipaccess/ipaccess-proxy.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c index b6dcad120..55658cf7a 100644 --- a/openbsc/src/ipaccess/ipaccess-proxy.c +++ b/openbsc/src/ipaccess/ipaccess-proxy.c @@ -1120,11 +1120,19 @@ static void print_help() static void print_usage() { - printf("Usage: ipaccess-proxy\n"); + printf("Usage: ipaccess-proxy [options]\n"); } +enum { + IPA_PROXY_OPT_LISTEN_NONE = 0, + IPA_PROXY_OPT_LISTEN_IP = (1 << 0), + IPA_PROXY_OPT_BSC_IP = (1 << 1), +}; + static void handle_options(int argc, char** argv) { + int options_mask = 0; + while (1) { int option_index = 0, c; static struct option long_options[] = { @@ -1150,9 +1158,11 @@ static void handle_options(int argc, char** argv) exit(0); case 'l': listen_ipaddr = optarg; + options_mask |= IPA_PROXY_OPT_LISTEN_IP; break; case 'b': bsc_ipaddr = optarg; + options_mask |= IPA_PROXY_OPT_BSC_IP; break; case 'g': gprs_ns_ipaddr = optarg; @@ -1171,15 +1181,20 @@ static void handle_options(int argc, char** argv) break; } } + if ((options_mask & (IPA_PROXY_OPT_LISTEN_IP | IPA_PROXY_OPT_BSC_IP)) + != (IPA_PROXY_OPT_LISTEN_IP | IPA_PROXY_OPT_BSC_IP)) { + printf("ERROR: You have to specify `--listen' and `--bsc' " + "options at least.\n"); + print_usage(); + print_help(); + exit(EXIT_FAILURE); + } } int main(int argc, char **argv) { int rc; - listen_ipaddr = "192.168.100.11"; - bsc_ipaddr = "192.168.100.239"; - tall_bsc_ctx = talloc_named_const(NULL, 1, "ipaccess-proxy"); log_init(&log_info); |