summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* system-linux: handle hotplug event socket ENOBUFS errorsopenwrt-18.06Alin Nastac2019-01-311-6/+47
| | | | | | | | | Hotplug events are no longer handled after socket RX queue is overrun. The issue has been fixed by: - setting SO_RCVBUF initially to 65535 - doubling SO_RCVBUF value each time RX queue gets overrun Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
* iprule: fix segfault (FS#1875)Hans Dedecker2018-10-071-6/+2
| | | | | | | | | | | | Fix segfault in generic_interface_cb by checking the IPRULE_OUT/IPRULE_IN flags before doing the strcmp for the possible configured out/in interface(s) of the ip rule. Also don't copy the interface layer3 device as the layer 3 device is not yet known when IFEV_CREATE event is launched. The layer3 device will be known when the IFEV_UP event is processed in rule_out_cb/rule_in_cb. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* fix compile errorJohn Crispin2018-07-301-1/+0
| | | | | | netifd-2018-07-30-75ee7905/interface-ip.c:724:11: error: unused variable 'macaddr' [-Werror=unused-variable] Signed-off-by: John Crispin <john@phrozen.org>
* interface-ip: fix eui64 ifaceid generation (FS#1668)Hans Dedecker2018-07-301-2/+2
| | | | | | | | Use the mac address stored in the device_settings struct to generate the eui64 ifaceid as the interface layer3 device does not contain a mac address for non bridge interfaces 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>
* iprule: remove bogus assert callsFelix Fietkau2018-07-251-3/+0
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* iprule: fix broken in_dev/out_dev checksFelix Fietkau2018-07-251-2/+2
| | | | | | Since they are both char arrays, they can never be NULL Signed-off-by: Felix Fietkau <nbd@nbd.name>
* 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>
* ubus: display correct prefix size for IPv6 prefix addressHans Dedecker2018-07-161-1/+1
| | | | | | | Make sure the displayed prefix size is identical to the kernel installed prefix size for local IPv6 prefix addresses Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* CMakeLists.txt: add -Wimplicit-fallthrough to the compiler flagsAlexander Couzens2018-07-111-1/+1
| | | | | Signed-off-by: Alexander Couzens <lynxis@fe80.eu> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
* proto-shell.c: add a explicit "fall through" comment to make the compiler happyAlexander Couzens2018-07-111-1/+2
| | | | | Signed-off-by: Alexander Couzens <lynxis@fe80.eu> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
* replace fall throughs in switch/cases where possible with simple code changesAlexander Couzens2018-07-113-16/+19
| | | | | | | | 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>
* iprule: rework interface based rules to handle dynamic interfacesAlexander Couzens2018-07-052-21/+164
| | | | | | | | | | | | | Previous netifd would only apply `ip rule`s while config phase. If the iprule is depending on an interface (iif or oif), the rule will fail if the interface is not up. Allow iprules to track interfaces and their devices by using the interface events. Fixes: FS#1571 Acked-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* Introduce new interface event "create" (IFEV_CREATE)Alexander Couzens2018-07-053-0/+4
| | | | | | | "create" will be called before the proto handlers initialised. Acked-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* system-linux: fix build error on older kernelsFelix Fietkau2018-07-041-0/+2
| | | | | | | Add an #ifdef guard around 56000base* definitions, which don't exist on Linux 3.18 Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system-linux: adjust bridge isolate mode for upstream attribute namingFelix Fietkau2018-07-041-3/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system-linux: extend link mode speed definitionsHans Dedecker2018-07-041-6/+22
| | | | | | Add all available link mode speed definitions as defined in ethtool.h Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: add autoneg and link-partner outputJoe Holden2018-06-281-0/+6
| | | | | | | | | | This adds an array that contains the link modes advertised by the other device and also indicates whether auto negotiation is true or false. link-partner may or may not be populated depending on hardware, driver and/or settings. Signed-off-by: Joe Holden <jwh@zorins.co.uk> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: make encaplimit configurable for ip6 tunnels (FS#1501)Hans Dedecker2018-05-303-18/+50
| | | | | | | | | | | | | Make encapsulation limit of IP6 tunnels configurable for the ds-lite/map proto shell handlers as not all ISPs support the destination option header containing the tunnel encapsulation limit value as reported in FS#1501. The IP6 tunnel specific setting encaplimit is parsed as a nested json data object; setting it to ignore disables the insertion of the destination option header while a value from 0 till 255 sets the tunnel encapsulation limit accordingly in the destination option header. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* nterface-ip: remove superfluous iface check in interface_ip_set_enabled()Hans Dedecker2018-04-261-1/+1
| | | | | | | | No need to check iface pointer in interface_ip_set_enabled as the interface is always set by the function __interface_ip_init(). Reported by Coverity in CID 1330437 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: fix strncpy boundsHans Dedecker2018-04-241-8/+8
| | | | | | | Fix strncpy bounds as reported by Coverity in CID 1434988, 1328977, 1328953, 1328952, 1328951, 1328950, 1328949 and 1328944. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* wireless: include noscan option in common wdev varsDaniel Golle2018-04-201-1/+1
| | | | | | | 'noscan' can be passed down to wpa_supplicant to enforce channel settings in mesh mode. Allow hostapd.sh to take care of it. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* system-linux: check ioctl return value in system_vlan()Hans Dedecker2018-04-161-1/+2
| | | | | | Detected by Coverity in CID 1433754 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: check ioctl return value in system_if_flags()Hans Dedecker2018-04-141-1/+3
| | | | | | Detected by Coverity in CID 1433760 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: fix segfault on alloc failure in system_if_check()Hans Dedecker2018-04-141-0/+3
| | | | | | Detected by Coverity in CID 1433686 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: fix segfault on error in system_add_ip6_tunnel()Hans Dedecker2018-04-141-1/+10
| | | | | | Detected by Coverity in CID 1430884 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* handler: fix resource leak on error in netifd_init_script_handlers()Hans Dedecker2018-04-121-1/+6
| | | | | | Detected by Coverity in CID 1412486 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: remove unnecessary open call in system_if_dump_info()Hans Dedecker2018-04-121-7/+2
| | | | Detected by coverity in CID 1329735
* system-linux: fix memory leak on error in system_add_vxlan()Hans Dedecker2018-04-121-2/+4
| | | | | | Detected by coverity in CID 1412449 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: fix memory leak on error in interface_update_prefix_assignments()Hans Dedecker2018-04-121-1/+3
| | | | | | Detected by coverity in CID 141267 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: fix "ifup-failed" hotplug event handlingMartin Schiller2018-04-101-2/+8
| | | | | | | | | | The ifup-failed event should only be triggered when the former interface state is IFS_SETUP. Otherwise, there will also be an ifup-failed event in the IFS_TEARDOWN stateif you do an manual ifdown <IFC>. Signed-off-by: Martin Schiller <ms@dev.tdt.de>
* interface-ip: fix memory leak in interface_ip_add_target_route()Hans Dedecker2018-04-021-16/+16
| | | | | | | | | | Commit 9c8d781 introduced a memory leak in interface_ip_add_target_route in case interface_ip_find_addr_target returns true for a given address by not freeing the previously allocated route. While at it rework the logic so a host route is only allocated when it's really required. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: return the interface for locally addressable host dependencies (FS#1452)Felix Fietkau2018-03-271-3/+2
| | | | | | | | Fixes an issue where interfaces with host dependencies that resolve to a local subnet stay down. Fixes: 1f5a29c3de6e ("ip: do not add local routes for host dependencies") Signed-off-by: Felix Fietkau <nbd@nbd.name>
* interface-ip: fix route selection for host dependenciesFelix Fietkau2018-03-131-1/+1
| | | | | | | | | | In order to find the best match, allow overriding the last found entry if route->mask for the new entry is bigger than the one from the previous entry. Patch submitted by 'Mikael' in FS#1358 Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: add support for setting the isolate options for bridge portsFelix Fietkau2018-03-133-0/+18
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ip: do not add local routes for host dependenciesFelix Fietkau2018-03-071-2/+1
| | | | | | | This avoids creating invalid routes in cases where another daemon is handling local routes for an interface, e.g. on mesh interfaces Signed-off-by: Felix Fietkau <nbd@nbd.name>
* remove rps/xps configuration supportFelix Fietkau2018-02-264-137/+1
| | | | | | | | It is overly complex, yet does not cover common scenarios very well. It will be replaced with a simpler shell script that provides a better default policy Signed-off-by: Felix Fietkau <nbd@nbd.name>
* netifd-proto: add proto_config_add_array wrapperHans Dedecker2018-02-051-0/+4
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: VXLAN: add options to enable and disable UDP checksumsMatthias Schiffer2018-01-243-0/+15
| | | | Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* proto: allow dumping protocol handlers without config_paramsOlof Sivertsson2018-01-031-1/+1
| | | | | | | | | | When ubus invokes proto_dump_handlers, and a struct proto_handler has been added with a NULL config_params, a segmentation fault occurs. Avoid this segmentation fault by checking for a NULL config_params before further access. Signed-off-by: Olof Sivertsson <olof.sivertsson@zenterio.com>
* interface-ip: harden eui64 IPv6 prefix address generationHans Dedecker2017-12-153-5/+24
| | | | | | | | | | | Check if a mac address is actually present when generating an eui64 based IPv6 address; in case of failure bail out. At the same time make sure the active mac address is used as input for the eui64 based IPv6 address and guarantee IPv6 prefix address generation is based on the actual config by resetting the IPv6 prefix address in the assignment structure when it gets deleted. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: fix race condition in IPv6 prefix address generationHans Dedecker2017-12-151-14/+19
| | | | | | | | | | | Don't generate an IPv6 prefix address without taking into account the interface state. In case eui64 is configured to generate the ifaceid this could fail as the layer3 device mac address could not yet be available if the interface is not yet in setup or up state. While at it remove the interface metric assignment as this is already done by the function interface_set_route_info. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* handler: replace is_error() helper with NULL checkAlexandru Ardelean2017-12-101-1/+1
| | | | | | | | | | The `is_error()` is just a macro that checks that object is NULL (which is considered an error in libjson-c terminology). Newer libjson-c versions have deprecated this. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* interface-ip: add missing IPv6 policy ruleHans Dedecker2017-11-171-6/+16
| | | | | | | | | | | | | | Commit 2f31bff38d4dc2f36006ded6b8a7d039cb569eaa added interface routing table support; as a result for IPv6 the prefix route linked to the IPv6 address is added to the specified IPv6 interface routing table. In order to route traffic having as destination the IPv6 prefix a policy rule is required using the prefix destination as policy so the traffic is passed to the correct routing table. The IPv6 prefix address logic was not installing this policy rule effectively breaking routing when trying to reach a global or ULA IPv6 address in the lan from either the device or another wan device. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* proto: add point-to-point IPv4 address config support (FS#1037)Hans Dedecker2017-10-182-8/+22
| | | | | | | | | | | | Add config support support for point-to-point IPv4 addresses by providing the uci parameter ptpaddr. This allows to support a gateway being in a different subnet than the assigned IP by modeling the local IP having a point-to-point address. This is similar to the point-to-point IPv4 address support already present for the protocol handlers. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
* ubus: display the point-to-point IPv4 addressHans Dedecker2017-10-181-0/+6
| | | | | | | Display the point-to-point IPv4 address as well when dumping the IP address list in ubus. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* ubus: fix ubus error code on reload failureHans Dedecker2017-10-071-1/+1
| | | | | | | Return the more approriate error code UBUS_STATUS_NOT_FOUND in case network reload fails Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* config: suppress error if no wireless config present (FS#1030)Hans Dedecker2017-10-061-2/+9
| | | | | | | | | | Wireless config is optional as not all targets have a wireless interface; therefore don't report an error if the wireless config is missing so network reload is not reporting an error to the user. While at it use netifd_log_message to print an error if the config cannot be loaded. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: add support for hotplug event 'move'Martin Schiller2017-10-061-3/+27
| | | | | | | | | | If you rename a network interface, there is a move uevent invoked instead of remove/add. This patch adds support for this kind of event. Signed-off-by: Martin Schiller <ms@dev.tdt.de> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: parse map-e fmrs parameters as nested data json objectHans Dedecker2017-08-293-31/+73
| | | | | | | | Parse map-e fmrs parameters IPv6 prefix, IPv4 prefix, ealen and offset as array elements nested in a data json object. At the same time remove the now obsolete TUNNEL_ATTR_FMRS tunnel attribute. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>