Commit 2b220b9
authored
dns: fix off-by-four in EDNS0 OWNER Option (#4955)
The lengths taken from
https://datatracker.ietf.org/doc/html/draft-cheshire-edns0-owner-option-01
are off by four because they include the length of the two-byte EDNS0
option code and the length of the two-byte EDNS0 option length but
according to https://datatracker.ietf.org/doc/html/rfc6891#section-6.1.2
the length should include the size of data only so all the lengths
should be decreased by 4 to parse the OWNER option containing the wakeup
MAC correctly.
Without this patch the wakeup MAC gets cut off:
```
>>> EDNS0OWN(b'\x00\x04\x00\x0e\x00\x9b\x11"3DUffUD3"\x11')
<EDNS0OWN optcode=Owner optlen=14 v=0 s=155 primary_mac=11:22:33:44:55:66 |<Padding load=b'fUD3"\x11' |>>
```
With this patch it's included as expected
```
<EDNS0OWN optcode=Owner optlen=14 v=0 s=155 primary_mac=11:22:33:44:55:66 wakeup_mac=66:55:44:33:22:11 |>
```1 parent 04b99c3 commit 2b220b9
2 files changed
+32
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
501 | | - | |
| 500 | + | |
| 501 | + | |
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
0 commit comments