Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DNS: add the SVCB/HTTPS resource records (#4217)
https://www.rfc-editor.org/rfc/rfc9460.html ``` >>> p = dns_resolve('_dns.one.one.one.one', 'SVCB', raw=True) >>> p.an[0].show() rrname = b'_dns.one.one.one.one.' type = SVCB rclass = IN ttl = 300 rdlen = None svc_priority= 1 target_name= b'one.one.one.one.' \svc_params\ |###[ SvcParam ]### | key = alpn | len = 6 | value = [b'h3', b'h2'] |###[ SvcParam ]### | key = dohpath | len = 16 | value = b'/dns-query{?dns}' >>> p.an[1].show() rrname = b'_dns.one.one.one.one.' type = SVCB rclass = IN ttl = 300 rdlen = None svc_priority= 2 target_name= b'one.one.one.one.' \svc_params\ |###[ SvcParam ]### | key = alpn | len = 4 | value = [b'dot'] ``` The patch was also cross-checked with Wireshark: ``` >>> alpn = SvcParam(key='alpn', value=['h3', 'h2']) >>> ipv4hint = SvcParam(key='ipv4hint', value=['104.16.132.229', '104.16.133.229']) >>> ipv6hint = SvcParam(key='ipv6hint', value=['2606:4700::6810:84e5', '2606:4700::6810:85e5']) >>> httpsrr = DNSRRHTTPS(rrname='cloudflare.com', svc_priority=1, ttl=62, target_name='.', svc_params=[alpn, ipv4hint, ipv6hint]) >>> tdecode(Ether()/IP()/UDP()/DNS(qd=[], an=[httpsrr])) ... Type: HTTPS (HTTPS Specific Service Endpoints) (65) Class: IN (0x0001) Time to live: 62 (1 minute, 2 seconds) Data length: 61 SvcPriority: 1 TargetName: <Root> SvcParam: alpn=h3,h2 SvcParamKey: alpn (1) SvcParamValue length: 6 ALPN length: 2 ALPN: h3 ALPN length: 2 ALPN: h2 SvcParam: ipv4hint=104.16.132.229,104.16.133.229 SvcParamKey: ipv4hint (4) SvcParamValue length: 8 IP: 104.16.132.229 IP: 104.16.133.229 SvcParam: ipv6hint=2606:4700::6810:84e5,2606:4700::6810:85e5 SvcParamKey: ipv6hint (6) SvcParamValue length: 32 IP: 2606:4700::6810:84e5 IP: 2606:4700::6810:85e5 ``` This patch was prompted by systemd/systemd#30661 (comment) and was used to parse SVCB/HTTPS RRs produced by an upstream fuzz target and also build packets sent by another fuzzer to resolved.
- Loading branch information