From cca5fabf4cd6bdf82bb4d0e036a2344dc963c5cc Mon Sep 17 00:00:00 2001 From: Tanya Singh Date: Wed, 30 Jul 2025 17:04:09 +0800 Subject: [PATCH] afc: Use either ca-cert or access-token to get authorization in curl command for the AFC server Fixes:WIFI-14427 Signed-off-by: Tanya Singh --- feeds/ipq807x_v5.4/hostapd/files/hostapd.uc | 5 ++++- feeds/qca-wifi-7/hostapd/files/hostapd.uc | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc b/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc index 055cfb272..d70abd2d9 100644 --- a/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc +++ b/feeds/ipq807x_v5.4/hostapd/files/hostapd.uc @@ -900,7 +900,10 @@ return { hostapd.printf(`Sending AFC request: ${data}`); writefile("/tmp/afc-request.json", data); - system(`curl -s -X POST ${afc_server.url} -H \'accept: \*\/\*\' -H \'Authorization: Bearer ${afc_server.access_token}\' -H \'Content-Type: application/json\' -d \'${data}\' --output /tmp/afc-response.json`); + if (afc_server.access_token) + system(`curl -s -X POST ${afc_server.url} -H \'accept: \*\/\*\' -H \'Authorization: Bearer ${afc_server.access_token}\' -H \'Content-Type: application/json\' -d \'${data}\' --output /tmp/afc-response.json`); + else if (afc_server.cert) + system(`curl -s -X POST ${afc_server.url} -H \'accept: \*\/\*\' --cert \'${afc_server.cert}\' -H \'Content-Type: application/json\' -d \'${data}\' --output /tmp/afc-response.json`); let afc_response = (readfile("/tmp/afc-response.json")); if (afc_response) diff --git a/feeds/qca-wifi-7/hostapd/files/hostapd.uc b/feeds/qca-wifi-7/hostapd/files/hostapd.uc index 7c3cb56aa..d54fd2aec 100644 --- a/feeds/qca-wifi-7/hostapd/files/hostapd.uc +++ b/feeds/qca-wifi-7/hostapd/files/hostapd.uc @@ -1032,7 +1032,10 @@ return { hostapd.printf(`Sending AFC request: ${data}`); writefile("/tmp/afc-request.json", data); - system(`curl -s -X POST ${afc_server.url} -H \'accept: \*\/\*\' -H \'Authorization: Bearer ${afc_server.access_token}\' -H \'Content-Type: application/json\' -d \'${data}\' --output /tmp/afc-response.json`); + if (afc_server.access_token) + system(`curl -s -X POST ${afc_server.url} -H \'accept: \*\/\*\' -H \'Authorization: Bearer ${afc_server.access_token}\' -H \'Content-Type: application/json\' -d \'${data}\' --output /tmp/afc-response.json`); + else if (afc_server.cert) + system(`curl -s -X POST ${afc_server.url} -H \'accept: \*\/\*\' --cert \'${afc_server.cert}\' -H \'Content-Type: application/json\' -d \'${data}\' --output /tmp/afc-response.json`); let afc_response = (readfile("/tmp/afc-response.json")); if (afc_response)