]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Allow TCP destination (address/port) to be used from peer URI
authorJouni Malinen <quic_jouni@quicinc.com>
Thu, 19 May 2022 19:53:36 +0000 (22:53 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 19 May 2022 19:53:36 +0000 (22:53 +0300)
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 <quic_jouni@quicinc.com>
src/ap/dpp_hostapd.c
wpa_supplicant/dpp_supplicant.c

index 55e2d8bc6a50b307cfdb692b8c8d10cf53572eee..2613c0cbbc86fede18a567fd1f3932faaefbd3d9 100644 (file)
@@ -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);
index e373aeea3f6e562d4b0a3b4af6bded4208f7721a..ca40620f64d6126869137e8ba54cfa420c87426a 100644 (file)
@@ -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);