[PATCH 2/6] nf: nfnl_*_str2copy_mode() should return int
Thomas Graf
tgraf at suug.ch
Mon Aug 25 16:09:08 PDT 2014
... to be able to return a negative error code for unknown modes.
Signed-off-by: Thomas Graf <tgraf at suug.ch>
---
include/netlink/netfilter/log.h | 2 +-
include/netlink/netfilter/queue.h | 2 +-
lib/netfilter/log_obj.c | 2 +-
lib/netfilter/queue_obj.c | 2 +-
src/nf-log.c | 2 +-
src/nf-queue.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/netlink/netfilter/log.h b/include/netlink/netfilter/log.h
index 2002fa8..e48eddf 100644
--- a/include/netlink/netfilter/log.h
+++ b/include/netlink/netfilter/log.h
@@ -58,7 +58,7 @@ extern enum nfnl_log_copy_mode nfnl_log_get_copy_mode(const struct nfnl_log *);
extern char * nfnl_log_copy_mode2str(enum nfnl_log_copy_mode,
char *, size_t);
-extern enum nfnl_log_copy_mode nfnl_log_str2copy_mode(const char *);
+extern int nfnl_log_str2copy_mode(const char *);
extern void nfnl_log_set_copy_range(struct nfnl_log *, uint32_t);
extern int nfnl_log_test_copy_range(const struct nfnl_log *);
diff --git a/include/netlink/netfilter/queue.h b/include/netlink/netfilter/queue.h
index 664610d..224d469 100644
--- a/include/netlink/netfilter/queue.h
+++ b/include/netlink/netfilter/queue.h
@@ -54,7 +54,7 @@ extern enum nfnl_queue_copy_mode nfnl_queue_get_copy_mode(const struct nfnl_queu
extern char * nfnl_queue_copy_mode2str(enum nfnl_queue_copy_mode,
char *, size_t);
-extern enum nfnl_queue_copy_mode nfnl_queue_str2copy_mode(const char *);
+extern int nfnl_queue_str2copy_mode(const char *);
extern void nfnl_queue_set_copy_range(struct nfnl_queue *,
uint32_t);
diff --git a/lib/netfilter/log_obj.c b/lib/netfilter/log_obj.c
index 5e1bf9e..3fdb347 100644
--- a/lib/netfilter/log_obj.c
+++ b/lib/netfilter/log_obj.c
@@ -69,7 +69,7 @@ char *nfnl_log_copy_mode2str(enum nfnl_log_copy_mode copy_mode, char *buf,
ARRAY_SIZE(copy_modes));
}
-enum nfnl_log_copy_mode nfnl_log_str2copy_mode(const char *name)
+int nfnl_log_str2copy_mode(const char *name)
{
return __str2type(name, copy_modes, ARRAY_SIZE(copy_modes));
}
diff --git a/lib/netfilter/queue_obj.c b/lib/netfilter/queue_obj.c
index b51f5ec..36ed3c5 100644
--- a/lib/netfilter/queue_obj.c
+++ b/lib/netfilter/queue_obj.c
@@ -65,7 +65,7 @@ char *nfnl_queue_copy_mode2str(enum nfnl_queue_copy_mode copy_mode, char *buf,
ARRAY_SIZE(copy_modes));
}
-enum nfnl_queue_copy_mode nfnl_queue_str2copy_mode(const char *name)
+int nfnl_queue_str2copy_mode(const char *name)
{
return __str2type(name, copy_modes, ARRAY_SIZE(copy_modes));
}
diff --git a/src/nf-log.c b/src/nf-log.c
index 913ba16..c0cffe0 100644
--- a/src/nf-log.c
+++ b/src/nf-log.c
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
struct nl_sock *rt_sock;
struct nl_cache *link_cache;
struct nfnl_log *log;
- enum nfnl_log_copy_mode copy_mode;
+ int copy_mode;
uint32_t copy_range;
int err;
int family;
diff --git a/src/nf-queue.c b/src/nf-queue.c
index 922d9c8..7151381 100644
--- a/src/nf-queue.c
+++ b/src/nf-queue.c
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
struct nl_sock *rt_sock;
struct nl_cache *link_cache;
struct nfnl_queue *queue;
- enum nfnl_queue_copy_mode copy_mode;
+ int copy_mode;
uint32_t copy_range;
int err = 1;
int family;
--
1.9.3
More information about the libnl
mailing list