Skip to content

Commit

Permalink
modules: wfa-qt: use net_if_ipv4_set_netmask_by_addr
Browse files Browse the repository at this point in the history
Replace usage of the deprecated `net_if_ipv4_set_netmask`
with the `net_if_ipv4_set_netmask_by_addr`.

Signed-off-by: Triveni Danda <[email protected]>
  • Loading branch information
D-Triveni authored and rlubos committed May 10, 2024
1 parent 467d6ea commit bead089
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions modules/wfa-qt/src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,15 +700,25 @@ void set_netmask(char *ifname)
const struct device *dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_wifi));
struct net_if *iface = net_if_lookup_by_dev(dev);
struct in_addr addr;
struct in_addr mask;

if (sizeof(CONFIG_NET_CONFIG_MY_IPV4_ADDR) > 1) {
if (net_addr_pton(AF_INET, CONFIG_NET_CONFIG_MY_IPV4_ADDR, &addr)) {
indigo_logger(LOG_LEVEL_ERROR, "Invalid address: %s",
CONFIG_NET_CONFIG_MY_IPV4_ADDR);
} else {
net_if_ipv4_addr_add(iface, &addr, NET_ADDR_MANUAL, 0);
}
}

if (sizeof(CONFIG_NET_CONFIG_MY_IPV4_NETMASK) > 1) {
/* If not empty */
if (net_addr_pton(AF_INET,
CONFIG_NET_CONFIG_MY_IPV4_NETMASK, &addr)) {
CONFIG_NET_CONFIG_MY_IPV4_NETMASK, &mask)) {
indigo_logger(LOG_LEVEL_ERROR, "Invalid netmask: %s",
CONFIG_NET_CONFIG_MY_IPV4_NETMASK);
} else {
net_if_ipv4_set_netmask(iface, &addr);
net_if_ipv4_set_netmask_by_addr(iface, &addr, &mask);
}
}
}
Expand Down

0 comments on commit bead089

Please sign in to comment.