@@ -163,51 +163,40 @@ bool NetworkInterface::setLocalIPFull(IPAddress ip, IPAddress subnet, IPAddress
163163 return false ;
164164 }
165165
166- if (!net_if_ipv4_set_netmask_by_addr (netif, &ip_addr, &subnet_addr)) {
167- LOG_ERR (" Failed to set subnet mask" );
168- return false ;
169- }
170-
166+ net_if_ipv4_set_netmask (netif, &subnet_addr);
171167 net_if_ipv4_set_gw (netif, &gw_addr);
172168 LOG_INF (" Static IP configured" );
173169 return true ;
174170}
175171
176- bool NetworkInterface::setLocalIP (IPAddress ip) {
172+ void NetworkInterface::setLocalIP (const IPAddress ip) {
177173 struct in_addr addr;
178174 addr.s_addr = ip;
179175
180176 if (!net_if_ipv4_addr_add (netif, &addr, NET_ADDR_MANUAL, 0 )) {
181177 LOG_ERR (" Failed to set local IP address" );
182- return false ;
178+ return ;
183179 }
184-
185180 LOG_INF (" Local IP address set: %s" , ip.toString ().c_str ());
186- return true ;
181+ return ;
187182}
188183
189- bool NetworkInterface::setSubnetMask (IPAddress subnet) {
184+ void NetworkInterface::setSubnetMask (const IPAddress subnet) {
190185 struct in_addr netmask_addr;
191186 netmask_addr.s_addr = subnet;
192-
193- if (!net_if_ipv4_set_netmask_by_addr (netif, &netmask_addr, &netmask_addr)) {
194- LOG_ERR (" Failed to set subnet mask" );
195- return false ;
196- }
197-
187+ net_if_ipv4_set_netmask (netif, &netmask_addr);
198188 LOG_INF (" Subnet mask set: %s" , subnet.toString ().c_str ());
199- return true ;
189+ return ;
200190}
201191
202- bool NetworkInterface::setGatewayIP (IPAddress gateway) {
192+ void NetworkInterface::setGatewayIP (const IPAddress gateway) {
203193 struct in_addr gw_addr;
204194 gw_addr.s_addr = gateway;
205-
206195 net_if_ipv4_set_gw (netif, &gw_addr);
207196 LOG_INF (" Gateway IP set: %s" , gateway.toString ().c_str ());
208- return true ;
197+ return ;
209198}
210199
211- bool NetworkInterface::setDnsServerIP (IPAddress dns_server) {
212- return false ; // DNS server dynamic configuration is not supported
200+ void NetworkInterface::setDnsServerIP (const IPAddress dns_server) {
201+ return ; // DNS server dynamic configuration is not supported
213202}
0 commit comments