Commit 057e35d
committed
libnetwork/d/overlay: ref-count encryption params
The IPsec encryption parameters (Security Association Database and
Security Policy Database entries) for a particular overlay network peer
(VTEP) are shared global state as they have to be programmed into the
root network namespace. The same parameters are used when encrypting
VXLAN traffic to a particular VTEP for all overlay networks. Deleting
the entries for a VTEP will break encryption to that VTEP across all
encrypted overlay networks, therefore the decision of when to delete the
entries must take the state of all overlay networks into account.
Unfortunately this is not the case.
The overlay driver uses local per-network state to decide when to
program and delete the parameters for a VTEP. In practice, the
parameters for all VTEPs participating in an encrypted overlay network
are deleted when the network is deleted. Encryption to that VTEP over
all other active encrypted overlay networks would be broken until some
other incidental peerDB event triggered a re-programming of the
parameters for that VTEP.
Change the setupEncryption and removeEncryption functions to be
reference-counted. The removeEncryption function needs to be called the
same number of times as addEncryption before the parameters are deleted
from the kernel.
Signed-off-by: Cory Snider <[email protected]>1 parent 1c2b744 commit 057e35d
3 files changed
Lines changed: 38 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
94 | 99 | | |
95 | | - | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
| |||
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
108 | | - | |
| 113 | + | |
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
| |||
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
129 | | - | |
| 134 | + | |
130 | 135 | | |
131 | 136 | | |
132 | | - | |
| 137 | + | |
133 | 138 | | |
134 | 139 | | |
135 | 140 | | |
| |||
149 | 154 | | |
150 | 155 | | |
151 | 156 | | |
152 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
153 | 161 | | |
154 | 162 | | |
155 | 163 | | |
| |||
158 | 166 | | |
159 | 167 | | |
160 | 168 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
165 | 179 | | |
166 | | - | |
167 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
168 | 183 | | |
169 | 184 | | |
170 | 185 | | |
| |||
263 | 278 | | |
264 | 279 | | |
265 | 280 | | |
266 | | - | |
| 281 | + | |
267 | 282 | | |
268 | 283 | | |
269 | 284 | | |
| |||
436 | 451 | | |
437 | 452 | | |
438 | 453 | | |
439 | | - | |
| 454 | + | |
440 | 455 | | |
441 | | - | |
442 | | - | |
| 456 | + | |
| 457 | + | |
443 | 458 | | |
444 | | - | |
| 459 | + | |
445 | 460 | | |
446 | 461 | | |
447 | 462 | | |
| |||
457 | 472 | | |
458 | 473 | | |
459 | 474 | | |
460 | | - | |
| 475 | + | |
461 | 476 | | |
462 | 477 | | |
463 | 478 | | |
| |||
506 | 521 | | |
507 | 522 | | |
508 | 523 | | |
509 | | - | |
| 524 | + | |
510 | 525 | | |
511 | 526 | | |
512 | 527 | | |
| |||
534 | 549 | | |
535 | 550 | | |
536 | 551 | | |
537 | | - | |
| 552 | + | |
538 | 553 | | |
539 | 554 | | |
540 | 555 | | |
541 | 556 | | |
542 | 557 | | |
543 | 558 | | |
544 | 559 | | |
545 | | - | |
| 560 | + | |
546 | 561 | | |
547 | 562 | | |
548 | 563 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
310 | | - | |
| 310 | + | |
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
| |||
0 commit comments