diff options
author | Rich Fought <Rich.Fought@watchguard.com> | 2012-10-19 18:18:52 (GMT) |
---|---|---|
committer | Rich Fought <Rich.Fought@watchguard.com> | 2012-10-19 18:18:52 (GMT) |
commit | d2fff93ccebbc22fe9b8094b93ffde34d802b680 (patch) | |
tree | e4ce3588cb335b0a4628b4a74f554ddb14942a7f /src | |
parent | 2d707513c6d5e83df9e3bcf5d006ca9c819a1f07 (diff) | |
download | libnl-d2fff93ccebbc22fe9b8094b93ffde34d802b680.zip libnl-d2fff93ccebbc22fe9b8094b93ffde34d802b680.tar.gz libnl-d2fff93ccebbc22fe9b8094b93ffde34d802b680.tar.bz2 |
Source cleanup for upstream
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/exp.c | 58 | ||||
-rw-r--r-- | src/nf-exp-add.c | 86 | ||||
-rw-r--r-- | src/nf-exp-delete.c | 82 | ||||
-rw-r--r-- | src/nf-exp-list.c | 22 |
4 files changed, 122 insertions, 126 deletions
diff --git a/src/lib/exp.c b/src/lib/exp.c index 7e0a017..a7a74f5 100644 --- a/src/lib/exp.c +++ b/src/lib/exp.c @@ -62,36 +62,36 @@ void nl_cli_exp_parse_id(struct nfnl_exp *exp, char *arg) void nl_cli_exp_parse_helper_name(struct nfnl_exp *exp, char *arg) { - nfnl_exp_set_helper_name(exp, arg); + nfnl_exp_set_helper_name(exp, arg); } void nl_cli_exp_parse_zone(struct nfnl_exp *exp, char *arg) { - uint32_t zone = nl_cli_parse_u32(arg); - nfnl_exp_set_zone(exp, zone); + uint32_t zone = nl_cli_parse_u32(arg); + nfnl_exp_set_zone(exp, zone); } void nl_cli_exp_parse_flags(struct nfnl_exp *exp, char *arg) { - uint32_t flags = nl_cli_parse_u32(arg); - nfnl_exp_set_flags(exp, flags); + uint32_t flags = nl_cli_parse_u32(arg); + nfnl_exp_set_flags(exp, flags); } void nl_cli_exp_parse_class(struct nfnl_exp *exp, char *arg) { - uint32_t class = nl_cli_parse_u32(arg); - nfnl_exp_set_class(exp, class); + uint32_t class = nl_cli_parse_u32(arg); + nfnl_exp_set_class(exp, class); } void nl_cli_exp_parse_nat_dir(struct nfnl_exp *exp, char *arg) { - uint32_t nat_dir = nl_cli_parse_u32(arg); - nfnl_exp_set_nat_dir(exp, nat_dir); + uint32_t nat_dir = nl_cli_parse_u32(arg); + nfnl_exp_set_nat_dir(exp, nat_dir); } void nl_cli_exp_parse_fn(struct nfnl_exp *exp, char *arg) { - nfnl_exp_set_fn(exp, arg); + nfnl_exp_set_fn(exp, arg); } void nl_cli_exp_parse_src(struct nfnl_exp *exp, int tuple, char *arg) @@ -114,20 +114,20 @@ void nl_cli_exp_parse_dst(struct nfnl_exp *exp, int tuple, char *arg) void nl_cli_exp_parse_l4protonum(struct nfnl_exp *exp, int tuple, char *arg) { - int l4protonum; + int l4protonum; - if ((l4protonum = nl_str2ip_proto(arg)) < 0) - nl_cli_fatal(l4protonum, - "Unable to nl_cli_exp_parse protocol \"%s\": %s", - arg, nl_geterror(l4protonum)); + if ((l4protonum = nl_str2ip_proto(arg)) < 0) + nl_cli_fatal(l4protonum, + "Unable to nl_cli_exp_parse protocol \"%s\": %s", + arg, nl_geterror(l4protonum)); - nfnl_exp_set_l4protonum(exp, tuple, l4protonum); + nfnl_exp_set_l4protonum(exp, tuple, l4protonum); } void nl_cli_exp_parse_src_port(struct nfnl_exp *exp, int tuple, char *arg) { uint32_t sport = nl_cli_parse_u32(arg); - uint16_t dport = nfnl_exp_get_dst_port(exp, tuple); + uint16_t dport = nfnl_exp_get_dst_port(exp, tuple); nfnl_exp_set_ports(exp, tuple, sport, dport); } @@ -140,26 +140,26 @@ void nl_cli_exp_parse_dst_port(struct nfnl_exp *exp, int tuple, char *arg) void nl_cli_exp_parse_icmp_id(struct nfnl_exp *exp, int tuple, char *arg) { - uint32_t id = nl_cli_parse_u32(arg); - uint8_t type = nfnl_exp_get_icmp_type(exp, tuple); - uint8_t code = nfnl_exp_get_icmp_code(exp, tuple); - nfnl_exp_set_icmp(exp, tuple, id, type, code); + uint32_t id = nl_cli_parse_u32(arg); + uint8_t type = nfnl_exp_get_icmp_type(exp, tuple); + uint8_t code = nfnl_exp_get_icmp_code(exp, tuple); + nfnl_exp_set_icmp(exp, tuple, id, type, code); } void nl_cli_exp_parse_icmp_type(struct nfnl_exp *exp, int tuple, char *arg) { - uint32_t type = nl_cli_parse_u32(arg); - uint16_t id = nfnl_exp_get_icmp_id(exp, tuple); - uint8_t code = nfnl_exp_get_icmp_code(exp, tuple); - nfnl_exp_set_icmp(exp, tuple, id, type, code); + uint32_t type = nl_cli_parse_u32(arg); + uint16_t id = nfnl_exp_get_icmp_id(exp, tuple); + uint8_t code = nfnl_exp_get_icmp_code(exp, tuple); + nfnl_exp_set_icmp(exp, tuple, id, type, code); } void nl_cli_exp_parse_icmp_code(struct nfnl_exp *exp, int tuple, char *arg) { - uint32_t code = nl_cli_parse_u32(arg); - uint16_t id = nfnl_exp_get_icmp_id(exp, tuple); - uint8_t type = nfnl_exp_get_icmp_type(exp, tuple); - nfnl_exp_set_icmp(exp, tuple, id, type, code); + uint32_t code = nl_cli_parse_u32(arg); + uint16_t id = nfnl_exp_get_icmp_id(exp, tuple); + uint8_t type = nfnl_exp_get_icmp_type(exp, tuple); + nfnl_exp_set_icmp(exp, tuple, id, type, code); } /** @} */ diff --git a/src/nf-exp-add.c b/src/nf-exp-add.c index 6b71897..f760ee5 100644 --- a/src/nf-exp-add.c +++ b/src/nf-exp-add.c @@ -24,31 +24,31 @@ static void print_usage(void) "Usage: nf-exp-list [OPTION]... [CONNTRACK ENTRY]\n" "\n" "Options\n" - " --replace Replace the address if it exists.\n" - " -q, --quiet Do not print informal notifications.\n" + " --replace Replace the address if it exists.\n" + " -q, --quiet Do not print informal notifications.\n" " -h, --help Show this help\n" " -v, --version Show versioning information\n" "\n" "Expectation Selection\n" " -i, --id=NUM Identifier\n" - " --expect-proto=PROTOCOL Expectation protocol\n" + " --expect-proto=PROTOCOL Expectation protocol\n" " --expect-src=ADDR Expectation source address\n" " --expect-sport=PORT Expectation source port\n" " --expect-dst=ADDR Expectation destination address\n" " --expect-dport=PORT Expectation destination port\n" - " --master-proto=PROTOCOL Master conntrack protocol\n" + " --master-proto=PROTOCOL Master conntrack protocol\n" " --master-src=ADDR Master conntrack source address\n" " --master-sport=PORT Master conntrack source port\n" " --master-dst=ADDR Master conntrack destination address\n" " --master-dport=PORT Master conntrack destination port\n" - " --mask-proto=PROTOCOL Mask protocol\n" - " --mask-src=ADDR Mask source address\n" - " --mask-sport=PORT Mask source port\n" - " --mask-dst=ADDR Mask destination address\n" - " --mask-dport=PORT Mask destination port\n" + " --mask-proto=PROTOCOL Mask protocol\n" + " --mask-src=ADDR Mask source address\n" + " --mask-sport=PORT Mask source port\n" + " --mask-dst=ADDR Mask destination address\n" + " --mask-dport=PORT Mask destination port\n" " -F, --family=FAMILY Address family\n" " --timeout=NUM Timeout value\n" - " --helper=STRING Helper Name\n" + " --helper=STRING Helper Name\n" " --flags Flags (Kernel 2.6.37)\n" ); exit(0); @@ -76,24 +76,24 @@ int main(int argc, char *argv[]) ARG_EXPECT_SPORT, ARG_EXPECT_DST, ARG_EXPECT_DPORT, - ARG_MASTER_PROTO, + ARG_MASTER_PROTO, ARG_MASTER_SRC, ARG_MASTER_SPORT, ARG_MASTER_DST, ARG_MASTER_DPORT, - ARG_MASK_PROTO, - ARG_MASK_SRC, - ARG_MASK_SPORT, - ARG_MASK_DST, - ARG_MASK_DPORT, + ARG_MASK_PROTO, + ARG_MASK_SRC, + ARG_MASK_SPORT, + ARG_MASK_DST, + ARG_MASK_DPORT, ARG_TIMEOUT, - ARG_HELPER_NAME, - ARG_REPLACE, + ARG_HELPER_NAME, + ARG_REPLACE, ARG_FLAGS, }; static struct option long_opts[] = { { "replace", 1, 0, ARG_REPLACE }, - { "quiet", 0, 0, 'q' }, + { "quiet", 0, 0, 'q' }, { "help", 0, 0, 'h' }, { "version", 0, 0, 'v' }, { "id", 1, 0, 'i' }, @@ -102,20 +102,20 @@ int main(int argc, char *argv[]) { "expect-sport", 1, 0, ARG_EXPECT_SPORT }, { "expect-dst", 1, 0, ARG_EXPECT_DST }, { "expect-dport", 1, 0, ARG_EXPECT_DPORT }, - { "master-proto", 1, 0, ARG_MASTER_PROTO }, + { "master-proto", 1, 0, ARG_MASTER_PROTO }, { "master-src", 1, 0, ARG_MASTER_SRC }, { "master-sport", 1, 0, ARG_MASTER_SPORT }, { "master-dst", 1, 0, ARG_MASTER_DST }, { "master-dport", 1, 0, ARG_MASTER_DPORT }, - { "mask-proto", 1, 0, ARG_MASK_PROTO }, - { "mask-src", 1, 0, ARG_MASK_SRC }, - { "mask-sport", 1, 0, ARG_MASK_SPORT }, - { "mask-dst", 1, 0, ARG_MASK_DST }, - { "mask-dport", 1, 0, ARG_MASK_DPORT }, + { "mask-proto", 1, 0, ARG_MASK_PROTO }, + { "mask-src", 1, 0, ARG_MASK_SRC }, + { "mask-sport", 1, 0, ARG_MASK_SPORT }, + { "mask-dst", 1, 0, ARG_MASK_DST }, + { "mask-dport", 1, 0, ARG_MASK_DPORT }, { "family", 1, 0, 'F' }, { "timeout", 1, 0, ARG_TIMEOUT }, { "helper", 1, 0, ARG_HELPER_NAME }, - { "flags", 1, 0, ARG_FLAGS}, + { "flags", 1, 0, ARG_FLAGS}, { 0, 0, 0, 0 } }; @@ -125,9 +125,9 @@ int main(int argc, char *argv[]) switch (c) { case '?': exit(NLE_INVAL); - case ARG_REPLACE: nlflags |= NLM_F_REPLACE; break; - case 'q': quiet = 1; break; - case '4': nfnl_exp_set_family(exp, AF_INET); break; + case ARG_REPLACE: nlflags |= NLM_F_REPLACE; break; + case 'q': quiet = 1; break; + case '4': nfnl_exp_set_family(exp, AF_INET); break; case '6': nfnl_exp_set_family(exp, AF_INET6); break; case 'h': print_usage(); break; case 'v': nl_cli_print_version(); break; @@ -137,19 +137,19 @@ int main(int argc, char *argv[]) case ARG_EXPECT_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; case ARG_EXPECT_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; case ARG_EXPECT_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; - case ARG_MASTER_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; + case ARG_MASTER_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; - case ARG_MASK_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; case 'F': nl_cli_exp_parse_family(exp, optarg); break; case ARG_TIMEOUT: nl_cli_exp_parse_timeout(exp, optarg); break; - case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; + case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break; } } @@ -157,15 +157,13 @@ int main(int argc, char *argv[]) sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_NETFILTER); - if ((err = nfnl_exp_add(sock, exp, nlflags)) < 0) - nl_cli_fatal(err, "Unable to add expectation: %s", - nl_geterror(err)); - - if (!quiet) { - printf("Added "); - nl_object_dump(OBJ_CAST(exp), ¶ms); - } + if ((err = nfnl_exp_add(sock, exp, nlflags)) < 0) + nl_cli_fatal(err, "Unable to add expectation: %s", nl_geterror(err)); + if (!quiet) { + printf("Added "); + nl_object_dump(OBJ_CAST(exp), ¶ms); + } return 0; } diff --git a/src/nf-exp-delete.c b/src/nf-exp-delete.c index 1253945..2ec45ae 100644 --- a/src/nf-exp-delete.c +++ b/src/nf-exp-delete.c @@ -23,31 +23,31 @@ static void print_usage(void) "Usage: nf-exp-list [OPTION]... [CONNTRACK ENTRY]\n" "\n" "Options\n" - " --replace Replace the address if it exists.\n" - " -q, --quiet Do not print informal notifications.\n" + " --replace Replace the address if it exists.\n" + " -q, --quiet Do not print informal notifications.\n" " -h, --help Show this help\n" " -v, --version Show versioning information\n" "\n" "Expectation Selection\n" " -i, --id=NUM Identifier\n" - " --expect-proto=PROTOCOL Expectation protocol\n" + " --expect-proto=PROTOCOL Expectation protocol\n" " --expect-src=ADDR Expectation source address\n" " --expect-sport=PORT Expectation source port\n" " --expect-dst=ADDR Expectation destination address\n" " --expect-dport=PORT Expectation destination port\n" - " --master-proto=PROTOCOL Master conntrack protocol\n" + " --master-proto=PROTOCOL Master conntrack protocol\n" " --master-src=ADDR Master conntrack source address\n" " --master-sport=PORT Master conntrack source port\n" " --master-dst=ADDR Master conntrack destination address\n" " --master-dport=PORT Master conntrack destination port\n" - " --mask-proto=PROTOCOL Mask protocol\n" - " --mask-src=ADDR Mask source address\n" - " --mask-sport=PORT Mask source port\n" - " --mask-dst=ADDR Mask destination address\n" - " --mask-dport=PORT Mask destination port\n" + " --mask-proto=PROTOCOL Mask protocol\n" + " --mask-src=ADDR Mask source address\n" + " --mask-sport=PORT Mask source port\n" + " --mask-dst=ADDR Mask destination address\n" + " --mask-dport=PORT Mask destination port\n" " -F, --family=FAMILY Address family\n" " --timeout=NUM Timeout value\n" - " --helper=STRING Helper Name\n" + " --helper=STRING Helper Name\n" " --flags Flags\n" ); exit(0); @@ -75,22 +75,22 @@ int main(int argc, char *argv[]) ARG_EXPECT_SPORT, ARG_EXPECT_DST, ARG_EXPECT_DPORT, - ARG_MASTER_PROTO, + ARG_MASTER_PROTO, ARG_MASTER_SRC, ARG_MASTER_SPORT, ARG_MASTER_DST, ARG_MASTER_DPORT, - ARG_MASK_PROTO, - ARG_MASK_SRC, - ARG_MASK_SPORT, - ARG_MASK_DST, - ARG_MASK_DPORT, + ARG_MASK_PROTO, + ARG_MASK_SRC, + ARG_MASK_SPORT, + ARG_MASK_DST, + ARG_MASK_DPORT, ARG_TIMEOUT, - ARG_HELPER_NAME, + ARG_HELPER_NAME, ARG_FLAGS, }; static struct option long_opts[] = { - { "quiet", 0, 0, 'q' }, + { "quiet", 0, 0, 'q' }, { "help", 0, 0, 'h' }, { "version", 0, 0, 'v' }, { "id", 1, 0, 'i' }, @@ -99,20 +99,20 @@ int main(int argc, char *argv[]) { "expect-sport", 1, 0, ARG_EXPECT_SPORT }, { "expect-dst", 1, 0, ARG_EXPECT_DST }, { "expect-dport", 1, 0, ARG_EXPECT_DPORT }, - { "master-proto", 1, 0, ARG_MASTER_PROTO }, + { "master-proto", 1, 0, ARG_MASTER_PROTO }, { "master-src", 1, 0, ARG_MASTER_SRC }, { "master-sport", 1, 0, ARG_MASTER_SPORT }, { "master-dst", 1, 0, ARG_MASTER_DST }, { "master-dport", 1, 0, ARG_MASTER_DPORT }, - { "mask-proto", 1, 0, ARG_MASK_PROTO }, - { "mask-src", 1, 0, ARG_MASK_SRC }, - { "mask-sport", 1, 0, ARG_MASK_SPORT }, - { "mask-dst", 1, 0, ARG_MASK_DST }, - { "mask-dport", 1, 0, ARG_MASK_DPORT }, + { "mask-proto", 1, 0, ARG_MASK_PROTO }, + { "mask-src", 1, 0, ARG_MASK_SRC }, + { "mask-sport", 1, 0, ARG_MASK_SPORT }, + { "mask-dst", 1, 0, ARG_MASK_DST }, + { "mask-dport", 1, 0, ARG_MASK_DPORT }, { "family", 1, 0, 'F' }, { "timeout", 1, 0, ARG_TIMEOUT }, { "helper", 1, 0, ARG_HELPER_NAME }, - { "flags", 1, 0, ARG_FLAGS}, + { "flags", 1, 0, ARG_FLAGS}, { 0, 0, 0, 0 } }; @@ -122,8 +122,8 @@ int main(int argc, char *argv[]) switch (c) { case '?': exit(NLE_INVAL); - case 'q': quiet = 1; break; - case '4': nfnl_exp_set_family(exp, AF_INET); break; + case 'q': quiet = 1; break; + case '4': nfnl_exp_set_family(exp, AF_INET); break; case '6': nfnl_exp_set_family(exp, AF_INET6); break; case 'h': print_usage(); break; case 'v': nl_cli_print_version(); break; @@ -133,19 +133,19 @@ int main(int argc, char *argv[]) case ARG_EXPECT_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; case ARG_EXPECT_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; case ARG_EXPECT_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; - case ARG_MASTER_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; + case ARG_MASTER_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; - case ARG_MASK_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASK, optarg); break; - case ARG_MASK_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASK, optarg); break; + case ARG_MASK_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASK, optarg); break; case 'F': nl_cli_exp_parse_family(exp, optarg); break; case ARG_TIMEOUT: nl_cli_exp_parse_timeout(exp, optarg); break; - case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; + case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break; } } @@ -153,15 +153,13 @@ int main(int argc, char *argv[]) sock = nl_cli_alloc_socket(); nl_cli_connect(sock, NETLINK_NETFILTER); - if ((err = nfnl_exp_del(sock, exp, nlflags)) < 0) - nl_cli_fatal(err, "Unable to delete expectation: %s", - nl_geterror(err)); - - if (!quiet) { - printf("Deleted "); - nl_object_dump(OBJ_CAST(exp), ¶ms); - } + if ((err = nfnl_exp_del(sock, exp, nlflags)) < 0) + nl_cli_fatal(err, "Unable to delete expectation: %s", nl_geterror(err)); + if (!quiet) { + printf("Deleted "); + nl_object_dump(OBJ_CAST(exp), ¶ms); + } return 0; } diff --git a/src/nf-exp-list.c b/src/nf-exp-list.c index a447ba2..1c6ec69 100644 --- a/src/nf-exp-list.c +++ b/src/nf-exp-list.c @@ -27,19 +27,19 @@ static void print_usage(void) "\n" "Expectation Selection\n" " -i, --id=NUM Identifier\n" - " --expect-proto=PROTOCOL Expectation protocol\n" + " --expect-proto=PROTOCOL Expectation protocol\n" " --expect-src=ADDR Expectation source address\n" " --expect-sport=PORT Expectation source port\n" " --expect-dst=ADDR Expectation destination address\n" " --expect-dport=PORT Expectation destination port\n" - " --master-proto=PROTOCOL Master conntrack protocol\n" + " --master-proto=PROTOCOL Master conntrack protocol\n" " --master-src=ADDR Master conntrack source address\n" " --master-sport=PORT Master conntrack source port\n" " --master-dst=ADDR Master conntrack destination address\n" " --master-dport=PORT Master conntrack destination port\n" " -F, --family=FAMILY Address family\n" " --timeout=NUM Timeout value\n" - " --helper=STRING Helper Name\n" + " --helper=STRING Helper Name\n" //" --flags Flags\n" ); exit(0); @@ -67,14 +67,14 @@ int main(int argc, char *argv[]) ARG_EXPECT_SPORT, ARG_EXPECT_DST, ARG_EXPECT_DPORT, - ARG_MASTER_PROTO, + ARG_MASTER_PROTO, ARG_MASTER_SRC, ARG_MASTER_SPORT, ARG_MASTER_DST, ARG_MASTER_DPORT, ARG_TIMEOUT, - ARG_HELPER_NAME, - //ARG_FLAGS, + ARG_HELPER_NAME, + ARG_FLAGS, }; static struct option long_opts[] = { { "format", 1, 0, 'f' }, @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) { "expect-sport", 1, 0, ARG_EXPECT_SPORT }, { "expect-dst", 1, 0, ARG_EXPECT_DST }, { "expect-dport", 1, 0, ARG_EXPECT_DPORT }, - { "master-proto", 1, 0, ARG_MASTER_PROTO }, + { "master-proto", 1, 0, ARG_MASTER_PROTO }, { "master-src", 1, 0, ARG_MASTER_SRC }, { "master-sport", 1, 0, ARG_MASTER_SPORT }, { "master-dst", 1, 0, ARG_MASTER_DST }, @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) { "family", 1, 0, 'F' }, { "timeout", 1, 0, ARG_TIMEOUT }, { "helper", 1, 0, ARG_HELPER_NAME }, - //{ "flags", 1, 0, ARG_FLAGS}, + { "flags", 1, 0, ARG_FLAGS}, { 0, 0, 0, 0 } }; @@ -115,15 +115,15 @@ int main(int argc, char *argv[]) case ARG_EXPECT_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; case ARG_EXPECT_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; case ARG_EXPECT_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_EXPECT, optarg); break; - case ARG_MASTER_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; + case ARG_MASTER_PROTO: nl_cli_exp_parse_l4protonum(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_SRC: nl_cli_exp_parse_src(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_SPORT: nl_cli_exp_parse_src_port(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_DST: nl_cli_exp_parse_dst(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case ARG_MASTER_DPORT: nl_cli_exp_parse_dst_port(exp, NFNL_EXP_TUPLE_MASTER, optarg); break; case 'F': nl_cli_exp_parse_family(exp, optarg); break; case ARG_TIMEOUT: nl_cli_exp_parse_timeout(exp, optarg); break; - case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; - //case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break; + case ARG_HELPER_NAME: nl_cli_exp_parse_helper_name(exp, optarg); break; + case ARG_FLAGS: nl_cli_exp_parse_flags(exp, optarg); break; } } |