1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! RFC 6762 §11 on-link gate.
use IpAddr;
use ;
use crate;
/// The §11 decision for an inbound datagram.
///
/// The authoritative test is the received hop-limit: an on-link mDNS packet
/// arrives with TTL / hop-limit 255. When the transport surfaces it
/// (`Some(ttl)`), that is decisive. Neither supplied transport does — smoltcp's
/// `udp::Socket` `UdpMetadata` carries no received hop-limit, and `hick-embassy`
/// re-exports the same type — so in practice this always takes the `None` arm:
///
/// * `None` with local subnets configured → a best-effort source-subnet heuristic
/// (weaker: a same-subnet host can spoof it).
/// * `None` with NO subnets → accept ONLY a datagram whose destination (`local`) is
/// the mDNS multicast group. Dropping everything would make the node deaf — it
/// could announce but never receive a query, answer, or conflict, the common
/// default-setup failure — and a datagram sent TO `224.0.0.251` / `ff02::fb` is
/// on-link by IP design: those are link-scoped multicast groups routers do not
/// forward. UNICAST is NOT accepted here: a routed off-link host could otherwise
/// send ordinary unicast (or an ephemeral-port probe) to the device's `:5353` and
/// inject conflict/answer data — the multicast scope does not protect that path.
/// Configure local subnets (`Engine::set_local_subnets`) to accept on-subnet
/// unicast too (and to reject spoofed same-link sources).
/// Whether `local` (the datagram's destination address) is an mDNS multicast group —
/// the only no-hop-limit, no-subnet destination trusted as on-link by IP design.
/// Whether `src` falls within one of the device's configured local subnets.