How to check if wpa_supplicant.conf has any syntax errors?












0














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.










share|improve this question



























    0














    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.










    share|improve this question

























      0












      0








      0







      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.










      share|improve this question













      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.







      freebsd configuration wpa-supplicant






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 8 at 18:33









      Mateusz Piotrowski

      1,90421540




      1,90421540






















          1 Answer
          1






          active

          oldest

          votes


















          1














          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.






          share|improve this answer





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486820%2fhow-to-check-if-wpa-supplicant-conf-has-any-syntax-errors%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            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.






            share|improve this answer


























              1














              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.






              share|improve this answer
























                1












                1








                1






                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.






                share|improve this answer












                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 10 at 19:03









                Claus Andersen

                1,614414




                1,614414






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f486820%2fhow-to-check-if-wpa-supplicant-conf-has-any-syntax-errors%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    List directoties down one level, excluding some named directories and files

                    list processes belonging to a network namespace

                    list systemd RuntimeDirectory mounts