summaryrefslogtreecommitdiff
path: root/vlan.c
Commit message (Collapse)AuthorAgeFilesLines
* device: gracefully handle device names exceeding IFNAMESIZHans Dedecker2018-08-141-8/+14
| | | | | | | | | | | | 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>
* netifd: make sure the vlan ifname fits into the bufferJohn Crispin2018-07-271-0/+3
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* vlan: use alloca to get rid of IFNAMSIZE in vlan_dev_set_name()Hans Dedecker2018-07-171-2/+4
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* replace fall throughs in switch/cases where possible with simple code changesAlexander Couzens2018-07-111-3/+3
| | | | | | | | 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: prepare for adding device handlers dynamicallyArne Kappen2016-08-261-1/+1
| | | | | | | | - 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]
* device: Fix device find failure in avl list due to device name changeHans Dedecker2016-06-061-4/+7
| | | | | | | | 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>
* vlan: Fix possible segfaultHans Dedecker2016-02-011-0/+2
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: Don't process link events anymore in device user specific callback ↵Hans Dedecker2015-11-041-6/+0
| | | | | | | | | | | | | | | handlers Set link_state for all device types via the device_set_link API as all devices are registered in the device tree list making it possible to always get the device via device_get. The decice link state parameter will now actually reflect the corresponding kernel device carrier state in all cases. Before this change a vlan/macvlan device could still have link_state enabled if an interface was brought down; this was the case when the parent vlan/macvlan device was still enabled as the netlink link_state event would be dropped for vlan/macvlan devices due to keep_link_state in the function cb_rtnl_event. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Add old style vlan devices to device listHans Dedecker2015-05-271-1/+1
| | | | | | | | | | | Just like other device types old vlan style devices are added to the device list which means they're displayed when the device list is displayed via ubus. Additionally global device setting config like default packet steering behavior is now also applied for old style vlan devices when doing a network reload. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Revert "vlan: reset device state on init"Felix Fietkau2015-01-241-3/+0
| | | | | | This is causing a regression with some VLAN configurations This reverts commit a4445215e06ee3056427effbef617f4525ee1836.
* vlan: reset device state on initFelix Fietkau2015-01-241-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: make link status detection optional for vlan devicesFelix Fietkau2014-10-201-0/+1
| | | | | | | Fixes a race condition that triggers endless link loss / detect calls when VLAN devices are created. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: Check device_claim return code in all casesHans Dedecker2014-06-181-1/+1
| | | | | | Fixes observed issue a tunnel interface is reported as up although device_claim failed Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Reload proto on topology changeHelmut Schaa2014-03-211-0/+4
| | | | | | | | | | Introduce a new device event "topology change" that gets signaled by bridges on adding/removing members. On "topology changes" the proto handlers are requested to "renew" which is most useful for DHCP. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
* netifd: Link layer state awareness support on interface levelHans Dedecker2014-02-271-3/+10
| | | | | | | | 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-10/+3
| | | | This reverts commit c439b52400978dd3799c66e1f632ee68d2c7c9eb.
* netifd: Link layer state support on device levelHans Dedecker2013-12-081-3/+10
| | | | | | | Patch implements link layer state awareness (aka carrier detection) in netifd on device level. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* vlan: set the name of vlan devices earlierNathan Hintz2013-09-251-3/+3
| | | | | | | | Set the device name earlier so that the logging done inside of 'device_init_virtual' can print the name of the device being initialized (instead of an empty string). Signed-off-by: Nathan Hintz <nlhintz@hotmail.com>
* device: use safe_list for device event, fixes some hang issuesFelix Fietkau2013-04-151-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix ifname for alias+vlan chainsFelix Fietkau2012-07-051-1/+11
|
* make vlan devices virtual to avoid avl tree issues with changing ifnames ↵Felix Fietkau2012-07-051-1/+1
| | | | when bound to alias interfaces
* vlan.c: prevent segfault in get_vlan_device_chain() if the base device does ↵Jo-Philipp Wich2012-07-051-1/+1
| | | | not exist
* add copyright headersFelix Fietkau2012-05-041-0/+13
|
* apply device settings to simple devices with config specified from the ↵Felix Fietkau2011-10-191-0/+1
| | | | interface section (legacy format compatibility), but only if no other config was provided
* always recreate devices by default if the config attribute list is not the ↵Felix Fietkau2011-10-061-0/+1
| | | | default one
* rename a variable for clarityFelix Fietkau2011-10-051-7/+7
|
* make device_claim/device_release operate on the device_user instead of the ↵Felix Fietkau2011-09-041-3/+3
| | | | device to avoid refcount bugs
* s/release_device/device_release/Felix Fietkau2011-07-291-2/+2
|
* s/claim_device/device_claim/Felix Fietkau2011-07-291-1/+1
|
* s/init_device/device_init/Felix Fietkau2011-07-291-1/+1
|
* s/get_device/device_get/Felix Fietkau2011-07-291-1/+1
|
* s/cleanup_device/device_cleanup/Felix Fietkau2011-07-291-1/+1
|
* s/set_device_present/device_set_present/Felix Fietkau2011-07-291-2/+2
|
* s/add_device_user/device_add_user/Felix Fietkau2011-07-291-1/+1
|
* s/remove_device_user/device_remove_user/gFelix Fietkau2011-07-291-1/+1
|
* remove an unnecessary inlineFelix Fietkau2011-03-281-1/+1
|
* Initial importFelix Fietkau2011-03-271-0/+156