summaryrefslogtreecommitdiffstats
path: root/iptables.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2009-02-01 22:33:37 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2009-02-01 22:33:37 +0100
commit212092173b63be8532d95241bbd86db96e110220 (patch)
treec57b51123dff0917902b89070d007145d453c26c /iptables.c
parentc6132022905b10ac70223e8116f3903ea0039e75 (diff)
libxtables: prefix names and order #3
This change affects: find_{match,target} -> xtables_find_{match,target} enum xt_tryload -> enum xtables_tryload loose flags like DONT_LOAD -> XTF_DONT_LOAD Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables.c')
-rw-r--r--iptables.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/iptables.c b/iptables.c
index 61e7aaba..7b8d2391 100644
--- a/iptables.c
+++ b/iptables.c
@@ -483,7 +483,8 @@ check_inverse(const char option[], int *invert, int *my_optind, int argc)
/* Christophe Burki wants `-p 6' to imply `-m tcp'. */
static struct xtables_match *
-find_proto(const char *pname, enum ipt_tryload tryload, int nolookup, struct iptables_rule_match **matches)
+find_proto(const char *pname, enum xtables_tryload tryload,
+ int nolookup, struct iptables_rule_match **matches)
{
unsigned int proto;
@@ -491,9 +492,9 @@ find_proto(const char *pname, enum ipt_tryload tryload, int nolookup, struct ipt
char *protoname = proto_to_name(proto, nolookup);
if (protoname)
- return find_match(protoname, tryload, matches);
+ return xtables_find_match(protoname, tryload, matches);
} else
- return find_match(pname, tryload, matches);
+ return xtables_find_match(pname, tryload, matches);
return NULL;
}
@@ -701,7 +702,8 @@ print_match(const struct ipt_entry_match *m,
const struct ipt_ip *ip,
int numeric)
{
- struct xtables_match *match = find_match(m->u.user.name, TRY_LOAD, NULL);
+ struct xtables_match *match =
+ xtables_find_match(m->u.user.name, XTF_TRY_LOAD, NULL);
if (match) {
if (match->print)
@@ -730,9 +732,10 @@ print_firewall(const struct ipt_entry *fw,
char buf[BUFSIZ];
if (!iptc_is_chain(targname, handle))
- target = find_target(targname, TRY_LOAD);
+ target = xtables_find_target(targname, XTF_TRY_LOAD);
else
- target = find_target(IPT_STANDARD_TARGET, LOAD_MUST_SUCCEED);
+ target = xtables_find_target(IPT_STANDARD_TARGET,
+ XTF_LOAD_MUST_SUCCEED);
t = ipt_get_target((struct ipt_entry *)fw);
flags = fw->ip.flags;
@@ -1174,8 +1177,8 @@ print_iface(char letter, const char *iface, const unsigned char *mask,
static int print_match_save(const struct ipt_entry_match *e,
const struct ipt_ip *ip)
{
- struct xtables_match *match
- = find_match(e->u.user.name, TRY_LOAD, NULL);
+ struct xtables_match *match =
+ xtables_find_match(e->u.user.name, XTF_TRY_LOAD, NULL);
if (match) {
printf("-m %s ", e->u.user.name);
@@ -1278,8 +1281,8 @@ void print_rule(const struct ipt_entry *e,
/* Print targinfo part */
t = ipt_get_target((struct ipt_entry *)e);
if (t->u.user.name[0]) {
- struct xtables_target *target
- = find_target(t->u.user.name, TRY_LOAD);
+ struct xtables_target *target =
+ xtables_find_target(t->u.user.name, XTF_TRY_LOAD);
if (!target) {
fprintf(stderr, "Can't find library for target `%s'\n",
@@ -1568,7 +1571,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
exit_error(PARAMETER_PROBLEM,
"chain name not allowed to start "
"with `%c'\n", *optarg);
- if (find_target(optarg, TRY_LOAD))
+ if (xtables_find_target(optarg, XTF_TRY_LOAD))
exit_error(PARAMETER_PROBLEM,
"chain name may not clash "
"with target name\n");
@@ -1619,7 +1622,8 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
/* iptables -p icmp -h */
if (!matches && protocol)
- find_match(protocol, TRY_LOAD, &matches);
+ xtables_find_match(protocol,
+ XTF_TRY_LOAD, &matches);
exit_printhelp(matches);
@@ -1672,7 +1676,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
invert);
jumpto = parse_target(optarg);
/* TRY_LOAD (may be chain name) */
- target = find_target(jumpto, TRY_LOAD);
+ target = xtables_find_target(jumpto, XTF_TRY_LOAD);
if (target) {
size_t size;
@@ -1735,7 +1739,8 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
exit_error(PARAMETER_PROBLEM,
"unexpected ! flag before --match");
- m = find_match(optarg, LOAD_MUST_SUCCEED, &matches);
+ m = xtables_find_match(optarg, XTF_LOAD_MUST_SUCCEED,
+ &matches);
size = IPT_ALIGN(sizeof(struct ipt_entry_match))
+ m->size;
m->m = xtables_calloc(1, size);
@@ -1876,13 +1881,13 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
*/
if (m == NULL
&& protocol
- && (!find_proto(protocol, DONT_LOAD,
+ && (!find_proto(protocol, XTF_DONT_LOAD,
options&OPT_NUMERIC, NULL)
- || (find_proto(protocol, DONT_LOAD,
+ || (find_proto(protocol, XTF_DONT_LOAD,
options&OPT_NUMERIC, NULL)
&& (proto_used == 0))
)
- && (m = find_proto(protocol, TRY_LOAD,
+ && (m = find_proto(protocol, XTF_TRY_LOAD,
options&OPT_NUMERIC, &matches))) {
/* Try loading protocol */
size_t size;
@@ -2047,8 +2052,8 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
|| iptc_is_chain(jumpto, *handle))) {
size_t size;
- target = find_target(IPT_STANDARD_TARGET,
- LOAD_MUST_SUCCEED);
+ target = xtables_find_target(IPT_STANDARD_TARGET,
+ XTF_LOAD_MUST_SUCCEED);
size = sizeof(struct ipt_entry_target)
+ target->size;
@@ -2072,7 +2077,7 @@ int do_command(int argc, char *argv[], char **table, struct iptc_handle **handle
exit_error(PARAMETER_PROBLEM,
"goto '%s' is not a chain\n", jumpto);
#endif
- find_target(jumpto, LOAD_MUST_SUCCEED);
+ xtables_find_target(jumpto, XTF_LOAD_MUST_SUCCEED);
} else {
e = generate_entry(&fw, matches, target->t);
free(target->t);