@@ -28,29 +28,32 @@ int CEthernet::begin(unsigned long timeout, unsigned long responseTimeout) {
2828/* -------------------------------------------------------------------------- */
2929int CEthernet::begin (IPAddress local_ip) {
3030/* -------------------------------------------------------------------------- */
31- IPAddress subnet (255 , 255 , 255 , 0 );
32- return begin (local_ip, subnet);
31+ // Assume the DNS server will be the machine on the same network as the local IP
32+ // but with last octet being '1'
33+ IPAddress dns_server = local_ip;
34+ dns_server[3 ] = 1 ;
35+ return begin (local_ip, dns_server);
3336}
3437
3538/* -------------------------------------------------------------------------- */
36- int CEthernet::begin (IPAddress local_ip, IPAddress subnet ) {
39+ int CEthernet::begin (IPAddress local_ip, IPAddress dns_server ) {
3740/* -------------------------------------------------------------------------- */
3841 // Assume the gateway will be the machine on the same network as the local IP
3942 // but with last octet being '1'
4043 IPAddress gateway = local_ip;
4144 gateway[3 ] = 1 ;
42- return begin (local_ip, subnet , gateway);
45+ return begin (local_ip, dns_server , gateway);
4346}
4447
4548/* -------------------------------------------------------------------------- */
46- int CEthernet::begin (IPAddress local_ip, IPAddress subnet , IPAddress gateway) {
49+ int CEthernet::begin (IPAddress local_ip, IPAddress dns_server , IPAddress gateway) {
4750/* -------------------------------------------------------------------------- */
48- // Assume the DNS server will be the same machine than gateway
49- return begin (local_ip, subnet , gateway, gateway );
51+ IPAddress subnet ( 255 , 255 , 255 , 0 );
52+ return begin (local_ip, dns_server , gateway, subnet );
5053}
5154
5255/* -------------------------------------------------------------------------- */
53- int CEthernet::begin (IPAddress local_ip, IPAddress subnet , IPAddress gateway, IPAddress dns_server ) {
56+ int CEthernet::begin (IPAddress local_ip, IPAddress dns_server , IPAddress gateway, IPAddress subnet ) {
5457/* -------------------------------------------------------------------------- */
5558
5659 ni = CLwipIf::getInstance ().get (NI_ETHERNET, local_ip, gateway, subnet);
@@ -109,7 +112,7 @@ int CEthernet::begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_ser
109112int CEthernet::begin (uint8_t *mac, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet, unsigned long timeout, unsigned long responseTimeout) {
110113/* -------------------------------------------------------------------------- */
111114 CLwipIf::getInstance ().setMacAddress (NI_ETHERNET, mac_address);
112- return begin (local_ip, subnet , gateway, dns_server );
115+ return begin (local_ip, dns_server , gateway, subnet );
113116}
114117
115118/* -------------------------------------------------------------------------- */
0 commit comments