summaryrefslogtreecommitdiff
path: root/system.h
Commit message (Collapse)AuthorAgeFilesLines
* system: move netdev types to system-linux.c where they are usedFelix Fietkau2022-12-291-69/+0
| | | | | | Fixes compile error on non-linux systems (used for testing) Signed-off-by: Felix Fietkau <nbd@nbd.name>
* system: fix compilation with glibc 2.34Hans Dedecker2022-01-141-0/+4
| | | | | | | Fixes ARPHRD_PHONET/ARPHRD_PHONET_PIPE undeclared compilation error with glibc 2.34 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* netifd: add devtype to ubus callFlorian Eckert2022-01-121-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | Every network device has a type but there is no standard interface here. The type can be determined either from the file '/sys/class/net/<device>/uevent' or, if no information is found there, from the file '/sys/class/net/<device>/type'. This new function first checks whether there is a DEVTYPE=<type> string in the 'uevent' file and uses it. If it does not find this information, the 'type' is used as a fallback and mapped the number to a character sequence. This new 'devtype' information can be found in the network.device ubus call. Command: ubus call network.device status Output: { "eth0": { "devtype": "ethernet", Signed-off-by: Florian Eckert <fe@dev.tdt.de> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [commit rewording]
* system-linux: fix deletion of ip tunnels (FS#4058)Hans Dedecker2021-10-301-2/+2
| | | | | | | | The deletion of IP tunnels via the ioctl interface is broken; instead of fixing the ioctl interface switch to the netlink based interface to delete IP tunnel devices as this simplifies and unifies the code Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* device: add support for configuring bonding devicesFelix Fietkau2021-09-031-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supported options: - ports: member devices - policy: bonding policy supported values: - balance-rr - active-backup - balance-xor - broadcast - 802.3ad - balance-tlb - balance-alb - xmit_hash_policy: slave selection tx hash policy supported values: - layer2 - layer2+3 - layer3+4 - encap2+3 - encap3+4 - all_ports_active: allow receiving on inactive ports - min_links: minimum number of active links - ad_actor_system: LACPDU exchange MAC address - ad_actor_sys_prio: LACPDU priority value - ad_select: 802.3ad aggregation logic supported values: - stable - bandwidth - count - lacp_rate: 802.3ad LACPDU packet rate supported values: - slow (every 30 seconds) - fast (every second) - packets_per_port: number of packets before switching ports (balance-rr mode). - lp_interval: number of seconds between sent learning packets - dynamic_lb: distribute traffic according to port load - resend_igmp: number if IGMP membership updates after failover event - num_peer_notif: number of tx unsolicited ARP/NA after failover event - primary: name of the primary port - primary_reselect: primary port reselection policy supported values: - always - better - failure - failover_mac: MAC address selection policy supported values: - none - active - follow - monitor_mode: select ARP or MII link monitor: supported values: - arp - mii - monitor_interval: link monitor update interval (msec) - arp_target: ARP monitor target IP address (list) - arp_all_targets: all targets must be reachable to consider the link valid - arp_validate: ARP validation policy supported values: - none - active - backup - all - filter - filter_active - filter_backup - use_carrier: use carrier status instead of MII ioctl result - updelay: delay before enabling port after MII link up event (msec) - downdelay: delay before disabling port after MII link down event (msec) Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: tune default stp parametersFelix Fietkau2021-08-241-7/+5
| | | | | | | | | | The default forwarding delay 2 is broken and makes STP non-functional by default. The kernel's default of 15 is rather long. This commit changes makes the timer settings more aggressive than the kernel's default while still being consistent and allowing proper convergence for a network diameter up to 4 Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: add support for an external STP daemonFelix Fietkau2021-08-241-0/+3
| | | | | | | | netifd notifies the stp daemon through the network.device object and sends STP related configuration parameters. The daemon can also trigger a STP restart in order to close the race on init Signed-off-by: Felix Fietkau <nbd@nbd.name>
* device: extend device settings flags to 64 bitFelix Fietkau2021-07-291-1/+1
| | | | | | The previous 32 bit limit is almost used up Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: check bridge port vlan membership on link-up eventsFelix Fietkau2021-07-231-0/+1
| | | | | | | | When changing to a dfs channel, hostapd can bring down wlan interfaces and reset their bridge membership. If that happens, the port loses its vlan membership settings and needs to be reconfigured by netifd. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* netifd: vxlan: add aging and maxaddress optionsJohannes Kimmel2020-09-121-0/+2
| | | | | | | For both options the values can just be passed to the kernel. All unsigned values are accepted, thus no range checking required. Signed-off-by: Johannes Kimmel <fff@bareminimum.eu>
* netifd: vxlan: add most missing boolean optionsJohannes Kimmel2020-09-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | adds the folloing missing options: - learning - rsc - proxy - l2miss - l3miss - gbp See ip-link(3) for their meaning. still missing: - external - gpe I'm not sure how to handle them at the moment. It's unclear to me what IFLA_VXLAN_* value corresponds to the 'external' option and according to the manpage, gpe depends on it. Signed-off-by: Johannes Kimmel <fff@bareminimum.eu>
* netifd: vxlan: handle srcport rangeJohannes Kimmel2020-09-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | This adds adds the ability to set the source port range for vxlan interfaces. By default vxlans will use a random port within the ephermal range as source ports for packets. This is done to aid scaleability within a datacenter. But with these defaults it's impossible to punch through NATs or traverese most stateful firewalls easily. One solution is to fix the srcport to the same as dstport. If only srcportmin is specified, then srcportmax is set in a way that outgoing packets will only use srcportmin. If a range is to be specified, srcportmin and srcportmax have to be specified. srcportmax is exclusive. If only srcportmax is specified, the value is ignored and defaults are used. Signed-off-by: Johannes Kimmel <fff@bareminimum.eu>
* bridge: add support for adding vlans to a bridgeJohn Crispin2020-07-181-0/+1
| | | | | | | Add a rtnl helper for adding vlans to a bridge interface. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* bridge: add support for turning on vlan_filteringJohn Crispin2020-07-181-0/+2
| | | | | | | | If we want a bridge to be vlan aware we need to be able to turn on filtering. Signed-off-by: John Crispin <john@phrozen.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* vlandev: support setting ingress/egress QoS mappingsPau Espin Pedrol2020-05-211-0/+9
| | | | | | | | | | | | | | | | | It allows setting mappings for instance this way: """ config device option name 'vlan41' option type '8021q' option vid '41' option ifname 'eth1' list ingress_qos_mapping '1:2' list ingress_qos_mapping '2:5' list egress_qos_mapping '0:3' """ Signed-off-by: Pau Espin Pedrol <pespin.shar@gmail.com> Tested-by: Pedro <pedrowrt@cas.cat>
* interface, system: clean up netns functionalityDaniel Golle2020-04-141-1/+1
| | | | | | | | | Use struct device pointer as parameter instead of bare ifname allows for some simplication and again removing system_ifname_resolve() function introduced in commit d93126d. Fixes: d93126d ("interface: allow renaming interface when moving to jail netns") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* interface: allow renaming interface when moving to jail netnsDaniel Golle2020-04-141-1/+1
| | | | | | | | | | Introduce jail_ifname option to define the name of a Linux network interface when moved into a jail's network namespace. This is useful for containers which expect the network interface to have a specific name (eg. 'host0' in case of systemd). While at it, clean-up and fix bugs in jail interface up/down routines. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* add basic support for jail network namespacesDaniel Golle2020-01-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prepare netifd for handling procd service jails having their own network namespace. Intefaces having the jail attribute will only be brought inside the jail's network namespace by procd calling the newly introduced ubus method 'netns_updown'. Currently proto 'static' is supported and configuration changes are not yet being handled (ie. you'll have to restart the jailed service for changes to take effect). Example /etc/config/network snippet: config device 'veth0' option type 'veth' option name 'vhost0' option peer_name 'virt0' config interface 'virt' option type 'bridge' list ifname 'vhost0' option proto 'static' option ipaddr '10.0.0.1' option netmask '255.255.255.0' config interface 'virt0' option ifname 'virt0' option proto 'static' option ipaddr '10.0.0.2' option netmask '255.255.255.0' option gateway '10.0.0.1' option dns '10.0.0.1' option jail 'transmission' Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* netifd: add xfrm tunnel interface supportAndré Valentin2019-06-081-0/+6
| | | | | | | This adds support for xfrm interfaces. These interfaces can be used since linux 4.19 for IPsec traffic, like VTI interface. XFRM interfaces are less complicated compared to VTI because they need no IP tunnel endpoints.
* interface: add neighbor config supportmeurisa2019-04-151-0/+3
| | | | | | | | | | | | | | | | | | The neighbor or neighbor6 network section makes neighbours configurable via UCI or proto shell handlers. It allows to install neighbor proxy entries or static neighbor entries The neighbor or neighbor6 section has the following types: interface : declares the logical OpenWrt interface ipaddr : the ip address of the neighbor mac : the mac address of the neighbor proxy : specifies whether the neighbor ia a proxy entry (can be 1 or 0) router : specifies whether the neighbor is a router (can be 1 or 0) Signed-off-by: Alexander Meuris <meurisalexander@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system-linux: enable by default ignore encaplimit for grev6 tunnelsHans Dedecker2018-10-171-0/+1
| | | | | | | | 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: make encaplimit configurable for ip6 tunnels (FS#1501)Hans Dedecker2018-05-301-0/+7
| | | | | | | | | | | | | 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: VXLAN: add options to enable and disable UDP checksumsMatthias Schiffer2018-01-241-0/+2
| | | | Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* system-linux: parse map-e fmrs parameters as nested data json objectHans Dedecker2017-08-291-1/+9
| | | | | | | | 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>
* system: remove unused 6rd tunnel attributesHans Dedecker2017-08-211-2/+0
| | | | | | | | 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>
* netifd: Fix printf calls + function declarations.Rosen Penev2017-06-261-1/+1
| | | | | | | | 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>
* system-linux: parse 6rd specific settings as nested json data objectHans Dedecker2017-05-221-0/+7
| | | | | | | 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: parse vti specific settings as nested json data objectHans Dedecker2017-03-211-1/+7
| | | | | | | 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-0/+11
| | | | | | | 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-0/+10
| | | | | | | | | | | | 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>
* device: add veth supportMatthias Schiffer2017-02-111-0/+18
| | | | | | | | | | | | | 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-7/+7
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: route proto config support (FS#170)Hans Dedecker2017-01-251-0/+1
| | | | | | | | | | | 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>
* bridge: multicast: Export some parameters RFCs suggest to be tunableLinus Lüssing2016-03-071-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: mark tunnel_attr_list as externFelix Fietkau2016-01-091-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* device: fetch settings from external devices to make them usable for status ↵Felix Fietkau2015-11-171-0/+1
| | | | | | output Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* bridge: allow setting hash_max valueLinus Lüssing2015-05-271-0/+1
| | | | | | | | | | | | 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>
* system: fix typo in returning address length.Yousong Zhou2015-05-231-1/+1
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* bridge: allow enabling or disabling the multicast querier independently of ↵Matthias Schiffer2015-03-231-0/+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>
* netifd: Add mldversion config supportSteven Barth2014-12-231-1/+0
| | | | | | | | | | | | 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/+1
| | | | | | | | | | | | | 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: Add rpfilter config supportHans Dedecker2014-11-191-0/+1
| | | | | | | | | | | 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: Fix device ifindex overwrite when processing netlink event messagesHans Dedecker2014-11-191-0/+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: GRE Tos supportHans Dedecker2014-09-291-0/+1
| | | | | | | | 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: GRE tunnel supportHans Dedecker2014-07-301-1/+2
| | | | | | Adds support for gre, gretap, grev6 and grev6tap tunnels Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* system: fix treatment of RT_TABLE_MAINSteven Barth2014-06-201-0/+1
| | | | | | | | | | | Do not treat RT_TABLE_MAIN as RT_TABLE_UNSPEC in system_resolve_rt_table() in order to allow ip rules with lookup main to work as expected. Provide a new function system_is_default_rt_table() to allow calling code to specifically test for RT_TABLE_MAIN, this is going to be needed for the backwards compatible handling of the table attribute in route objects. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* netifd: Route type supportHans Dedecker2014-06-181-0/+1
| | | | | | | | Patch adds route type support in netifd by means of the route parameter type. By default the route type was unicast; the parameter adss support for local/broadcast/multicast/unicast routes which will be put into the appropriate routing table. If route type parameter is unset the route type will be unicast as before. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Add vlan 802.1q/802.1ad support as netifd devicesGioacchino Mazzurco2014-06-111-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | At moment netifd supports just 802.1q vlan, you can configure them using a concise but "hacky" syntax using an interface config section, with this patch netifd acquire the capability of configuring 802.1ad and 802.1q vlan using config device sections, so you can define a vlan device plus interface with something like this: config device 'test' option type '8021ad' option name 'test' option ifname 'eth0' option vid '1000' config interface 'testif' option ifname 'test' option proto 'none' option auto '1' old syntax for 802.1q keeps working so no retrocompatibility problems, to keep retrocompatibility means also that user must not use name/ifname like eth0.2 for devices declared with the new style because this would trigger the "old style" when interface config section is parsed Signed-off-by: Gioacchino Mazzurco <gmazzurco89@gmail.com>
* Rewrite ipip6-tunnel setup to use netlink and add support for FMRsSteven Barth2014-05-211-0/+1
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* netifd: Fix bridge MTU setting when a bridge member is addedHans Dedecker2014-03-111-2/+2
| | | | | | Reapply bridge mtu setting as adding a bridge member will override the bridge mtu in the kernel Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>