summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2016-08-23netifd: track when wdev setup failsEduardo Abinader
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>
2016-08-11Prevent premature device free in interface_claim_deviceFelix Fietkau
interface_set_device_config can trigger a device free (for example if the device is here only present in a bridge), which renders dev invalid and leads to segfault. Add a lock to prevent this and clean-up the code for readability. Signed-off-by: Gino Peeters <peeters.gino@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-08-11utils: Move IP address validation to parse_addr functionHans Dedecker
Commit 7a51f23e adds IP address validation in the function parse_ip_and_netmask; however the added check is too restrictive as the function is used on several places resulting into the problem multicast routes cannot be added anymore via UCI. Therefore move the IP host address validation to the function parse_addr so experimantal/multicast addresses cannot be added as a host IP address while multicast routes can be added again. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-08-11proto: Display proto flags when dumping the protocol handlers in ubusHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-08-11proto-shell: Model config parameter "no-proto-task" as a proto flagHans Dedecker
Export the config parameter "no-proto-task" as a proto flag so it's available for other other netifd modules Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-08-11proto-shell: Support teardown on layer 3 link lossHans Dedecker
Commit c6858766 added interface teardown support on layer 3 device link loss mainly for shell protocols who have no proto task like xl2tp. However for shell protocols having a proto task it is not always the correct action to teardown the interface; as an example the PPP daemon can be put into persist state trying to re-establish the link via a hold-off mechanism if layer 3 link loss is detected. Therefore shell handlers can enable via TEARDOWN_ON_L3_LINK_DOWN a proto flag which will teardown the interface when layer 3 link loss is detected Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-07-29interface: do not process hotplug events for link up eventFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-07-29interface: report link up events for force_link interfacesFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-06-29alias: Set alias link device status to disabled when device is removedHans Dedecker
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>
2016-06-06system-linux: Replace device_get by device_find where appropriateHans Dedecker
Replace device_get by device_find so it's clear a device needs to be found present in the device list. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-06-06device: Fix dotted vlan interface staying downHans Dedecker
Using the config below a dotted vlan interface stays down as get_vlan_device does not find the device due to the aliased device stacked on top of the base device. As all devices; aliased devices being the exception; are in the device list use device_find to find the device when setting the link state config interface 'test' option proto 'static' option ipaddr '192.168.2.1' option netmask '255.255.255.0' config interface 'test2' option ifname '@test.1' option proto 'dhcp' Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-06-06device: Fix device find failure in avl list due to device name changeHans Dedecker
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>
2016-06-01netifd: Add option to configure gc_stale_time for each deviceAlin Năstac
The UCI parameter neighgcstaletime allows to control how much time will STALE entries be kept in the neighbour table for both IPv4 and IPv6. Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
2016-05-22bridge: make learning and unicast-flood configurable per bridge portLinus Lüssing
Tuning these two options allows a more fine grained configuration of the forwarding database (fdb) of a bridge. The former allows to enable or disable the learning of the presence of MAC addresses behind a bridge port. (default: enabled on all ports) The latter allows to tune the behaviour in case a destination MAC address of a frame is unknown to the fdb, like only flooding on specific ports or not flooding on any port. (default: flood on all ports, except incoming) This can be useful to create a dumb hub, for instance for monitoring purposes. Or in larger layer 2 mesh networks to avoid keeping redundant databases (e.g. with the batman-adv translation table). Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2016-03-31alias : Fix interface aliased on top of a static interface not getting activeHans Dedecker
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>
2016-03-30Revert "add prelocal table to manipulate locally destinated traffic"Jo-Philipp Wich
Revert commit 3eea8576d48d9b20cc1c6b46f54c7345a39d13aa since it changes the default behaviour of user ip rules in unexpected ways. When an ip rule is added without an explicit priority then the kernel will use the priority value of the 2nd rule, decreased by one. On an ordinary system, the 2nd rule usually is "from all lookup main" with priority 32766 which means that user rules are added beginning with priority 32765 in decreasing order. Since the introduction of the prelocal rule at prio 0 and the subsequent moving of "from all lookup local" to prio 1, the kernel will insert all user rules with priority 0, between the prelocal and local lookup rules, leading to broken routing in many common scenarios. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-03-07bridge: multicast: Export some parameters RFCs suggest to be tunableLinus Lüssing
RFCs suggest some parameters of IGMP and MLD to be configurable by the administrator. With this patch the following parameters are configurable: * robustness (default: 2) * query_interval (default: 12500 [125s]) * query_response_interval (default: 1000 [10s]) * last_member_interval (default: 100 [1s]) Depending on the size and nature of the network topology administrators might want to increase or decrease these parameters. netifd will take care of configuring any other parameters which are dependant on the ones above and set them according to the formulas provided in the RFCs. These parameters of the bridge are membership_interval, querier_interval, startup_query_interval, startup_query_count and last_member_count. RFCs allow setting three more parameters to be configurable: startup_query_interval, startup_query_count and last_member_count. However this patch does not export them, as they can be indirectly tuned via the given, exported four parameters, too. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
2016-03-07utils.c: Add ip address validationNaresh Kumar Mehta
Do not allow configuring invalid IPv4/IPv6 addresses. Curently if I configure LAN IP Address as 224.1.1.1, netifd will configure it. e.g. uci set network.lan.ipaddr='224.1.1.1' uci commit /etc/init.d/network restart Now ifconfig br-lan returns br-lan Link encap:Ethernet HWaddr 00:03:7F:13:BA:17 inet addr:224.1.1.1 Bcast:224.1.1.255 Mask:255.255.255.0 which is wrong. If I use ifconfig eth1 224.1.1.1, I will get ifconfig: SIOCSIFADDR: Invalid argument it means ifconfig is working fine, whereas netifd not. Proposed patch will test IPv4 address to make sure it is class A/B/C only. Similarly IPv6 multicast addresses will not be allowed. Signed-off-by: Naresh Kumar Mehta <naresh@codeaurora.org>
2016-03-04system-linux: fix build errorJo-Philipp Wich
The libnl-tiny library does not provide a nla_put_be32(), use nla_put_u32() again in conjunction with htonl() to convert the values. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-03-04system-linux: Fix VTI ikey/okey on little endian systemsJo-Philipp Wich
The kernel expects the IFLA_VTI_IKEY and IFLA_VTI_OKEY netlink attributes to be in network byte order, so ensure that the values are stored accordingly. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-02-20interface-ip: Don't handle external addresses and routesHans Dedecker
Prevent external routes and address being added or deleted when changing the state of the interface ip settings Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01device: Fix null pointer derefence if device is unsetHans Dedecker
Fix null pointer deference in device_claim if device is unset in device_user struct. Typically this is observed when the parent device is removed from (mac)vlan device config followed by a network reload Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01device: Support multicast config optionHans Dedecker
Make multicast device flag configurable by extending device attributes with the multicast attribute Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Nick Podolak <nicholas.podolak@dtechlabs.com>
2016-02-01alias: Fix possible segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01system-linux: Fix memory leakHans Dedecker
Call globfree to free dynamically allocated storage from a previous glob call Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01proto: Fix possible segfaultsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01handler: Fix memory leakHans Dedecker
Call globfree to free dynamically allocated storage from a previous glob call Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01interface-event: Fix possible out of bounds array accessHans Dedecker
The array eventnames is of size 3 while the interface_event type may use the indexes 3 or 4. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01interface-ip: Fix possbile segfaultsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01interface: Fix possbile segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01proto-shell: Fix possible segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01proto: Fix possible buffer overflow due to non null terminated stringHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01tunnel: Fix possible segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01tunnel: Fix uninitialized accessHans Dedecker
Fix tb_dev uninitialized access by device_init_settings Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01ubus: Fix possible segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01vlan: Fix possible segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01device: Fix possible segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-01-28netifd: Route traffic from LAN to WAN using rulesKristian Evensen
After commit ebd3d8417c7a ("interface: fix moving interface address routes to the table specified by ip[46]table"), it is no longer possible for clients on LAN to reach machines on the WAN. This patch restores support for clients on LAN reaching clients on WAN by using rules. The rules are placed after the address rules, in order to make sure that traffic originating from the router is routed correctly. Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2016-01-28alias: clean up device dependencies on freeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-19wireless: rename 'wpa_pairwise' variable to 'wpa_cipher'Daniel Golle
We shall enforce the cipher for both, pairwise and group, thus change the name of the variable to a more generic phrasing, 'cipher' instead of 'pairwise'. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Felix Fietkau <nbd@openwrt.org> [keep a copy for compatibility reasons]
2016-01-17netifd/system-linux: add VTI tunnel supportAndré Valentin
This patch adds support for VTI interfaces. VTI interfaces can be used to tunnel IPsec ESP traffic to a device so common firewall zones may be used. This also enables routing protocols to work over IPsec tunnels. Signed-off-by: André Valentin <avalentin@marcant.net>
2016-01-17netifd: Do not add local/source policy rules multiple timesKristian Evensen
interface_ip_set_enabled() is usually called two times right after one another, once to handle config_ip and once to handle proto_ip. As long as ip->iface->l3_dev.dev is set, the local/source policy rules are updated. This value is in several cases set on both config_ip and proto_ip, causing the rules to be added multiple time. The reason is that the kernel does not respect the NLM_F_* flag for rules. In other words, the rule state has to be managed by the routing daemon. Since the local/source policy rules are bound to iface, this commit solves the problem by adding a flag to interface which stores the current rule state. The flag follows the enabled-paramter passed to interface_ip_set_enabled(), similar to route-> and addr->enabled. The flag breaks the alignment of the interface struct, but based on earlier commits this seems to be ok. I have tested the patch in different configurations and have not found any regression. Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2016-01-09system: mark tunnel_attr_list as externFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-09wireless: mark wireless_drivers/wireless_devices as externFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-19interface: Trigger interface update event when interface data is updated via ↵Hans Dedecker
ubus Interface update event will trigger an interface hotplug event and an ubus notify event which will inform subscribers about the updated interface data field Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-12-17interface: toggle proto_ip along with config_ip to fix ordering issues with ↵Felix Fietkau
routes/rules added dynamically Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-16interface-ip: unify handling of interface metric/table for routes, fixes ↵Felix Fietkau
handling for prefixes Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-15interface-ip: fix subnet route handlingFelix Fietkau
When the kernel subnet route has to be replaced, the cleanup call needs to match the properties of the replacement route exactly, mainly the metric and the routing table. Fix handling this by embedding the device_route for the subnet in the device_addr struct and using it in the cleanup path. This fixes issues on config reload with changes to the routing table Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-15interface-ip: move struct device_addr below struct device_routeFelix Fietkau
This is needed to embed the subnet route in struct device_addr Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-12-02wireless: call wireless_interface_handle_link before updating vif configFelix Fietkau
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>