@@ -10,6 +10,8 @@ void NetworkInterface::event_handler(struct net_mgmt_event_callback *cb, uint64_
1010 struct net_if *iface) {
1111 int i = 0 ;
1212
13+ ARG_UNUSED (cb);
14+
1315 if (mgmt_event != NET_EVENT_IPV4_ADDR_ADD) {
1416 return ;
1517 }
@@ -38,6 +40,10 @@ void NetworkInterface::option_handler(struct net_dhcpv4_option_callback *cb, siz
3840 enum net_dhcpv4_msg_type msg_type, struct net_if *iface) {
3941 char buf[NET_IPV4_ADDR_LEN];
4042
43+ ARG_UNUSED (length);
44+ ARG_UNUSED (msg_type);
45+ ARG_UNUSED (iface);
46+
4147 LOG_INF (" DHCP Option %d: %s" , cb->option , net_addr_ntop (AF_INET, cb->data , buf, sizeof (buf)));
4248}
4349
@@ -58,7 +64,7 @@ int NetworkInterface::dhcp() {
5864 return 0 ;
5965}
6066
61- void NetworkInterface::enable_dhcpv4_server (struct net_if *netif, char *_netmask) {
67+ void NetworkInterface::enable_dhcpv4_server (struct net_if *netif, const char *_netmask) {
6268 static struct in_addr addr;
6369 static struct in_addr netmaskAddr;
6470
@@ -140,7 +146,7 @@ void NetworkInterface::setMACAddress(const uint8_t *mac) {
140146 net_if_up (netif); // Bring the interface back up after changing the MAC address
141147}
142148
143- int NetworkInterface::begin (bool blocking, uint32_t additional_event_mask) {
149+ int NetworkInterface::begin (bool blocking, uint64_t additional_event_mask) {
144150 dhcp ();
145151 int ret = net_mgmt_event_wait_on_iface (netif, NET_EVENT_IPV4_ADDR_ADD | additional_event_mask,
146152 NULL , NULL , NULL , blocking ? K_FOREVER : K_SECONDS (1 ));
@@ -157,7 +163,6 @@ void NetworkInterface::config(const IPAddress ip, const IPAddress dns_server,
157163 setDnsServerIP (dns_server);
158164 setGatewayIP (gateway);
159165 setSubnetMask (subnet);
160- return ;
161166}
162167
163168void NetworkInterface::setLocalIP (const IPAddress ip) {
@@ -169,13 +174,17 @@ void NetworkInterface::setLocalIP(const IPAddress ip) {
169174 return ;
170175 }
171176 LOG_INF (" Local IP address set: %s" , ip.toString ().c_str ());
172- return ;
173177}
174178
175179void NetworkInterface::setSubnetMask (const IPAddress subnet) {
176180 struct in_addr netmask_addr;
177181 netmask_addr.s_addr = subnet;
182+ #pragma GCC diagnostic push
183+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
184+ // TODO: store the address that was manually set and replace this call
185+ // with net_if_ipv4_set_netmask_by_addr
178186 net_if_ipv4_set_netmask (netif, &netmask_addr);
187+ #pragma GCC diagnostic pop
179188 LOG_INF (" Subnet mask set: %s" , subnet.toString ().c_str ());
180189 return ;
181190}
@@ -185,9 +194,9 @@ void NetworkInterface::setGatewayIP(const IPAddress gateway) {
185194 gw_addr.s_addr = gateway;
186195 net_if_ipv4_set_gw (netif, &gw_addr);
187196 LOG_INF (" Gateway IP set: %s" , gateway.toString ().c_str ());
188- return ;
189197}
190198
191199void NetworkInterface::setDnsServerIP (const IPAddress dns_server) {
192- return ; // DNS server dynamic configuration is not supported
200+ // DNS server dynamic configuration is not supported
201+ ARG_UNUSED (dns_server);
193202}
0 commit comments