1

I would like to know if there is a tool that allows me to check if I made any syntax errors in wpa_supplicant.conf(5).

I am looking for a utility for wpa_supplicant(8) that would server the same purpose as the --check flag of visudo(8) from the sudo(8) suite.

The only solution I've come up with so far is running

wpa_supplicant -c wpa_supplicant.conf -iNonexistentInterface`

but it is less than ideal. Partially because the return code is always 255 due to the invalid interface name.

Ideally, I'd like the utility to run on FreeBSD.

2

I understand your wish but know of no such thing. It would be a nice feature. But I think you are close already now.

There is however another utility named wpa_cli which might be helpful if you are willing to consider a slightly different approach. Or maybe you know it and have already discarded the idea.

It is available along with wpa_supplicant.conf in the base system:

$ uname -r
11.1-RELEASE
$ wpa_cli -v
wpa_cli v2.5
Copyright (c) 2004-2015, Jouni Malinen <j@w1.fi> and contributors

Version 2.7 is available as a port.

The man page is unfortunately not kept quite up-to-date. Neither is the readme

wpa_cli -help lists all current options. And of those these might be interesting:

  • reconfigure
  • set
  • dump
  • save_config

If you can live with the fact that you are changing the live settings - then set allows you to adapt the config and get errors for each setting. When things are to your liking you can then use save_config.

Another - probably obvious - idea would be to add -dd to your wpa_supplicant command line. But still not ideal.

But your general idea is actually workable. Though it seems that it always flakes out with exit code 255 no matter what the error. The textual output is easy to parse.

If you have a parse failure you can always look for:

Failed to read or parse configuration '{}'.

All parse failures are prepended with Line {}:

But a suggestion upstream to allow for -t for test in place of -i and more granular exit status might be a good idea.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.