Skip to content

Commit c191ead

Browse files
ABOSTMfpistm
authored andcommitted
fix: Assume DNS is the same IP than gateway
When DNS is not provided, it is more likely to be the same than gateway (more likely than xx.xx.xx.1) Signed-off-by: Alexandre Bourdiol <[email protected]>
1 parent 7669880 commit c191ead

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/STM32Ethernet.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ void EthernetClass::begin(IPAddress local_ip, IPAddress subnet)
3333

3434
void EthernetClass::begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway)
3535
{
36-
// Assume the DNS server will be the machine on the same network as the local IP
37-
// but with last octet being '1'
38-
IPAddress dns_server = local_ip;
39-
dns_server[3] = 1;
40-
begin(local_ip, subnet, gateway, dns_server);
36+
// Assume the DNS server will be the same machine than gateway
37+
begin(local_ip, subnet, gateway, gateway);
4138
}
4239

4340
void EthernetClass::begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway, IPAddress dns_server)

0 commit comments

Comments
 (0)