return table_not_found(ctx);
existing_set = set_cache_find(table, set->handle.set.name);
- if (!existing_set)
- set_cache_add(set_get(set), table);
+ if (existing_set) {
+ if (existing_set->flags & NFT_SET_EVAL) {
+ uint32_t existing_flags = existing_set->flags & ~NFT_SET_EVAL;
+ uint32_t new_flags = set->flags & ~NFT_SET_EVAL;
- if (existing_set && existing_set->flags & NFT_SET_EVAL) {
- uint32_t existing_flags = existing_set->flags & ~NFT_SET_EVAL;
- uint32_t new_flags = set->flags & ~NFT_SET_EVAL;
+ if (existing_flags == new_flags)
+ set->flags |= NFT_SET_EVAL;
+ }
- if (existing_flags == new_flags)
- set->flags |= NFT_SET_EVAL;
+ if (set_is_interval(set->flags) && !set_is_interval(existing_set->flags))
+ return set_error(ctx, set, "existing %s lacks interval flag", type);
+ } else {
+ set_cache_add(set_get(set), table);
}
}
--- /dev/null
+table ip x {
+ map y {
+ type ipv4_addr : ipv4_addr
+ elements = { 1.168.0.4 }
+ }
+
+ map y {
+ type ipv4_addr : ipv4_addr
+ flags interval
+ elements = { 10.141.3.0/24 : 192.8.0.3 }
+ }
+}