Commit e0f5de6
feat(mld): MLDv2 source-bearing state-change Reports (R4 P4a)
Emits the RFC 3810 §6.1 source-bearing MLDv2 state-change records on
multicast filter transitions — the IPv6 analogue of the shipped IGMPv3
source-state-change track, and the point where the source filters set via
the P2 MCAST_* socket options actually reach the wire.
New in the ICMPv6 TX handler:
- '_mld_state_change_records(group, old, new)' — the §6.1 difference
table (the "non-listener" state is INCLUDE{}): a filter-mode change
yields one CHANGE_TO_INCLUDE / CHANGE_TO_EXCLUDE record carrying the new
source list; a within-mode source change yields ALLOW_NEW_SOURCES and/or
BLOCK_OLD_SOURCES records (empty ones omitted). The IPv6 analogue of the
IGMPv3 '_state_change_records'.
- '_send_mld_state_change(group, old, new)' — emits the aggregated MLDv2
Report (type 143) to ff02::16, degrading to the coarse MLDv1 Report /
Done keyed off the reception edge while in MLDv1 Host Compatibility Mode.
The all-nodes group ff02::1 is never reported.
- '_emit_mld2_report(records)' — the shared assemble+send helper (a report
with no records is not emitted).
The three edges of the multicast reception machinery now route through it:
the 'assign_ip6_multicast' join edge (old=INCLUDE{} nonmember, new=merged
filter), the 'remove_ip6_multicast' leave edge (old=filter, new=INCLUDE{}),
and the '_mc6_recompute' mid-membership delta (replacing the '# P4:'
placeholder). A source-specific join therefore now announces
ALLOW_NEW_SOURCES{src} / a mode flip announces CHANGE_TO_EXCLUDE with the
real source list, instead of the coarse all-groups current-state report
the join edge emitted before. The now-dead coarse '_send_icmp6_mld_leave'
(single-group) was removed — 'remove_ip6_multicast' supersedes it, and
'_send_mld_state_change' carries the MLDv1-Done fallback it held.
This is single immediate emission; the RFC 3810 §6.1 robustness
retransmit train (Robustness-Variable copies at random intervals) is P4b,
mirroring the v4 '_igmp_state_change__pending' / arm / fire / cancel
machinery. The §4.2 / §5.2 adherence flip waits for P4b + the P5 RX gate.
Tests-first: 'test__icmp6__mld__source_state_change.py' drives the
MCAST_* options through the socket and asserts the emitted MLDv2 records
carry the right type + source set (fresh join → ALLOW_NEW_SOURCES, second
source → ALLOW for the delta only, drop → BLOCK_OLD_SOURCES, block /
unblock on an any-source membership, INCLUDE→EXCLUDE mode flip →
CHANGE_TO_EXCLUDE), mirroring the IGMPv3 source-state-change tests. The
packet-handler / stack-init unit tests that mocked the old emit methods
now mock '_send_mld_state_change'.
Lint clean, 13534 passing, 0 skipped.
Reference: RFC 3810 §6.1 (source-bearing state-change Report difference records).
Reference: RFC 3810 §5.2.12 (ALLOW / BLOCK / CHANGE_TO record types).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 69a52e2 commit e0f5de6
6 files changed
Lines changed: 460 additions & 76 deletions
File tree
- docs/refactor
- packages/pytcp/pytcp
- runtime/packet_handler
- tests
- integration/protocols/icmp6
- unit
- runtime/packet_handler
- stack
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
108 | 118 | | |
109 | 119 | | |
110 | 120 | | |
| |||
243 | 253 | | |
244 | 254 | | |
245 | 255 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
251 | 273 | | |
252 | 274 | | |
253 | 275 | | |
| |||
262 | 284 | | |
263 | 285 | | |
264 | 286 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
270 | 294 | | |
271 | 295 | | |
272 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1094 | 1094 | | |
1095 | 1095 | | |
1096 | 1096 | | |
1097 | | - | |
1098 | | - | |
1099 | | - | |
1100 | | - | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1101 | 1100 | | |
1102 | | - | |
| 1101 | + | |
1103 | 1102 | | |
1104 | 1103 | | |
1105 | 1104 | | |
| |||
2754 | 2753 | | |
2755 | 2754 | | |
2756 | 2755 | | |
2757 | | - | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
2758 | 2764 | | |
2759 | | - | |
2760 | | - | |
| 2765 | + | |
| 2766 | + | |
2761 | 2767 | | |
2762 | 2768 | | |
2763 | | - | |
| 2769 | + | |
2764 | 2770 | | |
2765 | 2771 | | |
2766 | 2772 | | |
| |||
3977 | 3983 | | |
3978 | 3984 | | |
3979 | 3985 | | |
3980 | | - | |
| 3986 | + | |
| 3987 | + | |
3981 | 3988 | | |
3982 | 3989 | | |
3983 | 3990 | | |
3984 | 3991 | | |
3985 | 3992 | | |
3986 | | - | |
| 3993 | + | |
| 3994 | + | |
| 3995 | + | |
3987 | 3996 | | |
3988 | 3997 | | |
3989 | 3998 | | |
| |||
3992 | 4001 | | |
3993 | 4002 | | |
3994 | 4003 | | |
| 4004 | + | |
3995 | 4005 | | |
3996 | 4006 | | |
3997 | 4007 | | |
3998 | 4008 | | |
3999 | 4009 | | |
4000 | 4010 | | |
4001 | | - | |
4002 | | - | |
4003 | | - | |
4004 | | - | |
| 4011 | + | |
| 4012 | + | |
| 4013 | + | |
| 4014 | + | |
4005 | 4015 | | |
4006 | 4016 | | |
4007 | 4017 | | |
| |||
4205 | 4215 | | |
4206 | 4216 | | |
4207 | 4217 | | |
4208 | | - | |
| 4218 | + | |
| 4219 | + | |
4209 | 4220 | | |
4210 | 4221 | | |
4211 | 4222 | | |
4212 | | - | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
4213 | 4226 | | |
4214 | 4227 | | |
4215 | 4228 | | |
| |||
4218 | 4231 | | |
4219 | 4232 | | |
4220 | 4233 | | |
| 4234 | + | |
4221 | 4235 | | |
4222 | 4236 | | |
4223 | 4237 | | |
4224 | 4238 | | |
4225 | | - | |
4226 | | - | |
4227 | | - | |
| 4239 | + | |
| 4240 | + | |
| 4241 | + | |
4228 | 4242 | | |
4229 | 4243 | | |
4230 | 4244 | | |
| |||
Lines changed: 115 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
| |||
263 | 273 | | |
264 | 274 | | |
265 | 275 | | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | 276 | | |
302 | 277 | | |
303 | 278 | | |
| |||
348 | 323 | | |
349 | 324 | | |
350 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
351 | 431 | | |
352 | 432 | | |
353 | 433 | | |
| |||
0 commit comments