summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* tunnel: Use tunnel as device type nameHans Dedecker2016-09-261-1/+1
| | | | | | Fixes creation of tunnel devices by UCI due to device handlers rework Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* macvlan: Use macvlan as device type nameHans Dedecker2016-09-261-1/+1
| | | | | | Fixes creation of macvlan devices by UCI due to device handlers rework Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: Make bridge_device_type staticHans Dedecker2016-09-263-3/+2
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: Move the different device type registrations to the device type fileHans Dedecker2016-09-267-17/+26
| | | | | | While at it; make device_types static if only used in the device type file Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-event: Don't dequeue hotplug event in case of interface reload eventHans Dedecker2016-09-141-1/+2
| | | | | | | | | | | | | | Dropping hotplug event in case of interface reload results into hotplug scripts not being being run for the interface and thus external actors not being informed about the actual state of the interface. This is clearly visible if the interface auto parameter is set to disabled for multiple interfaces resulting into no hotplug down event for all interfaces. Therefore don't flush the interface hotplug queue in case an interface reload event is observed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: DNS name server sorting support in resolv.conf.autoHans Dedecker2016-09-144-13/+68
| | | | | | | | | | | | | | | | | | Interface name servers when being written to resolv.conf.auto are sorted based on the following parameters: -Primary sorting key is interface dns_metric; name servers having lowest interface dns_metric are listed first -Secondary sorting key is interface metric; in case of equal interface dns_metric name servers having lowest interface metric are listed first -Finally alphabetical order of the interface names in case of equal interface dns_metric and metric In case the resolver queries the multiple servers in the order listed; sorting is usefull in the following scenarios : -Name resolving over a main and backup interface -Assign priority to IPv6 name servers over IPv4 or vice versa Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: Allow setting multicast_fast_leave_optionHans Dedecker2016-09-143-0/+21
| | | | | | | | | | | | | | | | Setting the multicast_fast_leave option of a bridge allows to control the forwarding of multicast traffic when an IGMP/MLD leave is received. In case multicast_leave_option is enabled and a leave is received the multicast membership will immediately be dropped on the bridge port while in the other case the multicast membership will time out in the bridge. This could be usefull in scenarios where explicit multicast membership host tracking is not supported in the upstream network. In this case the multicast stream is still flowing after a leave is received resulting into possible bandwidth saturation on the lan if a new stream is joined as multiple multicast streams are received. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: add device handler listArne Kappen2016-08-264-21/+68
| | | | | | | | Device handlers now also declare if they have bridge capabilities and include a string to prefix device names for their types. Signed-off-by: Arne Kappen <akappen@inet.tu-berlin.de> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup/fixes]
* device: prepare for adding device handlers dynamicallyArne Kappen2016-08-2610-42/+53
| | | | | | | | - 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]
* wireless: remove config_autostartEduardo Abinader2016-08-252-3/+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-232-5/+14
| | | | | | | | | | | 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>
* Prevent premature device free in interface_claim_deviceFelix Fietkau2016-08-111-0/+4
| | | | | | | | | | | 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>
* utils: Move IP address validation to parse_addr functionHans Dedecker2016-08-112-23/+16
| | | | | | | | | | | 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>
* proto: Display proto flags when dumping the protocol handlers in ubusHans Dedecker2016-08-111-0/+7
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto-shell: Model config parameter "no-proto-task" as a proto flagHans Dedecker2016-08-112-3/+4
| | | | | | | 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>
* proto-shell: Support teardown on layer 3 link lossHans Dedecker2016-08-114-1/+9
| | | | | | | | | | | | | 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>
* interface: do not process hotplug events for link up eventFelix Fietkau2016-07-291-0/+4
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* interface: report link up events for force_link interfacesFelix Fietkau2016-07-293-3/+18
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* 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>
* system-linux: Replace device_get by device_find where appropriateHans Dedecker2016-06-062-2/+2
| | | | | | | 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>
* device: Fix dotted vlan interface staying downHans Dedecker2016-06-063-2/+11
| | | | | | | | | | | | | | | | | | | 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>
* device: Fix device find failure in avl list due to device name changeHans Dedecker2016-06-064-14/+36
| | | | | | | | 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>
* netifd: Add option to configure gc_stale_time for each deviceAlin Năstac2016-06-013-0/+56
| | | | | | | 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>
* bridge: make learning and unicast-flood configurable per bridge portLinus Lüssing2016-05-223-0/+42
| | | | | | | | | | | | | | | | | | 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>
* 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>
* Revert "add prelocal table to manipulate locally destinated traffic"Jo-Philipp Wich2016-03-301-14/+0
| | | | | | | | | | | | | | | | | | | 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>
* bridge: multicast: Export some parameters RFCs suggest to be tunableLinus Lüssing2016-03-073-16/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* utils.c: Add ip address validationNaresh Kumar Mehta2016-03-071-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* system-linux: fix build errorJo-Philipp Wich2016-03-041-2/+2
| | | | | | | 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>
* system-linux: Fix VTI ikey/okey on little endian systemsJo-Philipp Wich2016-03-041-2/+2
| | | | | | | 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>
* interface-ip: Don't handle external addresses and routesHans Dedecker2016-02-201-0/+6
| | | | | | | 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>
* device: Fix null pointer derefence if device is unsetHans Dedecker2016-02-011-3/+10
| | | | | | | | 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>
* device: Support multicast config optionHans Dedecker2016-02-013-0/+21
| | | | | | | | 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>
* alias: Fix possible segfaultHans Dedecker2016-02-011-0/+3
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: Fix memory leakHans Dedecker2016-02-011-0/+2
| | | | | | Call globfree to free dynamically allocated storage from a previous glob call Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto: Fix possible segfaultsHans Dedecker2016-02-011-0/+9
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* handler: Fix memory leakHans Dedecker2016-02-011-1/+5
| | | | | | Call globfree to free dynamically allocated storage from a previous glob call Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-event: Fix possible out of bounds array accessHans Dedecker2016-02-011-1/+1
| | | | | | | 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>
* interface-ip: Fix possbile segfaultsHans Dedecker2016-02-011-7/+18
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: Fix possbile segfaultHans Dedecker2016-02-011-0/+3
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto-shell: Fix possible segfaultHans Dedecker2016-02-011-0/+5
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto: Fix possible buffer overflow due to non null terminated stringHans Dedecker2016-02-011-1/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* tunnel: Fix possible segfaultHans Dedecker2016-02-011-0/+3
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* tunnel: Fix uninitialized accessHans Dedecker2016-02-011-3/+2
| | | | | | Fix tb_dev uninitialized access by device_init_settings Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* ubus: Fix possible segfaultHans Dedecker2016-02-011-0/+3
| | | | 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: Fix possible segfaultHans Dedecker2016-02-011-0/+3
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Route traffic from LAN to WAN using rulesKristian Evensen2016-01-282-20/+33
| | | | | | | | | | | | 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>
* alias: clean up device dependencies on freeFelix Fietkau2016-01-281-0/+2
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>