From: Jouni Malinen Date: Thu, 19 May 2022 19:53:36 +0000 (+0300) Subject: DPP: Allow TCP destination (address/port) to be used from peer URI X-Git-Tag: hostap_2_11~1901 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed325ff0f950f0063bb1111b0352f4c496a95530;p=thirdparty%2Fhostap.git DPP: Allow TCP destination (address/port) to be used from peer URI tcp_addr=from-uri can now be used as a special case for initiating DPP-over-TCP to the destination indicated in the peer bootstrapping URI. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index 55e2d8bc6..2613c0cbb 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -832,7 +832,17 @@ int hostapd_dpp_auth_init(struct hostapd_data *hapd, const char *cmd) } addr = get_param(cmd, " tcp_addr="); - if (addr) { + if (addr && os_strcmp(addr, "from-uri") == 0) { + os_free(addr); + if (!peer_bi->host) { + wpa_printf(MSG_INFO, + "DPP: TCP address not available in peer URI"); + return -1; + } + tcp = 1; + os_memcpy(&ipaddr, peer_bi->host, sizeof(ipaddr)); + tcp_port = peer_bi->port; + } else if (addr) { int res; res = hostapd_parse_ip_addr(addr, &ipaddr); diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index e373aeea3..ca40620f6 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -799,7 +799,17 @@ int wpas_dpp_auth_init(struct wpa_supplicant *wpa_s, const char *cmd) } addr = get_param(cmd, " tcp_addr="); - if (addr) { + if (addr && os_strcmp(addr, "from-uri") == 0) { + os_free(addr); + if (!peer_bi->host) { + wpa_printf(MSG_INFO, + "DPP: TCP address not available in peer URI"); + return -1; + } + tcp = 1; + os_memcpy(&ipaddr, peer_bi->host, sizeof(ipaddr)); + tcp_port = peer_bi->port; + } else if (addr) { int res; res = hostapd_parse_ip_addr(addr, &ipaddr);