mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-27 09:12:32 +00:00
nic_router: no empty DNS servers opt in DHCP reply
The NIC router used to add the DNS servers field to DHCP replies regardless of whether there were DNS servers or not. As reported by a Genode user, the empty DNS server field irritated at least Windows 10 guests (Vbox 6) that connected to the NIC router. This resulted in Windows 10 ignoring DHCP offers from the router with such characteristic. With this commit adding the DNS server DHCP option is skipped if there are no DNS servers at the corresponding DHCP server or the domain IP config the server shall fetch its DNS servers from. Fixes #4581
This commit is contained in:
parent
1dd69eeb6c
commit
a4ec06a3b7
@ -78,6 +78,16 @@ void Dhcp_server_base::_invalid(Domain const &domain,
|
|||||||
** Dhcp_server **
|
** Dhcp_server **
|
||||||
*****************/
|
*****************/
|
||||||
|
|
||||||
|
bool Dhcp_server::dns_servers_empty() const
|
||||||
|
{
|
||||||
|
if (_dns_config_from.valid()) {
|
||||||
|
|
||||||
|
return _resolve_dns_config_from().dns_servers_empty();
|
||||||
|
}
|
||||||
|
return _dns_servers.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Dhcp_server::Dhcp_server(Xml_node const node,
|
Dhcp_server::Dhcp_server(Xml_node const node,
|
||||||
Domain &domain,
|
Domain &domain,
|
||||||
Allocator &alloc,
|
Allocator &alloc,
|
||||||
|
@ -125,6 +125,8 @@ class Net::Dhcp_server : private Genode::Noncopyable,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dns_servers_empty() const;
|
||||||
|
|
||||||
Dns_domain_name const &dns_domain_name() const
|
Dns_domain_name const &dns_domain_name() const
|
||||||
{
|
{
|
||||||
if (_dns_config_from.valid()) {
|
if (_dns_config_from.valid()) {
|
||||||
|
@ -687,11 +687,18 @@ void Interface::_send_dhcp_reply(Dhcp_server const &dhcp_srv,
|
|||||||
dhcp_opts.append_option<Dhcp_packet::Subnet_mask>(local_intf.subnet_mask());
|
dhcp_opts.append_option<Dhcp_packet::Subnet_mask>(local_intf.subnet_mask());
|
||||||
dhcp_opts.append_option<Dhcp_packet::Router_ipv4>(local_intf.address);
|
dhcp_opts.append_option<Dhcp_packet::Router_ipv4>(local_intf.address);
|
||||||
|
|
||||||
dhcp_opts.append_dns_server([&] (Dhcp_options::Dns_server_data &data) {
|
if (not dhcp_srv.dns_servers_empty()) {
|
||||||
dhcp_srv.for_each_dns_server_ip([&] (Ipv4_address const &addr) {
|
|
||||||
data.append_address(addr);
|
dhcp_opts.append_dns_server(
|
||||||
});
|
[&] (Dhcp_options::Dns_server_data &data)
|
||||||
});
|
{
|
||||||
|
dhcp_srv.for_each_dns_server_ip(
|
||||||
|
[&] (Ipv4_address const &addr)
|
||||||
|
{
|
||||||
|
data.append_address(addr);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
dhcp_srv.dns_domain_name().with_string(
|
dhcp_srv.dns_domain_name().with_string(
|
||||||
[&] (Dns_domain_name::String const &str)
|
[&] (Dns_domain_name::String const &str)
|
||||||
{
|
{
|
||||||
|
@ -91,11 +91,12 @@ class Net::Ipv4_config
|
|||||||
** Accessors **
|
** Accessors **
|
||||||
***************/
|
***************/
|
||||||
|
|
||||||
bool valid() const { return _valid; }
|
bool valid() const { return _valid; }
|
||||||
Ipv4_address_prefix const &interface() const { return _interface; }
|
Ipv4_address_prefix const &interface() const { return _interface; }
|
||||||
Ipv4_address const &gateway() const { return _gateway; }
|
Ipv4_address const &gateway() const { return _gateway; }
|
||||||
bool gateway_valid() const { return _gateway_valid; }
|
bool gateway_valid() const { return _gateway_valid; }
|
||||||
Dns_domain_name const &dns_domain_name() const { return _dns_domain_name; }
|
Dns_domain_name const &dns_domain_name() const { return _dns_domain_name; }
|
||||||
|
bool dns_servers_empty() const { return _dns_servers.empty(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _IPV4_CONFIG_H_ */
|
#endif /* _IPV4_CONFIG_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user