Commit 2cb245d
committed
SetRecords: preserve RRSets not set in the input
According to the libdns specification for SetRecords [1]:
> SetRecords updates the zone so that the records described in the input
> are reflected in the output. It may create or update records
> or—depending on the record type—delete records to maintain parity with
> the input. No other records are affected. It returns the records which
> were set.
>
> For any (name, type) pair in the input, SetRecords ensures that the
> only records in the output zone with that (name, type) pair are those
> that were provided in the input.
From this description, especially the "No other records are affected"
part, I believe that RRSets which are not mentioned in the input should
not be modified or deleted by SetRecords.
This is also made clear by one of the examples.
Note that the TXT record is preserved:
> Example 1:
>
> ;; Original zone
> example.com. 3600 IN A 192.0.2.1
> example.com. 3600 IN A 192.0.2.2
> example.com. 3600 IN TXT "hello world"
>
> ;; Input
> example.com. 3600 IN A 192.0.2.3
>
> ;; Resultant zone
> example.com. 3600 IN A 192.0.2.3
> example.com. 3600 IN TXT "hello world"
The current implementation of SetRecords deletes all RRSets from the
zone which are not mentioned in the input. This commit changes the
behavior to match the spec.
[1] https://github.com/libdns/libdns/blob/5ab1d4de259f1eb914085c61784ad9176ea8e803/libdns.go#L1081 parent e49cf80 commit 2cb245d
2 files changed
Lines changed: 144 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | 202 | | |
206 | 203 | | |
207 | 204 | | |
208 | 205 | | |
209 | 206 | | |
210 | 207 | | |
211 | 208 | | |
212 | | - | |
213 | | - | |
| 209 | + | |
| 210 | + | |
214 | 211 | | |
215 | 212 | | |
216 | 213 | | |
217 | | - | |
| 214 | + | |
218 | 215 | | |
219 | 216 | | |
220 | 217 | | |
221 | 218 | | |
222 | 219 | | |
223 | 220 | | |
224 | 221 | | |
225 | | - | |
| 222 | + | |
226 | 223 | | |
227 | 224 | | |
228 | 225 | | |
229 | 226 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
260 | 233 | | |
261 | 234 | | |
262 | 235 | | |
263 | 236 | | |
264 | 237 | | |
265 | 238 | | |
266 | 239 | | |
267 | | - | |
| 240 | + | |
268 | 241 | | |
269 | 242 | | |
270 | 243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
299 | | - | |
| 300 | + | |
| 301 | + | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
| |||
369 | 371 | | |
370 | 372 | | |
371 | 373 | | |
372 | | - | |
| 374 | + | |
373 | 375 | | |
374 | 376 | | |
375 | 377 | | |
376 | 378 | | |
377 | | - | |
378 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
379 | 382 | | |
380 | 383 | | |
381 | 384 | | |
| |||
391 | 394 | | |
392 | 395 | | |
393 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
394 | 407 | | |
395 | 408 | | |
396 | 409 | | |
| |||
401 | 414 | | |
402 | 415 | | |
403 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
404 | 445 | | |
405 | | - | |
| 446 | + | |
| 447 | + | |
406 | 448 | | |
407 | 449 | | |
408 | 450 | | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
409 | 536 | | |
410 | 537 | | |
411 | 538 | | |
412 | 539 | | |
413 | | - | |
| 540 | + | |
414 | 541 | | |
415 | 542 | | |
416 | 543 | | |
| |||
0 commit comments