summaryrefslogtreecommitdiff
path: root/system-linux.c
Commit message (Collapse)AuthorAgeFilesLines
* system-linux: handle hotplug event socket ENOBUFS errorsAlin 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>
* system-linux: get rid of SIOCSDEVPRIVATEHans Dedecker2018-12-131-19/+41
| | | | | | | | | | Use sysfs to configure the bridge settings stp/forward_delay/priority ageing_time/hello_time and max_age as the SIOCDEVPRIVATE bridge ioctl has no compat ioctl support which makes it impossible to set the above mentioned bridge paramaters if the kernel is compiled in 64 bit mode and user_space in 32 bit mode. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* treewide: switch to C-code style commentsHans Dedecker2018-11-191-9/+9
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: enable by default ignore encaplimit for grev6 tunnelsHans Dedecker2018-10-171-5/+25
| | | | | | | | Similar as for ip6 tunnels ignore encaplimit by default as not all ISPs support the destination option header containing the tunnel encapsulation limit resulting into broken connectivity Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: fix a typo in gre tunnel data parsing logicHans Dedecker2018-10-161-1/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: enable by default ignore encaplimit for ip6 tunnelsHans Dedecker2018-09-181-2/+5
| | | | | | | | | | | Enable ignore encaplimit by default for ip6 tunnels as not all ISPs support the destination option header containing the tunnel encapsulation limit resulting into broken map/ds-lite connectivity. Setting the ignore encaplimit flag by default is a more sane setting as it avoids user configuation of the encaplimit uci option for ds-lite/map tunnels in case of broken connectivity. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* 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-301-18/+33
| | | | | | | | | | | | | 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>
* 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>
* 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>
* 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>
* device: add support for setting the isolate options for bridge portsFelix Fietkau2018-03-131-0/+9
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* remove rps/xps configuration supportFelix Fietkau2018-02-261-42/+0
| | | | | | | | 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>
* system-linux: VXLAN: add options to enable and disable UDP checksumsMatthias Schiffer2018-01-241-0/+11
| | | | Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* 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-291-29/+52
| | | | | | | | 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>
* allow setting rps/xps defualt values via uciJohn Crispin2017-08-221-5/+11
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* netifd: allow negative neighlocktime valuesAlin Năstac2017-08-171-2/+2
| | | | | | | | | 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>
* system-linux: parse ipv6 specific tunnel settings as nested data jsonHans Dedecker2017-08-151-101/+115
| | | | object
* system-linux: fix GRE ikey/okey endiannessStijn Tintel2017-07-211-2/+2
| | | | | | | | | 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>
* netifd: Fix printf calls + function declarations.Rosen Penev2017-06-261-11/+11
| | | | | | | | 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>
* iprule: Add option to suppress unspecific routing lookupsStefan Tomanek2017-06-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* system-linux: fix 6rd regressionHans Dedecker2017-05-271-1/+1
| | | | | | Fix 6rd regression introduced in commit 7573880ac042c6e5c8d48b1ad83d357b5e02743b Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: parse 6rd specific settings as nested json data objectHans Dedecker2017-05-221-30/+59
| | | | | | | 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>
* system-linux: remove redundant check for strtoul() return valueKhem Raj2017-05-191-2/+2
| | | | | | | 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>
* system-linux: allow "throw" route typeMatthias Schiffer2017-04-141-1/+2
| | | | | | | system_rtn_aton() was already parsing "throw" correctly, but system_rt() did now allow it. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* system-linux: parse vti specific settings as nested json data objectHans Dedecker2017-03-211-13/+16
| | | | | | | 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>
* system-linux: parse gre specific settings as nested json data objectHans Dedecker2017-03-211-19/+29
| | | | | | | Parse gre specific settings ikey, okey, icsum, ocsum, iseqno and oseqno as nested json data object Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: add VXLAN supportMatthias Schiffer2017-03-071-1/+159
| | | | | | | | | | | | 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>
* netifd: Add option to configure locktime for each deviceAlin Năstac2017-02-111-0/+20
| | | | | | | | | | | The UCI parameter neighlocktime allows to control the hardware address to IP mapping lock time in the IPv4 neighbour table. The IPv6 lock time was not set because it is not used at all in any kernel versions, hardware address override being controlled in this case by the override flag present in the NA packet. Signed-off-by: Alin Nastac <alin.nastac@gmail.com>
* device: add veth supportMatthias Schiffer2017-02-111-0/+61
| | | | | | | | | | | | | The veth config code mostly handles the primary interface of a veth pair, the secondary interface is not explicitly referenced and will be found as an unrelated interface after the pair has been created. This doesn't only allow us to keep the veth code simple (and similar to existing device handlers), but will also avoid complicating handling unnecessarily in case the secondary interface is moved into another network namespace. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* treewide: fix white space errorsHans Dedecker2017-01-311-6/+6
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: route proto config support (FS#170)Hans Dedecker2017-01-251-2/+40
| | | | | | | | | | | Route proto support is usefull when using route distribution via a routing daemon. The route proto parameter can be specified via the route proto uci config parameter, it can hold a numerical value or the string values unspec, kernel, boot, static or a string present in /etc/iproute2/rt_protos. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Add sendredirects config supportDaniel Golle2017-01-101-0/+18
| | | | | | | | | | | | | | | | | | | | | | Setting /proc/sys/net/ipv4/conf/*/send_redirects is useful if a single layer-2 domain is shared among routed subnets. Sending redirects will prevents traffic from taking unnessesary detours through a gateway in cases where direct connectivity on layer 2 exists. This is commonly the case if an existing LAN infratructure with dump switches is used to additionally carry routing protocols like OLSR which are supported only by some nodes on the network. It's important to note that the default value for send_redirects differs for interface types (it's enabled on physical ethernet interfaces, but disabled e.g. on VLANs) due to olsrd changing /proc/sys/net/ipv4/conf/default/send_redirects during boot, thus the default differs also depending e.g. on the way an on-board switch is integrated on specific boards (as eth0 exists before olsrd is started, eth0.1 gets created by netifd later on...) Having a way to explicitely enable or disable send_redirects is thus desireable also to unify the default behaviour among different, but seemingly similar devices supported. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* system-linux: Don't set gre tunnel ttl by default to 64 (#FS312)Hans Dedecker2016-12-241-8/+15
| | | | | | | | | | As the ttl of a gre tunnel was set by default to 64 the gre tunnel failed to get active if don't fragment was disabled as setting nopmtudisc and ttl is incompatible. Fix this by setting the default ttl value after don't fragment and ttl config values have been parsed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: cosmetic cleanupFelix Fietkau2016-11-041-1/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system-linux: check for open failureGünther Kelleter2016-11-041-0/+2
| | | | Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de>
* bridge: Allow setting multicast_fast_leave_optionHans Dedecker2016-09-141-0/+9
| | | | | | | | | | | | | | | | 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>
* system-linux: Replace device_get by device_find where appropriateHans Dedecker2016-06-061-1/+1
| | | | | | | 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-061-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* netifd: Add option to configure gc_stale_time for each deviceAlin Năstac2016-06-011-0/+38
| | | | | | | 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-221-0/+18
| | | | | | | | | | | | | | | | | | 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>
* 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>