Page MenuHomeFreeBSD

Allow to have per-interface wpa_supplicant.conf (wpa_supplicant.conf.${ifname})
Needs RevisionPublic

Authored by AMDmi3 on Dec 22 2017, 4:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 30, 9:16 AM
Unknown Object (File)
Fri, Sep 26, 12:06 AM
Unknown Object (File)
Thu, Sep 25, 5:07 PM
Unknown Object (File)
Thu, Sep 25, 4:47 PM
Unknown Object (File)
Thu, Sep 25, 4:12 PM
Unknown Object (File)
Thu, Sep 25, 3:49 PM
Unknown Object (File)
Tue, Sep 23, 5:12 PM
Unknown Object (File)
Jun 29 2025, 3:35 AM
Subscribers

Details

Reviewers
brooks
gordon
cy
Summary

I don't know much of how wpa_supplicant work, but I've encountered
the following problem: apart from usual WPA wlans I use secure wired
connection at work which requires wpa_supplicant as well. The problem
is that the wired connection requires ap_scan=0 set in the config and
doesn't work otherwise (wireless connections, on the contrary, do
not work with ap_scan=0 and only work with ap_scan=1 which is the
default). Since ap_scan is set config-wide (e.g. cannot be set on
per-network basis), the only solution I've came to is to have separate
configs for wired and wireless connections.

The change to /etc/rc.d/wpa_supplicant is minimal and backwards
compatible, however I suspect that documentation changes are also
needed if this patch is accepted.

Test Plan

Works for me with separate /etc/wpa_supplicant.conf.em0 and
/etc/wpa_supplicant.conf.wlan0 configs with ap_scan=0 set in the
former.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 13748
Build 13965: arc lint + arc unit

Event Timeline

This seems reasonable to me. I'd prefer /etc/wpa_supplicant.d/em0.conf in place of /etc/wpa_supplicant.conf.em0.

This seems reasonable to me. I'd prefer /etc/wpa_supplicant.d/em0.conf in place of /etc/wpa_supplicant.conf.em0.

You sure this is a good idea? The de-facto standard for dir.d configuration directories is to just store generic configuration chunks. This makes configuration easier as you can just copy a set of topic-oriented chunks into the directory and get a properly configured service. I'm already very much annoyed with what we do with /etc/rc.conf.d/, which assigns a special meanings and limits scope for configuration files (e.g. /etc/rc.conf.d/foo only affects rc.d/foo script, and you can not just put e.g. /etc/rc.conf.d/my-webserver which configures nginx, apache, syslog and firewall for your web server), making it practically useless.

Same here, I'd expect /etc/wpa_supplicant.conf.d to store generic configuration chunks so I could put e.g. my-home-networks and my-work-networks with the lists of specific network={} entries.

Interface differentiation is whole another layer of configuration, so it seems to be more logical to have /etc/wpa_supplicant.conf.IFNAME and /etc/wpa_supplicant.conf.IFNAME.d for that purpose (we don't seem to support wpa_supplicant.conf.d at all now though, so I'm not touching it).

This seems reasonable to me. I'd prefer /etc/wpa_supplicant.d/em0.conf in place of /etc/wpa_supplicant.conf.em0.

Agreed.

This seems reasonable to me. I'd prefer /etc/wpa_supplicant.d/em0.conf in place of /etc/wpa_supplicant.conf.em0.

You sure this is a good idea? The de-facto standard for dir.d configuration directories is to just store generic configuration chunks. This makes configuration easier as you can just copy a set of topic-oriented chunks into the directory and get a properly configured service. I'm already very much annoyed with what we do with /etc/rc.conf.d/, which assigns a special meanings and limits scope for configuration files (e.g. /etc/rc.conf.d/foo only affects rc.d/foo script, and you can not just put e.g. /etc/rc.conf.d/my-webserver which configures nginx, apache, syslog and firewall for your web server), making it practically useless.

How would you propose to do that? AFAIK wpa_supplicant doesn't support including files.

Same here, I'd expect /etc/wpa_supplicant.conf.d to store generic configuration chunks so I could put e.g. my-home-networks and my-work-networks with the lists of specific network={} entries.

Interface differentiation is whole another layer of configuration, so it seems to be more logical to have /etc/wpa_supplicant.conf.IFNAME and /etc/wpa_supplicant.conf.IFNAME.d for that purpose (we don't seem to support wpa_supplicant.conf.d at all now though, so I'm not touching it).

I'm not enamoured with a proliferation of wpa_supplicant.conf.IFNAME files in /etc. It's more onerous to view a listing.

cy requested changes to this revision.Jan 30 2018, 5:44 AM
This revision now requires changes to proceed.Jan 30 2018, 5:44 AM

How about wpa_supplicant.if.d/${ifn}.conf then?