Commit e5f42d6
client: identify persistent clients via IPv6 NDP neighbor table
When a DNS query arrives from an IPv6 address, AdGuard Home currently
cannot identify the client by MAC address because the DHCPv4 lease
table has no entry for IPv6 addresses. This means per-client filtering
rules (e.g. blocking YouTube for specific devices) don't work when
clients query over IPv6.
This patch adds an NDP (Neighbor Discovery Protocol) neighbor table
lookup as a fallback. When the DHCP lease lookup returns no MAC for a
source IP, the IPv6 neighbor table is consulted. The kernel's NDP cache
maps IPv6 addresses to MAC addresses for all devices on the local
network, so persistent clients configured with MAC identifiers are
correctly matched regardless of whether they query via IPv4 or IPv6.
The NDP cache is refreshed alongside the existing ARP refresh cycle,
with an additional on-demand refresh (at most every 30 seconds) when
an unknown IPv6 address is encountered.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 42a2653 commit e5f42d6
1 file changed
Lines changed: 90 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| 11 | + | |
9 | 12 | | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
150 | 154 | | |
151 | 155 | | |
152 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
153 | 163 | | |
154 | 164 | | |
155 | 165 | | |
| |||
182 | 192 | | |
183 | 193 | | |
184 | 194 | | |
| 195 | + | |
185 | 196 | | |
186 | 197 | | |
187 | 198 | | |
| |||
241 | 252 | | |
242 | 253 | | |
243 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 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 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
244 | 324 | | |
245 | 325 | | |
246 | 326 | | |
| |||
568 | 648 | | |
569 | 649 | | |
570 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
571 | 657 | | |
572 | 658 | | |
573 | 659 | | |
| |||
594 | 680 | | |
595 | 681 | | |
596 | 682 | | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
597 | 687 | | |
598 | 688 | | |
599 | 689 | | |
| |||
0 commit comments