[PATCH v4 1/4] hostapd: afcd: add AFC daemon support

Krishna Chaitanya chaitanya.mgit at gmail.com
Sun Apr 14 10:28:29 PDT 2024


On Wed, Apr 10, 2024 at 7:05 PM Lorenzo Bianconi <lorenzo at kernel.org> wrote:
> +         "requestId":"11235814",
11235813 to match the default request ID
> +
> +static void usage(void)
> +{
> +       wpa_printf(MSG_ERROR,
> +                  "%s:\n"
> +                  "afcd -u<url> [-p<port>][-t<token>][-D<unix-sock dir>][-P<PID file>][-dB]",
> +                  __func__);
> +}
missing `-d` usage
> +
Also, for setting `Content-Length` I had to use the below script,
should we add this as well
or at least put it in a README?

$ cat afc_server_sim.sh
#!/bin/bash

# Define the JSON content
json_content=$(cat afc-reply.json)

# Calculate the length of the JSON content
content_length=$(echo "$json_content" | wc -m)

# Create the HTTP response
http_response="HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: $content_length

$json_content"

# Write the HTTP response to a file
echo -e "$http_response" > response.txt

# Use netcat to listen on a specific port and send the response to any
incoming requests
while true; do nc -l 9999 < response.txt; done
### END OF SCRIPT##
and then I run `sudo ./afcd -u http://localhost -p 9999 -ddd`



More information about the Hostap mailing list