summaryrefslogtreecommitdiff
path: root/wireless.c
Commit message (Collapse)AuthorAgeFilesLines
* netifd: Fix multiple -Wsign-compare warningsHauke Mehrtens2023-02-191-1/+1
| | | | | | | | | | | | | | | | | | This fixes warnings like this: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare] Mostly this was an int compared to a size_t returned by ARRAY_SIZE(). The easiest fix is to count on the size_t type. The ifindex is sometimes an unsigned int and sometimes a signed int in the kernel interfaces. I think it normally fits into an unsigned 16 bit value, so this should be fine. Do the one comparison where the compiler complains as a long. Casting the result of sizeof() to int should be safe. These values are never out of range of int. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* wireless: add support for disabling multicast-to-unicast per virtual interfaceFelix Fietkau2022-12-191-0/+23
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: allow set_retry ubus notify command to trigger a wdev restartFelix Fietkau2022-12-191-4/+5
| | | | | | | This can be used to retry bringing up a wireless device after receiving a hotplug event Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: fix handling vif attributes on reload with mode changeFelix Fietkau2021-10-211-12/+3
| | | | | | | | When switching from AP to station mode, some AP specific flags such as proxyarp could become sticky and lead to hairpin being enabled on the sta interface. Fix this by ensuring that vif fields are always properly rewritten Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: fix creating AP mode WDS station interfacesFelix Fietkau2021-10-201-3/+4
| | | | | | Ensure that devices are created without attempting to create a VLAN chain Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: fix index for stationsFelix Fietkau2021-09-291-1/+1
| | | | | | Use wdev->sta_idx instead of the VLAN counter wdev->vlan_idx Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: reset retry counter when setup succeedsFelix Fietkau2021-09-291-0/+1
| | | | | | | | A wireless device restart cycle can be triggered if a tracked process (e.g. hostapd) dies and is restarted, and this left the retry counter untouched Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: reset number of retries on config changeFelix Fietkau2021-09-291-2/+4
| | | | | | | Ensure that enough retries are performed, just like on a user triggered down/up cycle. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: process and close script file descriptor when rerunning setupFelix Fietkau2021-09-291-0/+3
| | | | | | | On reloading, setup is called without a teardown, so the previous fd might still be open. Clear it to avoid a leak. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: display log messages for setup/teardown/retryFelix Fietkau2021-09-291-2/+6
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: fix applying wireless devices attributes on hotplug eventsAndre Heider2021-09-281-1/+1
| | | | | | | | | Hotplug events pass their own 'ifname' copy, so we need to compare the strings, not just the pointers. Additionally, the check condition was accidentally inverted Signed-off-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: only enable proxyarp/isolate for AP vifsFelix Fietkau2021-09-201-3/+7
| | | | | | | | The settings might be present in the config as leftovers when switching a vif from AP to sta mode. In that case, they will not be applied by wpad, so they also must not be used by netifd Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: only apply wireless device attributes to the base vif interfaceFelix Fietkau2021-09-201-2/+2
| | | | | | | Per-station interfaces in 4-addr AP mode must not inherit them, because this can cause reflected packets by enabling hairpin mode. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: improve reliability of proxyarp supportFelix Fietkau2021-09-011-0/+7
| | | | | | | | instead of relying on hostapd to manipulate bridge attributes (which can race against netifd adding/removing of member ports), set the proxyarp related attributes in netifd directly when bringing up the member port Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: always enable bpdu filter for AP interfaces and VLANsFelix Fietkau2021-08-271-0/+2
| | | | | | | | | | Regular AP/VLAN interfaces using 3-address modes should transmit any STP packets, since devices behind them can not be part of any working bridge topology. Enable a feature that drops any incoming or outgoing STP packets. This does not apply to WDS AP VLAN or client mode interfaces, since they could act as a proper bridge link Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: add back regular virtual interfaces on hotplug-add events as wellFelix Fietkau2021-07-231-5/+8
| | | | | | | When hostapd does a DFS channel switch, it tears down all vifs except for the primary one, which causes them got get dropped from the device configuration Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: handle WDS per-sta devicesFelix Fietkau2021-06-191-7/+40
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: add some comments to functionsAlexander Couzens2021-06-081-0/+42
| | | | Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* wireless: pass the real network ifname to the setup scriptFelix Fietkau2021-06-041-1/+3
| | | | | | | If the network ifname is a VLAN on top of a VLAN-filtering bridge, hostapd needs to know the VLAN ifname to communicate with other APs, if 802.11r is enabled. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: fix memory corruption bug when using vlans/station entries in the ↵Felix Fietkau2021-05-181-1/+2
| | | | | | | | | | | config On config reload, any vif entries in the config added to the vlist will be matched against existing ones, and the old entries preserved. This means that the vif pointer is no longer valid after vlist_add. Look up the vif again before using it for vlan/station entries. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: add support for not killing processes on teardownFelix Fietkau2020-12-281-1/+6
| | | | | | | When using a global hostapd/wpa_supplicant instance, it should not be killed if a single radio is torn down Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: fix passing bridge name for vlan hotplug pass-throughFelix Fietkau2020-11-181-2/+5
| | | | | | | When preparing the interface for hotplug add, pass the bridge device back to the caller, since it may not match the original device Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: add support for defining port member vlans via hotplug opsFelix Fietkau2020-10-281-2/+2
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* netifd: wireless: add support for tracking wifi-station sectionsJohn Crispin2020-06-041-3/+131
| | | | | | | This new section allows us to assign mac specific key/vid settings to a station. Signed-off-by: John Crispin <john@phrozen.org>
* netifd: wireless: add support for tracking wifi-vlan sectionsJohn Crispin2020-06-041-8/+239
| | | | | | This new section allows us to create apvlan settings for hostapd. Signed-off-by: John Crispin <john@phrozen.org>
* wireless: make reconf opt-in and allow serializing configurationJohn Crispin2019-11-121-10/+81
| | | | | | | | | Add option 'reconf' to make dynamic re-configuration opt-in. Also add option 'serialize' to 'wifi-device' section and if set configure interfaces of wireless devices one-by-one. Both options are disabled by default. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* wireless: add ubus method for reloading configurationJohn Crispin2019-10-251-5/+13
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* wireless: Call wireless_interface_handle_link before deleting the vifHans Dedecker2016-11-041-0/+1
| | | | | | | Similar as when updating a vif; call wireless_interface_handle_link removing the vif from the network when deleting a vif Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: Make bridge_device_type staticHans Dedecker2016-09-261-1/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* wireless: remove config_autostartEduardo Abinader2016-08-251-2/+1
| | | | | | just a cleanup for an unused member. Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com>
* wireless: add retry_setup_failed to status notificationEduardo Abinader2016-08-241-0/+1
| | | | | | | | As autostart is now more aligned to user intention of automatic starting the wdev, to add retry_setup_failed to status msg may be of a help for current stating how setup is proceeding. Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com>
* netifd: track when wdev setup failsEduardo Abinader2016-08-231-5/+13
| | | | | | | | | | | When netifd failed to load a valid configuration, after an invalid one, it was not possible to setup the wireless device. This patch aims to track this situation and behave acordingly, by keeping track of failed setup without affecting autostart behavior. Also block the restart of the wdev, when not applied. Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* wireless: call wireless_interface_handle_link before updating vif configFelix Fietkau2015-12-021-0/+1
| | | | | | | If the network changes, we need to remove the vif from the old network before we lose access to the previous state Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* Initialize wireless interface attributes in proper functionDmitry Ivanov2015-09-261-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently multicast to unicast feature may be configured for incorrect wireless interface in case of reconfiguration. Test case: Initial wireless configuration: config wifi-iface option mode ap option disabled 1 config wifi-iface option mode sta option disabled 0 config wifi-iface option mode ap option disabled 0 After reboot, multicast to unicast feature is configured for interface #3 (wlan0-1) only. Next, enable interface #1 and issue "wifi" command. Now, multicast to unicast feature is configured for interface #2 (wlan0) which is wrong. It should be configured for interfaces #1 and #3 only. This patch resolves this problem. Signed-off-by: Dmitry Ivanov <dima@ubnt.com> Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: fix mcast_to_ucast handling, only apply it to AP modeFelix Fietkau2015-09-101-0/+9
| | | | | | | Fixes a regression that caused WDS stations to repeat packets back to the AP. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* bridge: Allow setting multicast_to_unicast optionLinus Lüssing2015-08-251-0/+4
| | | | | | | | | | | With this patch the multicast_to_unicast feature can be disabled for all wireless interfaces via an according option on the uci bridge interface. This patch also exports the setting information to wireless handler scripts. The hostapd script will need that information to determine whether to enable or disable ap-isolation, for instance. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
* bridge: Fix multicast_to_unicast feature by hairpin+isolateLinus Lüssing2015-08-251-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | All IGMP and MLD versions suffer from a specific limitation (from a snooping switch perspective): Report suppression. Once a listener hears an IGMPv2/3 or MLDv1 report for the same group itself participates in then it might (if this listener is an IGMPv3 or MLDv2 listener) or will (if this is an IGMPv1/2 or MLDv1 listener) refrain from sending its own report. Therefore we might currently miss such surpressing listeners as they won't receive the multicast packet with the mangled, unicasted destination. Fixing this by first isolating the STAs and giving the bridge more control over traffic forwarding. E.g. refraining to forward listener reports to other STAs. For broadcast and unicast traffic to an STA on the same AP, the hairpin feature of the bridge will reflect such traffic back to the AP interface. However, if the AP interface is actually configured to isolate STAs, then hairpin is kept disabled. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
* wireless: fix teardown, always pass the previous config to the teardown ↵Felix Fietkau2015-02-281-2/+22
| | | | | | handler instead of the new one Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: use strdup for vif sectionsFelix Fietkau2014-10-241-5/+7
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: print the active configuration in status infoFelix Fietkau2014-10-041-2/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: fix blob buf in put_container()Felix Fietkau2014-10-041-3/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: copy the vif section name instead of keeping a reference that ↵Felix Fietkau2014-10-041-3/+5
| | | | | | might go stale Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: Allow to add link devices which can be marked as non externalHans Dedecker2014-07-301-1/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: enable multicast_to_unicast on all wireless bridge portsFelix Fietkau2014-06-291-0/+6
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: fix cancelling setupFelix Fietkau2014-05-151-14/+17
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: fix a use-after-free issue on wireless config updateFelix Fietkau2014-04-291-1/+2
| | | | | | After vlist_add() the device could have been freed Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: defer init until after command line option processingFelix Fietkau2014-03-071-2/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: fix device config reload regressionFelix Fietkau2014-02-231-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: add a "get_validate" methode to ubusJohn Crispin2014-02-171-0/+24
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* wireless: load and then ignore disabled devicesJohn Crispin2014-02-171-3/+10
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>