Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Isolate the DNS resolver into its own compartment.
In the current implementation, the TCP/IP compartment is responsible for DNS, which allows it to spoof translations to bypass connection capabilities and create arbitrary firewall entries. To prevent this, we must isolate the DNS resolver into its own compartment that plugs directly at the firewall-level. Since neither the FreeRTOS+TCP resolver nor existing resolver libraries are meant to run directly at the Ethernet level, and most are too heavyweight, we write our own one. Similarly to the FreeRTOS+TCP resolver, this implementation is a stub resolver: it only supports IPv4 recursive servers for A, AAAA, and CNAME queries. This resolver also assumes that the recursive resolver recurses into CNAME records. The address of the DNS server is provided by the DHCP server. This may be overly restrictive - we should evolve it in future PRs or eventually replace it with something more featureful as the need arises. Since the resolver plugs directly with the firewall, it needs to know its own IP address, the IP address of the DNS server, its own MAC address, as well as the MAC address of the DNS server (or that of the gateway if the server is outside of the local network). The MAC address of the device is obtained from the firewall. The IP address of the device, of the DNS server, and the MAC address of the server/gateway are obtained from DHCP and ARP, whose corresponding packets are also forwarded to the DNS compartment. Signed-off-by: Hugo Lefeuvre <[email protected]>
- Loading branch information