summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2018-04-14system-linux: fix segfault on alloc failure in system_if_check()Hans Dedecker
Detected by Coverity in CID 1433686 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-04-14system-linux: fix segfault on error in system_add_ip6_tunnel()Hans Dedecker
Detected by Coverity in CID 1430884 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-04-12handler: fix resource leak on error in netifd_init_script_handlers()Hans Dedecker
Detected by Coverity in CID 1412486 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-04-12system-linux: remove unnecessary open call in system_if_dump_info()Hans Dedecker
Detected by coverity in CID 1329735
2018-04-12system-linux: fix memory leak on error in system_add_vxlan()Hans Dedecker
Detected by coverity in CID 1412449 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-04-12interface-ip: fix memory leak on error in interface_update_prefix_assignments()Hans Dedecker
Detected by coverity in CID 141267 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-04-10interface: fix "ifup-failed" hotplug event handlingMartin Schiller
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>
2018-04-02interface-ip: fix memory leak in interface_ip_add_target_route()Hans Dedecker
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>
2018-03-27netifd: return the interface for locally addressable host dependencies (FS#1452)Felix Fietkau
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>
2018-03-13interface-ip: fix route selection for host dependenciesFelix Fietkau
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>
2018-03-13device: add support for setting the isolate options for bridge portsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2018-03-07ip: do not add local routes for host dependenciesFelix Fietkau
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>
2018-02-26remove rps/xps configuration supportFelix Fietkau
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>
2018-02-05netifd-proto: add proto_config_add_array wrapperHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-01-24system-linux: VXLAN: add options to enable and disable UDP checksumsMatthias Schiffer
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2018-01-03proto: allow dumping protocol handlers without config_paramsOlof Sivertsson
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>
2017-12-15interface-ip: harden eui64 IPv6 prefix address generationHans Dedecker
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>
2017-12-15interface-ip: fix race condition in IPv6 prefix address generationHans Dedecker
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>
2017-12-10handler: replace is_error() helper with NULL checkAlexandru Ardelean
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>
2017-11-17interface-ip: add missing IPv6 policy ruleHans Dedecker
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>
2017-10-18proto: add point-to-point IPv4 address config support (FS#1037)Hans Dedecker
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>
2017-10-18ubus: display the point-to-point IPv4 addressHans Dedecker
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>
2017-10-07ubus: fix ubus error code on reload failureHans Dedecker
Return the more approriate error code UBUS_STATUS_NOT_FOUND in case network reload fails Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-10-06config: suppress error if no wireless config present (FS#1030)Hans Dedecker
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>
2017-10-06system-linux: add support for hotplug event 'move'Martin Schiller
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>
2017-08-29system-linux: parse map-e fmrs parameters as nested data json objectHans Dedecker
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>
2017-08-22allow setting rps/xps defualt values via uciJohn Crispin
Signed-off-by: John Crispin <john@phrozen.org>
2017-08-21system: remove unused 6rd tunnel attributesHans Dedecker
Commit 7573880ac042c6e5c8d48b1ad83d357b5e02743b added support for 6rd attributes as a nested json data object which makes the attributes TUNNEL_ATTR_6RD_PREFIX and TUNNEL_ATTR_6RD_RELAY_PREFIX unused Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-08-17netifd: allow negative neighlocktime valuesAlin Năstac
When -1 is written in /proc/sys/net/ipv4/neigh/<iface>/locktime, kernel disables ARP trashing protection. A value of 0 does not completely disable this protection, a second ARP update being discarded if it is processed during the same jiffie as the first update. Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
2017-08-15system-linux: parse ipv6 specific tunnel settings as nested data jsonHans Dedecker
object
2017-07-21system-linux: fix GRE ikey/okey endiannessStijn Tintel
The kernel expects IFLA_GRE_IKEY and IFLA_GRE_OKEY to be in network byte order, so convert the values from host byte order. Fixes ikey/okey on little endian systems. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2017-06-26netifd: Fix printf calls + function declarations.Rosen Penev
cppcheck found printf functions with signed instead of unsigned formats. Fix those as well as some non-matching function declarations. Signed-off by: Rosen Penev <rosenp@gmail.com>
2017-06-17ubus: remove superfluous error check in netifd_add_dynamicHans Dedecker
Check for main device and main device having default config for a dynamic interface was orginally added in commit 266d92dd83bd5bfe520f3e2838794bf9bb827c07 with as purpose to set the device config. The latter was later removed in commit 4bf89afc22b43d5bd155d32d3998348a77179c1a which makes the device checks superfluous. Also not all interfaces have a main device (eg tunnel interfaces) resulting into netifd_add_dynamic returning an error code when such interfaces are added. As an example 6rd interfaces dynamically added by the DHCP script the log messages are cluttered with the trace 'wan (7803): Command failed: Unknown error' after each DHCP renew. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-06-11iprule: coding style line upHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-06-11iprule: Add option to suppress unspecific routing lookupsStefan Tomanek
After applying this patch, policy routing rules can be employed that ignore parts of a routing table. The following config snippet ignores routing lookups from the specified main routing table yielding the default route, passing the lookup process on to the next rule (that might provide a special default route for marked packets): config rule option priority 10 # check main routing table first, but ignore default route result option lookup main option suppress_prefixlength 0 config rule option priority 11 # use special routing table for marked packets # (unless already consumed by previous rule) option mark 0xFF option lookup 100 The result is a ruleset like this (only visible using the full 'ip' binary): # ip rule 0: from all lookup local 10: from all lookup main suppress_prefixlength 0 11: from all fwmark 0xff lookup 100 32766: from all lookup main 32767: from all lookup default # Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
2017-05-27system-linux: fix 6rd regressionHans Dedecker
Fix 6rd regression introduced in commit 7573880ac042c6e5c8d48b1ad83d357b5e02743b Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-22system-linux: parse 6rd specific settings as nested json data objectHans Dedecker
Parse 6rd specific settings prefix, relay-prefix as nested json data objects. At the same time improve 6rd error handling. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-05-19system-linux: remove redundant check for strtoul() return valueKhem Raj
Fixes system-linux.c:1998:33: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-compare] Signed-off-by: Khem Raj <raj.khem@gmail.com>
2017-05-09build: disable unknown warning option error in clangFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-05-09interface: add new "ifup-failed" hotplug eventMartin Schiller
This hook makes it possible to do some helper work in hotplug scripts when a connection is not established successfully. example: try several username/passwords from a pool to establish a pppoe or wwan connection by replacing the configured values of the connection in a hotplug script. Signed-off-by: Martin Schiller <ms@dev.tdt.de>
2017-05-09bridge: reset primary only after marking the member not presentAlex Oprea
Run the bridge_reset_primary function only after the member being removed has been marked as not present. This change prevents the bridge_reset_primary function from choosing the member being removed as the new primary member. Signed-off-by: Alex Oprea <alex.oprea@inteno.se>
2017-05-04build: suppress format truncation warnings to avoid errors with gcc7Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-04-22ubus: add interface method to trigger renew eventMatthias Schiffer
Not all topology or connectivity changes may be detected by netifd, depending on the underlying technology (e.g. VPN software); this adds a way to explicitly trigger a renew. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
2017-04-14system-linux: allow "throw" route typeMatthias Schiffer
system_rtn_aton() was already parsing "throw" correctly, but system_rt() did now allow it. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2017-04-05netifd: propagate error code on netifd_reload()Alexandru Ardelean
The context is that we generate some of the UCI config for netifd via scripts/programs. Every once in a while, there's a goof when doing that UCI generation, and netifd prints out the error at stderr, but returns 0 (success) err-code. This change will fail the ubus call if UCI config is invalid or missing for /etc/config/network. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com> Acked-by: Hans Dedecker <dedeckeh@gmail.com>
2017-04-05interface-ip: fix device name for IPv6 link-local DNS serverHans Dedecker
Commit 235a02424c3ab1b59308895c4f00395dacf2557c adds support for IPv6 link-local DNS server by appending the device name; however the interface ifname parameter does not always contain the layer 3 device name (e.g it can hold the aliased interface name) Fix this by passing the device name of the referenced layer 3 device. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-03-21interface-ip: set prefix indicator flag when IPv6 prefix lifetime changesHans Dedecker
Trigger interface update event when IPv6 prefix lifetime changes by setting the prefix indicator flag to inform external subsystems (eg hnetd) about IPv6 prefix lifetime changes. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-03-21system-linux: parse vti specific settings as nested json data objectHans Dedecker
Parse vti specific settings ikey and okey as nested json data object. At the same time remove the now obsolete TUNNEL_ATTR_INFO attribute. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-03-21system-linux: parse gre specific settings as nested json data objectHans Dedecker
Parse gre specific settings ikey, okey, icsum, ocsum, iseqno and oseqno as nested json data object Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-03-07system-linux: add VXLAN supportMatthias Schiffer
VXLAN shares many attributes with the tunnel devices, so it is implemented as a new tunnel type. The 'remote' attribute can be used for an unicast peer or a multicast group. The IANA-assigned port 4789 is used by default, instead of the non-standard port Linux defaults to. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Acked-by: Hans Dedecker <dedeckeh@gmail.com>