summaryrefslogtreecommitdiff
path: root/alias.c
Commit message (Collapse)AuthorAgeFilesLines
* netifd: rework/fix device free handlingFelix Fietkau2021-09-271-4/+0
| | | | | | | | | Instead of explicitly preventing free in specific code sections using device_lock/device_unlock, defer all device free handling via uloop timeout This avoids an entire class of lurking use-after-free bugs triggered by device event processing and simplifies the code Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: gracefully handle device names exceeding IFNAMESIZHans Dedecker2018-08-141-1/+5
| | | | | | | | | | | | Instead of truncating the device name when it exceeds IFNAMSIZ length; let device_set_ifname return an error code and do not add the device to the device list. This avoids possible issues with device names becoming identical due the truncation and as a result unexpected behavior. Further let the different device types gracefully handle the error code returned by device_init Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* replace fall throughs in switch/cases where possible with simple code changesAlexander Couzens2018-07-111-5/+6
| | | | | | | | fall throughs are usually error-prone, especially when someone else extend it. Signed-off-by: Alexander Couzens <lynxis@fe80.eu> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
* device: Move the different device type registrations to the device type fileHans Dedecker2016-09-261-2/+0
| | | | | | While at it; make device_types static if only used in the device type file Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: prepare for adding device handlers dynamicallyArne Kappen2016-08-261-5/+6
| | | | | | | | - remove const from device handler struct - pass device handler type to create function Signed-off-by: Arne Kappen <akappen@inet.tu-berlin.de> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
* alias: Set alias link device status to disabled when device is removedHans Dedecker2016-06-291-1/+3
| | | | | | | | | Fixes missing link state event propagation for an aliased device in case a new device is added as the link state has the last known status of the old device possible resulting into no link state change detection. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Acked-by: Felix Fietkau <nbd@nbd.name>
* device: Fix device find failure in avl list due to device name changeHans Dedecker2016-06-061-6/+3
| | | | | | | | As device name is used as key in avl list a device name change will break the avl find logic. Function device_set_ifname offers api to set the device name and re-inserts the avl node in the list when the avl key value is changed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* alias : Fix interface aliased on top of a static interface not getting activeHans Dedecker2016-03-311-1/+8
| | | | | | | | | | | | | An interfaces referring to a static interface is not getting active when doing a network reload or ifup. The problem is triggered by alias_set_device which is not clearing the pending update (mostly a null device due to the previous down event) when the same device is set as the current device via alias_notify_device. As a result alias_set_device_state when called will overwrite the device with an invalid pending device meaning the interface will not be set available anymore and thus will stay down. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* alias: Fix possible segfaultHans Dedecker2016-02-011-0/+3
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* alias: clean up device dependencies on freeFelix Fietkau2016-01-281-0/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: Link layer state awareness support on interface levelHans Dedecker2014-02-271-4/+12
| | | | | | | | The link layer state is monitored for a given interface; an interface will be setup when both enabled and link layer active. Likewise an interface will be teared down when either disabled or link layer down. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Revert "netifd: Link layer state support on device level"Felix Fietkau2013-12-141-12/+4
| | | | This reverts commit c439b52400978dd3799c66e1f632ee68d2c7c9eb.
* netifd: Link layer state support on device levelHans Dedecker2013-12-081-4/+12
| | | | | | | Patch implements link layer state awareness (aka carrier detection) in netifd on device level. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* alias: set ifindex on alias device to fix setting addresses/routesFelix Fietkau2013-01-281-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* alias: if the underlying device changes (or goes away), set the device ↵Felix Fietkau2013-01-221-0/+1
| | | | | | present status to false to make its users shut down Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* alias: rework device updatesFelix Fietkau2013-01-201-26/+34
| | | | | | Apply immediately if alias device is not claimed, otherwise defer until release Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* alias: use layer 3 device instead of main deviceSteven Barth2013-01-161-1/+1
|
* alias: add (and call) a check_state function to fix dynamically creating ↵Felix Fietkau2012-10-301-17/+39
| | | | | | aliases for interfaces that are already up Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix device_lock/device_unlock imbalancesFelix Fietkau2012-10-191-1/+2
|
* alias: use a callback for managing device presence state, track alias deps ↵Felix Fietkau2012-07-051-2/+20
| | | | in a separate list to avoid recursion issues
* split alias support into a separate source file for better readabilityFelix Fietkau2012-07-051-0/+131