Mercurial > hg > dhcpcd
comparison src/script.c @ 5577:4da45107d87a draft
script: Use rt_proto_add to ensure no duplicate interfaces on OpenBSD
OpenBSD allows matching priorities, so we need to take the interfaces
in the order given to ensure uniqueness.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Mon, 18 Jan 2021 11:31:05 +0000 |
| parents | 465cc5abc6d6 |
| children |
comparison
equal
deleted
inserted
replaced
| 5576:34d5feec8274 | 5577:4da45107d87a |
|---|---|
| 388 goto eexit; | 388 goto eexit; |
| 389 } | 389 } |
| 390 if (ifp->ctx->options & DHCPCD_DUMPLEASE) | 390 if (ifp->ctx->options & DHCPCD_DUMPLEASE) |
| 391 goto dumplease; | 391 goto dumplease; |
| 392 | 392 |
| 393 ifp->ctx->rt_order = 0; | |
| 393 rb_tree_init(&ifaces, &rt_compare_proto_ops); | 394 rb_tree_init(&ifaces, &rt_compare_proto_ops); |
| 394 TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) { | 395 TAILQ_FOREACH(ifp2, ifp->ctx->ifaces, next) { |
| 395 if (!ifp2->active) | 396 if (!ifp2->active) |
| 396 continue; | 397 continue; |
| 397 rt = rt_new(UNCONST(ifp2)); | 398 rt = rt_new(UNCONST(ifp2)); |
| 398 if (rt == NULL) | 399 if (rt == NULL) |
| 399 goto eexit; | 400 goto eexit; |
| 400 if (rb_tree_insert_node(&ifaces, rt) != rt) | 401 if (rt_proto_add(&ifaces, rt) != rt) |
| 401 goto eexit; | 402 goto eexit; |
| 402 } | 403 } |
| 403 if (fprintf(fp, "interface_order=") == -1) | 404 if (fprintf(fp, "interface_order=") == -1) |
| 404 goto eexit; | 405 goto eexit; |
| 405 RB_TREE_FOREACH(rt, &ifaces) { | 406 RB_TREE_FOREACH(rt, &ifaces) { |
