diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-12-09 14:14:21 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-12-09 14:14:21 +0200 |
commit | e949998edcf7cbeaaec93cbab5111e6c931268fd (patch) | |
tree | a1df61d1b109d8a5426a85c5bff41c2187485024 | |
parent | ba40e4b8d25d69b3f3a87af1ee1274355ae2140b (diff) | |
download | eclat-e949998edcf7cbeaaec93cbab5111e6c931268fd.tar.gz eclat-e949998edcf7cbeaaec93cbab5111e6c931268fd.tar.bz2 |
eclat sg: make --port optional.
-rw-r--r-- | src/sg-cl.opt | 2 | ||||
-rw-r--r-- | src/sg.c | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/sg-cl.opt b/src/sg-cl.opt index b8a3056..265aa4b 100644 --- a/src/sg-cl.opt +++ b/src/sg-cl.opt @@ -130,7 +130,7 @@ ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[]>],[< if (list_option) describe_query_create(env, argc, argv, rt[dest_n].resid); else { - if (group_list || source_list || from_port || to_port) + if (group_list || source_list || from_port || to_port || proto) flush_rule(); if (rule_n == 1) die(EX_USAGE, "no rules"); @@ -91,14 +91,14 @@ flush_rule() eclat_query_add_param(query, bufptr, "0.0.0.0/0"); } - if (!from_port) - die(EX_USAGE, "rule %d: no ports", rule_n); - - grecs_asprintf(&bufptr, &bufsize, "IpPermissions.%d.FromPort", rule_n); - eclat_query_add_param(query, bufptr, from_port); - grecs_asprintf(&bufptr, &bufsize, "IpPermissions.%d.ToPort", rule_n); - eclat_query_add_param(query, bufptr, to_port); - + if (from_port) { + grecs_asprintf(&bufptr, &bufsize, "IpPermissions.%d.FromPort", + rule_n); + eclat_query_add_param(query, bufptr, from_port); + grecs_asprintf(&bufptr, &bufsize, "IpPermissions.%d.ToPort", + rule_n); + eclat_query_add_param(query, bufptr, to_port); + } from_port = to_port = NULL; ++rule_n; } |