...
|
...
|
@@ -412,7 +412,7 @@ static inline int32_t spec_iter(const struct char_spec *spec)
|
412
|
412
|
{
|
413
|
413
|
unsigned count;
|
414
|
414
|
assert(spec->step);
|
415
|
|
- count = (1 + spec->end - spec->start)/spec->step;
|
|
415
|
+ count = (spec->step + spec->end - spec->start)/spec->step;
|
416
|
416
|
if (spec->negative) /* all chars except itself are added */
|
417
|
417
|
count *= 254;
|
418
|
418
|
return count;
|
...
|
...
|
@@ -440,7 +440,7 @@ int filter_add_acpatt(struct filter *m, const struct cli_ac_patt *pat)
|
440
|
440
|
j = MIN(prefix_len + pat->length[0], MAXPATLEN);
|
441
|
441
|
for(i=0;i<j;i++) {
|
442
|
442
|
const uint16_t p = i < prefix_len ? pat->prefix[i] : pat->pattern[i - prefix_len];
|
443
|
|
- if ((p&CLI_MATCH_WILDCARD) != CLI_MATCH_CHAR)
|
|
443
|
+ if ((p&CLI_MATCH_METADATA) != CLI_MATCH_CHAR)
|
444
|
444
|
break;
|
445
|
445
|
patc[i] = (uint8_t)p;
|
446
|
446
|
}
|
...
|
...
|
@@ -452,7 +452,7 @@ int filter_add_acpatt(struct filter *m, const struct cli_ac_patt *pat)
|
452
|
452
|
cli_perf_log_count(TRIE_ORIG_LEN, j > 8 ? 8 : j);
|
453
|
453
|
i = 0;
|
454
|
454
|
if (!prefix_len) {
|
455
|
|
- while ((pat->pattern[i] & CLI_MATCH_WILDCARD) == CLI_MATCH_SPECIAL) {
|
|
455
|
+ while ((pat->pattern[i] & CLI_MATCH_METADATA) == CLI_MATCH_SPECIAL) {
|
456
|
456
|
/* we support only ALT_CHAR, skip the rest */
|
457
|
457
|
if (pat->special_table[altcnt]->type == 1)
|
458
|
458
|
break;
|
...
|
...
|
@@ -466,11 +466,27 @@ int filter_add_acpatt(struct filter *m, const struct cli_ac_patt *pat)
|
466
|
466
|
const uint16_t p = i < prefix_len ? pat->prefix[i] : pat->pattern[i - prefix_len];
|
467
|
467
|
spec->alt = NULL;
|
468
|
468
|
spec->negative = 0;
|
469
|
|
- switch (p & CLI_MATCH_WILDCARD) {
|
|
469
|
+ switch (p & CLI_MATCH_METADATA) {
|
470
|
470
|
case CLI_MATCH_CHAR:
|
471
|
471
|
spec->start = spec->end = (uint8_t)p;
|
472
|
472
|
spec->step = 1;
|
473
|
473
|
break;
|
|
474
|
+ case CLI_MATCH_NOCASE:
|
|
475
|
+ if ((uint8_t)p >= 'a' && (uint8_t)p <= 'z') {
|
|
476
|
+ spec->start = (uint8_t)p - ('a' - 'A');
|
|
477
|
+ spec->end = (uint8_t)p;
|
|
478
|
+ spec->step = ('a' - 'A');
|
|
479
|
+ }
|
|
480
|
+ else if ((uint8_t)p >= 'A' && (uint8_t)p <= 'Z') {
|
|
481
|
+ spec->start = (uint8_t)p;
|
|
482
|
+ spec->end = (uint8_t)p + ('a' - 'A');
|
|
483
|
+ spec->step = ('a' - 'A');
|
|
484
|
+ }
|
|
485
|
+ else {
|
|
486
|
+ spec->start = spec->end = (uint8_t)p;
|
|
487
|
+ spec->step = 1;
|
|
488
|
+ }
|
|
489
|
+ break;
|
474
|
490
|
case CLI_MATCH_IGNORE:
|
475
|
491
|
spec->start = 0x00;
|
476
|
492
|
spec->end = 0xff;
|