[PATCH nft] segtree: set proper error cause on existing elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adding new elements result in a confusing "Success" error message.

 # nft add element x y { 0-3 }
 Error: interval overlaps with an existing one
 add element x y { 0-3 }
                   ^^^
 Error: Could not process rule: Success
 add element x y { 0-3 }
 ^^^^^^^^^^^^^^^^^^^^^^^^

Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
 src/segtree.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/segtree.c b/src/segtree.c
index 4ee09884cbde..5685618b3724 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -270,6 +270,7 @@ static int ei_insert(struct list_head *msgs, struct seg_tree *tree,
 
 	return 0;
 err:
+	errno = EEXIST;
 	return expr_binary_error(msgs, lei->expr, new->expr,
 				 "conflicting intervals specified");
 }
@@ -371,6 +372,7 @@ static int set_overlap(struct list_head *msgs, const struct set *set,
 
 			expr_error(msgs, new_intervals[i]->expr,
 				   "interval overlaps with an existing one");
+			errno = EEXIST;
 			ret = -1;
 			goto out;
 		}
-- 
2.11.0




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux