Henry Fernandes writes:
But we didn¹t want to add hundreds of thousands or millions of extra rules just to deal with this problem. We didn¹t consider that a good workaround.
OK, I got it. Now priorities choose from equally long prefixes instead of all matching prefixes. I'll take a look at the code to check if the latter could be easily added as an option.
-- Juha
Juha Heinanen writes:
OK, I got it. Now priorities choose from equally long prefixes instead of all matching prefixes. I'll take a look at the code to check if the latter could be easily added as an option.
looks like the change would be very easy. only comp_matched function would need to be rewritten and prefix length would play no role in comparison.
if someone later would like to have this option implemented, i'll include new version of comp_matched function below for the records.
-- juha
/* * Compare matched gateways based on priority, and randomized weight. */ static int comp_matched(const void *m1, const void *m2) { struct matched_gw_info *mi1 = (struct matched_gw_info *) m1; struct matched_gw_info *mi2 = (struct matched_gw_info *) m2;
/* Sort by priority */ if (mi1->priority < mi2->priority) return 1; if (mi1->priority == mi2->priority) { /* Sort by randomized weigth */ if (mi1->weight > mi2->weight) return 1; if (mi1->weight == mi2->weight) return 0; return -1; } return -1; }