summaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-02-03 14:04:42 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2014-02-03 18:43:13 +0100
commit29fd6a1df9f6c80d155a7a73b8514a68dc9cd22d (patch)
tree9dc15a3e19a6ff36ae9ee3d38c7b8190b73f0a72 /src/utils.c
parent16871a3615edcf358d688a8d079b1e7b20053fb1 (diff)
parent076fd1e66e7f1bc3b2bd91f3efb84080da26fb9c (diff)
Merge branch 'master' into next-3.14
This patch includes changes to adapt this branch to the library rename that happened in the master branch. Conflicts: src/Makefile.am src/expr/cmp.c src/expr/ct.c src/expr/data_reg.c src/expr/meta.c tests/jsonfiles/01-table.json tests/jsonfiles/02-table.json tests/jsonfiles/64-ruleset.json tests/xmlfiles/01-table.xml tests/xmlfiles/02-table.xml
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/utils.c b/src/utils.c
index 6fd8e03..9691c4c 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -158,18 +158,24 @@ const char *nft_verdict2str(uint32_t verdict)
}
}
-int nft_str2verdict(const char *verdict)
+int nft_str2verdict(const char *verdict, int *verdict_num)
{
- if (strcmp(verdict, "accept") == 0)
- return NF_ACCEPT;
- else if (strcmp(verdict, "drop") == 0)
- return NF_DROP;
- else if (strcmp(verdict, "return") == 0)
- return NFT_RETURN;
- else if (strcmp(verdict, "jump") == 0)
- return NFT_JUMP;
- else if (strcmp(verdict, "goto") == 0)
- return NFT_GOTO;
+ if (strcmp(verdict, "accept") == 0) {
+ *verdict_num = NF_ACCEPT;
+ return 0;
+ } else if (strcmp(verdict, "drop") == 0) {
+ *verdict_num = NF_DROP;
+ return 0;
+ } else if (strcmp(verdict, "return") == 0) {
+ *verdict_num = NFT_RETURN;
+ return 0;
+ } else if (strcmp(verdict, "jump") == 0) {
+ *verdict_num = NFT_JUMP;
+ return 0;
+ } else if (strcmp(verdict, "goto") == 0) {
+ *verdict_num = NFT_GOTO;
+ return 0;
+ }
return -1;
}