device: prepare for adding device handlers dynamically - 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 change 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 segfault Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
device: Don't process link events anymore in device user specific callback 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 list 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" This is causing a regression with some VLAN configurations This reverts commit a4445215e06ee3056427effbef617f4525ee1836.
vlan: reset device state on init Signed-off-by: Felix Fietkau <nbd@openwrt.org>
device: make link status detection optional for vlan devices 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 cases 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 change 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 level 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" This reverts commit c439b52400978dd3799c66e1f632ee68d2c7c9eb.
netifd: Link layer state support on device level 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 earlier 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 issues Signed-off-by: Felix Fietkau <nbd@openwrt.org>
fix ifname for alias+vlan chains
make vlan devices virtual to avoid avl tree issues with changing ifnames when bound to alias interfaces
vlan.c: prevent segfault in get_vlan_device_chain() if the base device does not exist
add copyright headers
apply device settings to simple devices with config specified from the interface section (legacy format compatibility), but only if no other config was provided