Commit c2f8f14
nexthop: generalize reference removal
When a nexthop is destroyed, other nexthops may hold references to it.
Previously, nexthop_destroy() had hardcoded logic to remove the deleted
nexthop from group members. This does not scale as more nexthop types
with cross-references are added.
Introduce a remove_references callback in nexthop_type_ops. When
destroying a nexthop, iterate through all registered types and invoke
their callback if present. Move the L3 hash key removal from free to
remove_references. Implement the callback for group nexthops to remove
deleted members and for DNAT nexthops to clean up SNAT policies.
Signed-off-by: Robin Jarry <rjarry@redhat.com>
Reviewed-by: Christophe Fontaine <cfontain@redhat.com>1 parent 4a07bf6 commit c2f8f14
File tree
5 files changed
+56
-39
lines changed- modules
- infra/control
- policy/api
5 files changed
+56
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
25 | 43 | | |
26 | 44 | | |
27 | 45 | | |
| |||
174 | 192 | | |
175 | 193 | | |
176 | 194 | | |
| 195 | + | |
177 | 196 | | |
178 | 197 | | |
179 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
133 | 145 | | |
134 | 146 | | |
135 | 147 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
| |||
258 | 264 | | |
259 | 265 | | |
260 | 266 | | |
| 267 | + | |
261 | 268 | | |
262 | 269 | | |
263 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | 441 | | |
464 | 442 | | |
465 | 443 | | |
| |||
480 | 458 | | |
481 | 459 | | |
482 | 460 | | |
| 461 | + | |
| 462 | + | |
483 | 463 | | |
484 | 464 | | |
485 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
486 | 470 | | |
| 471 | + | |
487 | 472 | | |
488 | 473 | | |
489 | 474 | | |
| |||
494 | 479 | | |
495 | 480 | | |
496 | 481 | | |
497 | | - | |
| 482 | + | |
498 | 483 | | |
499 | 484 | | |
500 | 485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
34 | 44 | | |
35 | 45 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
240 | 244 | | |
241 | 245 | | |
242 | 246 | | |
| 247 | + | |
243 | 248 | | |
244 | 249 | | |
245 | 250 | | |
| |||
0 commit comments