aboutsummaryrefslogtreecommitdiffstats
path: root/glougloud
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-06-05 09:00:46 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-06-05 09:00:46 +0200
commita8ab84a6a4537ba02e07100d44257b49a330c61e (patch)
tree9239153308baaaa5326be3f4d0b138fe038237f2 /glougloud
parentmake pkg build .tgz (diff)
downloadglouglou-a8ab84a6a4537ba02e07100d44257b49a330c61e.tar.xz
glouglou-a8ab84a6a4537ba02e07100d44257b49a330c61e.zip
glougloud: option to specify listen interfaces / ports
Diffstat (limited to 'glougloud')
-rw-r--r--glougloud/glougloud.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/glougloud/glougloud.c b/glougloud/glougloud.c
index f30379e..d6ca4b1 100644
--- a/glougloud/glougloud.c
+++ b/glougloud/glougloud.c
@@ -37,7 +37,7 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-hv]\n", __progname);
+ fprintf(stderr, "usage: %s [-hlLpPv]\n", __progname);
exit(1);
}
@@ -53,14 +53,30 @@ int
main(int argc, char **argv)
{
struct event *ev_sigint, *ev_sigterm, *ev_sigchld, *ev_sighup;
+ char probes_ip[30] = "127.0.0.1";
+ char analysers_ip[30] = "127.0.0.1";
+ int probes_port = GLOUGLOU_PROBE_DEFAULT_PORT;
+ int analysers_port = GLOUGLOU_ANALY_DEFAULT_PORT;
int loglevel = 0;
int op;
- while ((op = getopt(argc, argv, "hv")) != -1) {
+ while ((op = getopt(argc, argv, "hl:L:p:P:v")) != -1) {
switch (op) {
case 'h':
usage();
/* NOTREACHED */
+ case 'l':
+ strncpy(probes_ip, optarg, sizeof(probes_ip));
+ break;
+ case 'L':
+ strncpy(analysers_ip, optarg, sizeof(analysers_ip));
+ break;
+ case 'p':
+ probes_port = atoi(optarg);
+ break;
+ case 'P':
+ analysers_port = atoi(optarg);
+ break;
case 'v':
loglevel++;
break;
@@ -89,9 +105,9 @@ main(int argc, char **argv)
evsignal_add(ev_sighup, NULL);
signal(SIGPIPE, SIG_IGN);
- ggserv_probes = gg_server_start(ev_base, "127.0.0.1", GLOUGLOU_PROBE_DEFAULT_PORT,
+ ggserv_probes = gg_server_start(ev_base, probes_ip, probes_port,
prb_handle_conn, prb_handle_packet, NULL);
- ggserv_analysers = gg_server_start(ev_base, "127.0.0.1", GLOUGLOU_ANALY_DEFAULT_PORT,
+ ggserv_analysers = gg_server_start(ev_base, analysers_ip, analysers_port,
cli_handle_conn, cli_handle_packet, NULL);
event_base_dispatch(ev_base);