aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-12-09 14:14:21 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2013-12-09 14:14:21 +0200
commite949998edcf7cbeaaec93cbab5111e6c931268fd (patch)
treea1df61d1b109d8a5426a85c5bff41c2187485024
parentba40e4b8d25d69b3f3a87af1ee1274355ae2140b (diff)
downloadeclat-e949998edcf7cbeaaec93cbab5111e6c931268fd.tar.gz
eclat-e949998edcf7cbeaaec93cbab5111e6c931268fd.tar.bz2
eclat sg: make --port optional.
-rw-r--r--src/sg-cl.opt2
-rw-r--r--src/sg.c16
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");
diff --git a/src/sg.c b/src/sg.c
index c3f5513..098477e 100644
--- a/src/sg.c
+++ b/src/sg.c
@@ -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;
}

Return to:

Send suggestions and report system problems to the System administrator.