Skip to content

Commit 3ee1610

Browse files
rado17krish2718
authored andcommitted
[nrf noup] zephyr: Start DHCP client only in station mode
DHCP client is needed only when the device is running in station mode. Check if the SSID is configured in SME structure which indicates that the given interface is operating in STA mode. Signed-off-by: Ravi Dondaputi <ravi.dondaputi@nordicsemi.no>
1 parent e2b94fd commit 3ee1610

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/drivers/driver_zephyr.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1525,10 +1525,14 @@ static int wpa_drv_zep_set_supp_port(void *priv,
15251525
authorized,
15261526
if_ctx->bssid);
15271527

1528-
#ifdef CONFIG_NET_DHCPV4
1529-
if (authorized) {
1530-
net_dhcpv4_restart(iface);
1531-
}
1528+
#if defined(CONFIG_NET_DHCPV4) && defined(CONFIG_SME)
1529+
struct wpa_supplicant *wpa_s = if_ctx->supp_if_ctx;
1530+
/* Need DHCP client in STA mode only */
1531+
if (wpa_s && wpa_s->sme.ssid_len > 0) {
1532+
if (authorized) {
1533+
net_dhcpv4_restart(iface);
1534+
}
1535+
}
15321536
#endif
15331537

15341538
return ret;

0 commit comments

Comments
 (0)