Hi Lucas, On 4/2/25 3:46 PM, Lucas Vargas Dias (Dev - Cloud IaaS Network R&D) wrote: >>> +bool >>> +find_prefix_in_list(const struct in6_addr *prefix, unsigned int plen, >>> + const char *prefix_list, const char *filter_name) >>> +{ >>> + struct in6_addr bl_prefix; >>> + char *cur, *next, *start; >>> + unsigned int bl_plen; >>> + bool matched = false; >>> + next = start = xstrdup(prefix_list); >>> + while ((cur = strsep(&next, ",")) && *cur) { >> Nit: now that you're refactoring this it might be time to get rid of the >> xstrdup/strsep custom parsing and maybe use a library function. Could >> we make find_prefix_in_list() receive the prefix list as a 'const struct >> sset *prefixes' argument. We could pre-parse the set of prefixes and >> build that only once for each router/router port. >> >> We have the sset_from_delimited_string() function in the OVS libraries. >> >> Would that be cleaner? >> > I agree about use struct sset. > I didn't understand about construct only once > because the configuration of parameters could be dynamic > as well the routes to be learned or advertised. > > My idea is something like the following code: > > struct sset prefix_list = SSET_INITIALIZER(&prefix_list); > sset_from_delimited_string(&prefix_list, ds_cstr(&filter_list), ","); > > bool matched = find_prefix_in_list(prefix, plen, &prefix_list, > filter_direction);
Ah I had missed the fact that we build the prefix list for a router port by extending the prefix list of the router it is part of. I guess your suggestion is fine (we also need to destroy the sset afterwards though). Thanks, Dumitru _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev