- for (c=st->clients; c; c=c->next) {
- for (j=0; j<c->networks.entries; j++) {
- st->routes[i].net=c->networks.list[j];
- st->routes[i].c=c;
- /* Hard routes are always up;
- soft routes default to down; routes with no 'deliver' function
- default to down */
- st->routes[i].up=c->deliver?
- (c->options&OPT_SOFTROUTE?False:True):
- False;
- st->routes[i].kup=False;
- st->routes[i].hard=c->options&OPT_SOFTROUTE?False:True;
- st->routes[i].allow_route=c->options&OPT_ALLOWROUTE?
- True:False;
- st->routes[i].quality=c->link_quality;
- st->routes[i].outcount=0;
- i++;
- }
- }
- /* ASSERT i==st->n_routes */
- if (i!=st->n_routes) {
- fatal("netlink: route count error: expected %d got %d\n",
- st->n_routes,i);
- }
- /* Sort the table in descending order of specificity */
- qsort(st->routes,st->n_routes,sizeof(*st->routes),
- netlink_compare_route_specificity);
+ for (c=st->clients; c; c=c->next)
+ st->routes[i++]=c;
+ /* Sort the table in descending order of priority */
+ qsort(st->routes,st->n_clients,sizeof(*st->routes),
+ netlink_compare_client_priority);