summaryrefslogtreecommitdiff
path: root/system-linux.c
Commit message (Collapse)AuthorAgeFilesLines
...
* bridge: multicast: Export some parameters RFCs suggest to be tunableLinus Lüssing2016-03-071-13/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* device: Support multicast config optionHans Dedecker2016-02-011-0/+8
| | | | | | | | 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>
* 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>
* netifd/system-linux: add VTI tunnel supportAndré Valentin2016-01-171-1/+105
| | | | | | | | 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>
* netifd: Do not add local/source policy rules multiple timesKristian Evensen2016-01-171-3/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* device: fetch settings from external devices to make them usable for status ↵Felix Fietkau2015-11-171-1/+1
| | | | | | output Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: preserve orig_settings flags for querying device statusFelix Fietkau2015-11-171-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: Don't process link events anymore in device user specific callback ↵Hans Dedecker2015-11-041-1/+1
| | | | | | | | | | | | | | | handlers Set link_state for all device types via the device_set_link API as all devices are registered in the device tree list making it possible to always get the device via device_get. The decice link state parameter will now actually reflect the corresponding kernel device carrier state in all cases. Before this change a vlan/macvlan device could still have link_state enabled if an interface was brought down; this was the case when the parent vlan/macvlan device was still enabled as the netlink link_state event would be dropped for vlan/macvlan devices due to keep_link_state in the function cb_rtnl_event. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: fix memory leak on error in system_if_checkFelix Fietkau2015-10-291-3/+7
| | | | | | Detected by Coverity CID 1330302 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* system-linux: fix memory leak in system_addr()Felix Fietkau2015-10-291-1/+3
| | | | | | Detected by Coverity CID 1330178 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* wireless: fix mcast_to_ucast handling, only apply it to AP modeFelix Fietkau2015-09-101-1/+1
| | | | | | | Fixes a regression that caused WDS stations to repeat packets back to the AP. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* bridge: Allow setting multicast_router optionLinus Lüssing2015-08-251-0/+18
| | | | | | | | | | | | | | | | | | | | | | The multicast_router option of a bridge allows to control the forwarding behaviour of multicast packets independant of the listener state: * 0: Only forward if specific listener is present * 1 (default): Forward if specific listener or a multicast router was detected (currently only learned via query messages, no MRD support yet) * 2: Always forward any multicast traffic on this port Since MRD is not mandated you might end up with silent multicast routers (e.g. if your link has more than one multicast router; only one can become the selected, "noisy" querier). Here you might need a manual configuration option like the "multicast_router" option. Other scenarios where this can be useful are for instance: * Segmentation of IGMP/MLD domains together with ebtables * Dedicated bridge port for monitoring/debugging purposes Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
* bridge: Allow setting multicast_to_unicast optionLinus Lüssing2015-08-251-4/+9
| | | | | | | | | | | With this patch the multicast_to_unicast feature can be disabled for all wireless interfaces via an according option on the uci bridge interface. This patch also exports the setting information to wireless handler scripts. The hostapd script will need that information to determine whether to enable or disable ap-isolation, for instance. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
* bridge: Fix multicast_to_unicast feature by hairpin+isolateLinus Lüssing2015-08-251-6/+20
| | | | | | | | | | | | | | | | | | | | | | | | | All IGMP and MLD versions suffer from a specific limitation (from a snooping switch perspective): Report suppression. Once a listener hears an IGMPv2/3 or MLDv1 report for the same group itself participates in then it might (if this listener is an IGMPv3 or MLDv2 listener) or will (if this is an IGMPv1/2 or MLDv1 listener) refrain from sending its own report. Therefore we might currently miss such surpressing listeners as they won't receive the multicast packet with the mangled, unicasted destination. Fixing this by first isolating the STAs and giving the bridge more control over traffic forwarding. E.g. refraining to forward listener reports to other STAs. For broadcast and unicast traffic to an STA on the same AP, the hairpin feature of the bridge will reflect such traffic back to the AP interface. However, if the AP interface is actually configured to isolate STAs, then hairpin is kept disabled. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
* netifd: Add dadtransmits config optionHans Dedecker2015-07-031-8/+21
| | | | | | | Config option dadtransmits allows to configure the amount of Duplicate Address Detection probes to be sent Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Add mtu6 option to override IPv6 MTUSteven Barth2015-06-241-11/+17
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* bridge: allow setting hash_max valueLinus Lüssing2015-05-271-0/+5
| | | | | | | | | | | | If the number of entries in the MDB exceeds hash_max then the multicast snooping capabilities of the bridge are disabled automatically. The default value for hash_max is 512 which is already exceeded by some wireless community mesh networks. They need to be able to set a higher value. Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
* uclibc: backwards-compatibility fixesSteven Barth2015-05-261-0/+9
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* linux: more IPv6 onlink-route handling fixes / improvementsSteven Barth2015-05-261-5/+4
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* linux: add compat-define for IFA_F_NOPREFIXROUTESteven Barth2015-05-191-0/+4
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* ipv6: use kernel >= 3.14 handling of offlink-addressesSteven Barth2015-05-191-0/+1
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* Cleanup issues reported by scan-buildSteven Barth2015-04-141-2/+1
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* Revert "linux: adjust default policy rules"Steven Barth2015-03-311-2/+16
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* linux: adjust default policy rulesSteven Barth2015-03-271-16/+2
|
* bridge: allow enabling or disabling the multicast querier independently of ↵Matthias Schiffer2015-03-231-1/+1
| | | | | | | | | | | | | | IGMP snooping In larger networks, especially big batman-adv meshes, it may be desirable to enable IGMP snooping on every bridge without enabling the multicast querier to specifically put the querier on a well-connected node. This patch adds a new UCI option 'multicast_querier' for bridges which allows this. The default is still the value of the 'igmp_snooping' option to maintain backwards compatiblity. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* device: fix default initialization for RPS/XPSFelix Fietkau2015-03-221-3/+0
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: add support for configuring RPS/XPS (enabled by default if available)Felix Fietkau2015-03-221-0/+35
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* add prelocal table to manipulate locally destinated trafficSteven Barth2015-03-191-0/+14
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Add option to configure base_reachable_time_ms for each deviceHans Dedecker2015-02-091-0/+40
| | | | | | | | The UCI parameter neighreachabletime allows to control the hardware address to IP mapping lifetime in the neighbour table for both IPv4 and IPv6 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Jean-Francois Remy <jeff@melix.org>
* netifd: Add mldversion config supportSteven Barth2014-12-231-12/+22
| | | | | | | | | | | | Config support to set the MLD host version on device level; possible values are : 1 : MLDv1 2 : MLDv2 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Cleaned up and simplified. Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Add igmpversion config supportHans Dedecker2014-12-081-0/+34
| | | | | | | | | | | | | Config support to set the IGMP host version on device level; possible values are : 1 : IGMPv1 2 : IGMPv2 3 : IGMPv3 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Cleand up and simplified Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Fix restore of original device settingsHans Dedecker2014-12-081-1/+2
| | | | | | | | Don't restore original device settings based on the device settings flags in system_if_down as device flags are already reset when the device config is deleted. Therefore move the masking of the relevant original device settings to system_if_up. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd v2: Fix source routing for IPv4Kristian Evensen2014-11-271-2/+6
| | | | | | | | | | | | | | | | | According to the OpenWRT Network documentation for route, the 'source' option is "The preferred source address when sending to destinations covered by the target". However, netifd currently stores this value in RTA_SRC on NEWROUTE/DELROUTE. RTA_SRC is not used by kernel when handling NEWROUTE nor DELROUTE for IPv4 routes. When adding a new IPv4 route, the source is stored in RTA_PREFSRC and the option works as specified in documentation. For IPv6, the address is still stored in RTA_SRC as to not break source-destination routing for IPv6. v2: Limit patch to IPv4, to prevent breaking IPv6 configurations (thanks Steven Barth) Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
* Fix setting blackhole-routes to kernelSteven Barth2014-11-251-3/+8
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Add acceptlocal config supportHans Dedecker2014-11-191-0/+18
| | | | | | Adds support to accept packets with local source address. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Add rpfilter config supportHans Dedecker2014-11-191-0/+41
| | | | | | | | | | | Reverse path filtering config support; possible values are: 0: no source validation 1|strict: strict mode as packet will be dropped if the incoming interface is not the best reverse path 2|loose: loose mode as packet will be dropped if the source address is not reachable via any interface Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Remove superfluous system_if_resolve callsHans Dedecker2014-11-191-10/+2
| | | | | | | | Don't resolve the ifindex of the parent device again when adding vlandev and macvlan devices as the ifindex has already been resolved. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Fix device ifindex overwrite when processing netlink event messagesHans Dedecker2014-11-191-7/+2
| | | | | | | | | | | When a device with the same name is deleted and created again in the kernel the ifindex changes. A race condition will occur when netlink event messages linked to the old device are processed and will thus overwrite the correct ifindex of the new device. Further make sure a valid ifindex is in place for both external and internal devices when setting the state to enabled. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: Read current link state when processing netlink eventHans Dedecker2014-10-241-6/+13
| | | | | | | | | | | | | | | | | Netifd commit b2dcb02570939d98b92c7c55db1c328693a5d52a introduces a race condition resulting into infinite toggling interfaces (eg static interfaces with linksensing enabled, vlan interfaces with proto none (#18106)) when linksensing is enabled resulting into a crash. As netlink event messages will be queued on the netlink event socket the included lower up interface flag will not always represent the current link state when netifd processes the netlink messages; by reading the current link state when a netlink event message is parsed the correct info is passed to the device layer. This will avoid continuous interface toggling (down/up) triggered by link state changes based on outdated netlink interface info. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: fix a glob related memleakFelix Fietkau2014-10-241-4/+5
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: make link status detection optional for vlan devicesFelix Fietkau2014-10-201-1/+2
| | | | | | | Fixes a race condition that triggers endless link loss / detect calls when VLAN devices are created. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: IPIP tunnel supportHans Dedecker2014-10-021-29/+82
| | | | | | | | | | | | | | Adds IPIP tunnel support to netifd. Following IPIP tunnel parameters can be configured : -peeraddr (IPv4 remote address) -ipaddr (IPv4 local address) -mtu (IPIP tunnel mtu) -ttl (time to live of encapsulting packets) -tos (type of service either inherit (outer header inherits the value of the inner header) or hex value) -df (don't fragment flag of encapsulating packets) -tunlink (bind tunnel to this interface) Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: GRE Tos supportHans Dedecker2014-09-291-1/+34
| | | | | | | | Tos support is added as a generic gre parameter which can have the following values : -inherit (outer header inherits the tos value of the inner header) -hex value Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd-device: add support for promisc settingMartin Hundebøll2014-09-171-0/+10
| | | | Signed-off-by: Martin Hundebøll <martin@hundeboll.net>
* Disable new-style tunnel creation for older kernelsSteven Barth2014-08-061-0/+4
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: GRE tunnel supportHans Dedecker2014-07-301-9/+181
| | | | | | Adds support for gre, gretap, grev6 and grev6tap tunnels Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* bridge: enable multicast querier functionality by defaultFelix Fietkau2014-07-241-0/+3
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* bridge: enable multicast_to_unicast on all wireless bridge portsFelix Fietkau2014-06-291-3/+15
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>