Commit 7e1e688
Kevin Wang
feat(netd): report what netd implements and what it still holds
netd creates persistent TAPs, so an interface outlives the QEMU that used
it. A VMM that died between creating one and recording it leaves an
interface nothing can name again: `check` and `remove` both answer about
an identity, and the identity is exactly what was lost. Nothing could
enumerate them, so the leak was invisible until someone went looking at
`ip link`.
Add `list` and `remove_tap` to close that, and run them from the VMM at
startup next to the cleanup it already does for orphaned supervisor
processes. Listing is scoped to an instance namespace: one host runs
several VMMs against one netd, and a caller reconciling its own VMs must
not mistake another's interfaces for orphans. netd records the namespace
in the TAP's `ifalias` rather than in a state file, so a crash leaves
nothing to repair, and records only the namespace because IFALIAS_MAX is
255 bytes while two 128-byte identifiers are not -- a caller derives every
TAP name it owns anyway. Reconciliation over-approximates which TAPs are
still wanted, since keeping a leak is the cheaper mistake than deleting a
live interface out from under a running QEMU.
`remove_tap` is the one operation that names an interface instead of an
identity, because the identity is what the caller no longer has. The name
must be one `tap_name` could have produced, so it reaches nothing netd did
not create.
Add `hello` alongside it. Support has so far been detected by a field's
own absence from a response -- `queues` is documented that way -- which
works once per field, only for fields that are echoed back, and says
nothing until something has already failed. netd ships as its own package
on its own release cadence and a host may run an implementation that is
not this one, so version skew is the normal case; asking once at startup
beats inferring repeatedly. A netd that predates the operation rejects it,
and that rejection is the answer rather than an error.
Add `workdir` to both prepare operations. It is untrusted and never read
for a decision, and exists so an operator reading netd's log can get from
an opaque TAP name back to the VM that asked for it.1 parent 1aa1d35 commit 7e1e688
3 files changed
Lines changed: 532 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
107 | 153 | | |
108 | 154 | | |
109 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
317 | 323 | | |
318 | 324 | | |
319 | 325 | | |
| |||
564 | 570 | | |
565 | 571 | | |
566 | 572 | | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
567 | 580 | | |
568 | 581 | | |
569 | 582 | | |
| |||
593 | 606 | | |
594 | 607 | | |
595 | 608 | | |
| 609 | + | |
596 | 610 | | |
597 | 611 | | |
598 | 612 | | |
| |||
601 | 615 | | |
602 | 616 | | |
603 | 617 | | |
| 618 | + | |
604 | 619 | | |
605 | 620 | | |
606 | 621 | | |
| |||
1067 | 1082 | | |
1068 | 1083 | | |
1069 | 1084 | | |
| 1085 | + | |
| 1086 | + | |
1070 | 1087 | | |
1071 | 1088 | | |
1072 | 1089 | | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
1073 | 1154 | | |
1074 | 1155 | | |
1075 | 1156 | | |
| |||
0 commit comments