networks: Configure wireless BSSID, band, channel

Select the frequency band (2.4 GHz vs. 5 GHz) is a prerequisite for
selecting the channel.  Channel selection is useful primarily as follow:

- Restrict to a particular access point when multiple access points use
  the same SSID (AP name) but are available on different frequencies.

- Configure for a particular ad-hoc mesh network.

- Setup multiple access points from a single FreedomBox on multiple
  channels to maximize the throughput and number of simultaneous
  clients.

Ability to specify a particular BSSID will help associate with a
particular access point when multiple access points use the same
SSID (AP name).  This is also makes it slightly harder to trick clients
into connection to a malicious device.  Also configuring BATMAN-adv
seems to require setting a particular BSSID.
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2016-07-21 19:23:31 -04:00
1 parent a9ca2d7cc3
commit 28a9933fd9
3 files changed
+39 -2

No files matched your search

+27 -2
View File
@@ -188,8 +188,9 @@ class PPPoEForm(EthernetForm):
class WifiForm(ConnectionForm):
"""Form to create/edit a Wi-Fi connection."""
field_order = ['name', 'interface', 'zone', 'ssid', 'mode', 'auth_mode',
'passphrase', 'ipv4_method', 'ipv4_address', 'ipv4_netmask',
field_order = ['name', 'interface', 'zone', 'ssid', 'mode', 'band',
'channel', 'bssid', 'auth_mode', 'passphrase',
'ipv4_method', 'ipv4_address', 'ipv4_netmask',
'ipv4_gateway', 'ipv4_dns', 'ipv4_second_dns']
ssid = forms.CharField(
@@ -200,6 +201,27 @@ class WifiForm(ConnectionForm):
choices=[('infrastructure', _('Infrastructure')),
('ap', _('Access Point')),
('adhoc', _('Ad-hoc'))])
band = forms.ChoiceField(
label=_('Frequency Band'),
choices=[('auto', _('Automatic')),
('a', _('A (5 GHz)')),
('bg', _('B/G (2.4 GHz)'))])
channel = forms.IntegerField(
label=_('Channel'),
help_text=_('Optional value. Wireless channel in the selected '
'frequency band to restrict to. Blank or 0 value means '
'automatic selection.'),
min_value=0,
max_value=255,
required=False)
bssid = forms.RegexField(
label=_('BSSID'),
help_text=_('Optional value. Unique identifier for the access point. '
'When connecting to an access point, connect only if the '
'BSSID of the access point matches the one provided. '
'Example: 00:11:22:aa:bb:cc.'),
regex=r'^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$',
required=False)
auth_mode = forms.ChoiceField(
label=_('Authentication Mode'),
help_text=_('Select WPA if the wireless network is secured and \
@@ -224,6 +246,9 @@ requires clients to have the password to connect.'),
settings['wireless'] = {
'ssid': self.cleaned_data['ssid'],
'mode': self.cleaned_data['mode'],
'band': self.cleaned_data['band'],
'channel': self.cleaned_data['channel'],
'bssid': self.cleaned_data['bssid'],
'auth_mode': self.cleaned_data['auth_mode'],
'passphrase': self.cleaned_data['passphrase'],
}
+4
View File
@@ -164,6 +164,9 @@ def edit(request, uuid):
settings_wireless = connection.get_setting_wireless()
form_data['ssid'] = settings_wireless.get_ssid().get_data()
form_data['mode'] = settings_wireless.get_mode()
form_data['band'] = settings_wireless.get_band() or 'auto'
form_data['channel'] = settings_wireless.get_channel()
form_data['bssid'] = settings_wireless.get_bssid()
try:
wifi_sec = connection.get_setting_wireless_security()
if wifi_sec:
@@ -328,6 +331,7 @@ def add_wifi(request, ssid=None, interface_name=None):
'zone': 'external',
'ssid': ssid,
'mode': 'infrastructure',
'band': 'auto',
'auth_mode': 'wpa',
'ipv4_method': 'auto'}