From b5366b375228c1e7041ba52e469f099f0d0f1a61 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Wed, 26 May 2010 13:49:12 -0700 Subject: fix for multiple type support in cli for the following case: 1) If multiple types are defined and one type is a submatch of the other type (i.e. ipv4 and ipv4net) 2) And one string is a submatch of the other (i.e. 3.3.3.3 and 3.3.3.3/32) 3) Then compare data types before comparing for value equality Fixes problem where the ipv4net wouldn't let the ipv4 value from being set if the ipv4 was a substring of the ipv4net. --- src/cli_new.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cli_new.c b/src/cli_new.c index c4d1b86..b2d6e1d 100644 --- a/src/cli_new.c +++ b/src/cli_new.c @@ -926,7 +926,15 @@ boolean val_cmp(const valstruct *left, const valstruct *right, vtw_cond_e cond) rval = right->val; else rval = right->vals[rcur]; - + + //don't bother comparing if these are different types. + if ((rcur || right->cnt) + && right->val_types[rcur] != NULL) { + if (right->val_types[rcur] != val_type) { + continue; + } + } + parts_num = 0; switch (val_type) { case IPV6_TYPE: -- cgit v1.2.3