Commit 69a52e2
feat(mld): MCAST_JOIN_SOURCE_GROUP family for IPv6 SSM (R4 P2, part 2)
Adds the protocol-independent IPv6 multicast source-filter socket options
— the second half of R4 P2, completing the socket surface for IPv6
source-specific multicast.
New 'McastOption' IntEnum + bare aliases (enums.md §2.2 stdlib-parity
form, re-exported from 'pytcp.socket'): MCAST_JOIN_SOURCE_GROUP (46) /
MCAST_LEAVE_SOURCE_GROUP (47) / MCAST_BLOCK_SOURCE (43) /
MCAST_UNBLOCK_SOURCE (44), wired at IPPROTO_IPV6 level. There is NO
'IPV6_ADD_SOURCE_MEMBERSHIP' — Linux drives IPv6 SSM through the
protocol-independent 'MCAST_*' family with a 'group_source_req' struct,
not the IPv4-style 'ip_mreq_source'.
A module-level '_parse_group_source_req' decodes the 264-byte glibc
'struct group_source_req' (uint32 gsr_interface at 0; sockaddr_storage
gsr_group at 8 → group addr bytes[16:32]; gsr_source at 136 → source addr
bytes[144:160]), validating the total length and that each embedded
sockaddr's ss_family is AF_INET6 (the OS-level value 10, the same
'error_queue' packs — distinct from PyTCP's internal 'AddressFamily.INET6'
enum). '_apply_ip6_source_op' computes the new per-socket filter with the
Linux 'ip6_mc_source' errno surface (EINVAL on an INCLUDE/EXCLUDE
filter-mode conflict or BLOCK/UNBLOCK without a prior any-source join,
EADDRNOTAVAIL on dropping/unblocking a source not held) — the IPv6
analogue of the v4 '_apply_source_op'. '_ipproto_ipv6_source_membership'
performs the get/compute/store as one atomic RMW under
'_lock__ip6_source_filters' and pushes the result to the interface merge
via 'stack.membership6'.
Tests-first: 'test__socket__ipv6_source_membership.py' drives all four
options end-to-end through the socket (INCLUDE join materializes
INCLUDE{src}, source accumulation, leave-last-source leaves the group,
BLOCK/UNBLOCK on an any-source membership, the mode-conflict + stale-source
errno paths, short / wrong-family struct rejection, and close-time
release). The MLDv2 source records on the wire (P4) and the RX
source-delivery gate (P5) remain before the RFC 3810 §4.2/§5.2 adherence
flip.
Lint clean, 13527 passing, 0 skipped.
Reference: RFC 3810 §4.1 (per-socket filter mode + source list).
Reference: RFC 3678 §4 (MCAST_JOIN_SOURCE_GROUP / group_source_req).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 88315c7 commit 69a52e2
4 files changed
Lines changed: 547 additions & 13 deletions
File tree
- docs/refactor
- packages/pytcp/pytcp
- runtime/socket
- socket
- tests/integration/socket
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
94 | 108 | | |
95 | 109 | | |
96 | 110 | | |
| |||
187 | 201 | | |
188 | 202 | | |
189 | 203 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
194 | 226 | | |
195 | 227 | | |
196 | 228 | | |
| |||
225 | 257 | | |
226 | 258 | | |
227 | 259 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
236 | 271 | | |
237 | 272 | | |
238 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
259 | 282 | | |
260 | 283 | | |
261 | 284 | | |
| |||
366 | 389 | | |
367 | 390 | | |
368 | 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 | + | |
369 | 428 | | |
370 | 429 | | |
371 | 430 | | |
| |||
1044 | 1103 | | |
1045 | 1104 | | |
1046 | 1105 | | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1047 | 1120 | | |
1048 | 1121 | | |
1049 | 1122 | | |
| |||
1114 | 1187 | | |
1115 | 1188 | | |
1116 | 1189 | | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
1117 | 1284 | | |
1118 | 1285 | | |
1119 | 1286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
| |||
0 commit comments