summaryrefslogtreecommitdiff
path: root/interface.h
Commit message (Collapse)AuthorAgeFilesLines
* interface: support "zone" config optionRafał Miłecki2022-08-111-0/+1
| | | | | | | | | | | Many protocol handlers support "zone" option independently and they pass it in the "data". Then it's read e.g. by a firewall[34]. Add support for "zone" directly to the netifd so: 1. It works for all protocols 2. Handlers don't have to duplicate code Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* interface, ubus: rework netns up/downDaniel Golle2021-10-131-3/+4
| | | | | | | | Let per-container netifd instance handle the netns bringdown, it makes everything easier and gets rid of the fork() when bringing down container network interfaces. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* interface: support "device" attribute and deprecate "ifname"Rafał Miłecki2021-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | Interfaces need to be assigned to devices. For that purpose a "device" option should be more accurate than "ifname" one. For backward compatibility old option remains supported too. Config example: config device option name 'br-lan' option type 'bridge' list ports 'lan1' list ports 'lan2' config interface 'lan' option device 'br-lan' option proto 'static' Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* bridge: add support for defining port member vlans via hotplug opsFelix Fietkau2020-10-281-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* interface: allow renaming interface when moving to jail netnsDaniel Golle2020-04-141-0/+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>
* interface: allocate and free memory for jail nameDaniel Golle2020-04-131-1/+1
| | | | | | | | | Memory returned by blogmsg_get_string() is volatile, hence use strdup() to have a permanent copy of the returned string and free it when no longer needed. Fixes: 1321c1b ("add basic support for jail network namespaces") 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>
* interface: add neighbor config supportmeurisa2019-04-151-0/+2
| | | | | | | | | | | | | | | | | | 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>
* treewide: make some functions staticHans Dedecker2018-11-191-2/+0
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: rework code to get rid of interface_set_dynamicHans Dedecker2018-11-131-4/+2
| | | | | | | Integrate dynamic interface creation code into interface_alloc and __interface_add so we can get rid of interface_set_dynamic Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: let interface_set_down() return voidHans Dedecker2018-08-201-1/+1
| | | | | | | Let interface_set_down() return void as no usefull error code is returned by __interface_set_down() Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: make __interface_set_down() staticHans Dedecker2018-08-201-1/+0
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: extend interface error messages in interface_set_up()Hans Dedecker2018-08-201-1/+1
| | | | | | | | Don't return an error code in interface_set_up as it's ignored anyway by the calling functions; but rather add more interface error messages so the actual problem is visible for the user by doing ifstatus <interface> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Introduce new interface event "create" (IFEV_CREATE)Alexander Couzens2018-07-051-0/+2
| | | | | | | "create" will be called before the proto handlers initialised. Acked-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
* interface: add new "ifup-failed" hotplug eventMartin Schiller2017-05-091-0/+1
| | | | | | | | | | | 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>
* ubus: add interface method to trigger renew eventMatthias Schiffer2017-04-221-0/+1
| | | | | | | | | 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>
* interface: add prefix assignment priority supportHans Dedecker2017-02-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | In case of prefix delegation prefixes are assigned to one or more configured downstream interfaces. The delegated prefix length in combination with the assignment length of the downstream interfaces determines the number of subnets which can be allocated from the delegated prefix. The interface ip6weight parameter allows to prioritize the allocation of subnets to interfaces in case of multiple configured downstream interfaces. The order of interface prefix assignment from a delegated prefix is based on the following parameters: - Primary key is prefix assignment based on the configured interface ip6hint - Secondary key is the requested downstream interface prefix length, interfaces configured with the smallest ip6hint will be assigned first - Third key is the assigned interface ip6weight in case of equal prefix assignment length; interfaces having the highest ip6weight will be assigned first - Finally the alphabetical order of the interfaces in case of equal ip6weight Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
* interface: Fix triggering of interface update eventHans Dedecker2016-11-041-1/+1
| | | | | | | | | | | | | | | | | In case the keep flag is set in proto_shell_update_link no interface update event is triggered when IPv4/6 addresses/routes/... are updated as the proto_event callback is not called due to keep being set. Unconditionally call the proto_event callback handler in proto_shell_update_link but let the proto_event callback handler; in this case interface_proto_event_cb, decide which actions need to be taken dependant on the interface state. In case the interface is already in the up state trigger an update event only if the interface updated flag actually indicates either an IP address/ route/data change; before interface update events were actually sent wihtout any parameter change. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface-ip: DNS name server sorting support in resolv.conf.autoHans Dedecker2016-09-141-0/+1
| | | | | | | | | | | | | | | | | | Interface name servers when being written to resolv.conf.auto are sorted based on the following parameters: -Primary sorting key is interface dns_metric; name servers having lowest interface dns_metric are listed first -Secondary sorting key is interface metric; in case of equal interface dns_metric name servers having lowest interface metric are listed first -Finally alphabetical order of the interface names in case of equal interface dns_metric and metric In case the resolver queries the multiple servers in the order listed; sorting is usefull in the following scenarios : -Name resolving over a main and backup interface -Assign priority to IPv6 name servers over IPv4 or vice versa Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: report link up events for force_link interfacesFelix Fietkau2016-07-291-0/+2
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* netifd: Do not add local/source policy rules multiple timesKristian Evensen2016-01-171-0/+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>
* interface: Trigger interface update event when interface data is updated via ↵Hans Dedecker2015-12-191-0/+1
| | | | | | | | | ubus Interface update event will trigger an interface hotplug event and an ubus notify event which will inform subscribers about the updated interface data field Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Changes for more readability.Yousong Zhou2015-08-251-0/+1
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* netifd: Make interface identifier of delegated IPv6 address configurableHans Dedecker2015-01-191-0/+8
| | | | | | | | | | | | | The ip6ifaceid UCI interface parameter makes the interface identifier of the delegated IPv6 address configurable. The parameter can have the following values: eui64 : Interface identifier is generated from the interface's MAC address random : Interface identifier is generated randomly fixed value : Interface identifier is a fixed value (eg ::1:2) The latter is the default value with a fixed value of ::1 for backwards compatibility Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Joeri Barbarien <joeri.barbarien@gmail.com>
* netifd: Allow to add link devices which can be marked as non externalHans Dedecker2014-07-301-2/+1
| | | | Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* interface: fix restart after reload with external devicesFelix Fietkau2014-07-241-0/+1
| | | | | | | | When an interface goes down, the main_dev is reset to NULL. Track an externally added device separately to be able to bring it back up. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* interface: add support for a parameter to force setup without a carrier on ↵Felix Fietkau2014-04-111-0/+1
| | | | | | the underlying device Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* netifd: Link layer state awareness support on interface levelHans Dedecker2014-02-271-0/+2
| | | | | | | | The link layer state is monitored for a given interface; an interface will be setup when both enabled and link layer active. Likewise an interface will be teared down when either disabled or link layer down. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* Add indicator-flags to ubus and hotplug update-eventsSteven Barth2014-01-171-0/+8
|
* Revert "netifd: Link layer state support on interface level"Felix Fietkau2013-12-141-2/+0
| | | | This reverts commit 7335c3e19ea09674245dda3653d3f40705e68d6b.
* netifd: Link layer state support on interface levelHans Dedecker2013-12-081-0/+2
| | | | | | | | | | | Patch implements handling of link layer support on interface level. An interface will go into the setup state when it's enabled and the underlying link state is enabled. Vice versa an interface will go to the down state when it's either disabled or underlying link state is disabled. Testing has been done with PPP, IPoE, tunnel and static interfaces Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
* add helper function for adding/removing devices to interfacesFelix Fietkau2013-10-221-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* interface: rework code to get rid of arbitrary IFNAMSIZ limitation for ↵Felix Fietkau2013-10-191-3/+2
| | | | | | interface names Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* interface: remove "dynamic" argument for interface_init, add the ↵Felix Fietkau2013-10-191-1/+3
| | | | | | interface_set_dynamic function instead Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* Add option "delegate" to toggle prefix delegationSteven Barth2013-10-181-0/+1
|
* Add protocol update notifications and hotplug legacy callsSteven Barth2013-10-171-0/+1
|
* Add ubus function to create nested interfacesSteven Barth2013-10-171-1/+2
|
* config: use the new uci_blob library codeFelix Fietkau2013-06-101-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* IPv6: reorganize prefix assignmentSteven Barth2013-05-301-3/+10
| | | | | * put parameters in a more suitable place * add support for prefix classes
* Add option to define target routing table for protocol routes.Steven Barth2013-05-171-0/+2
| | | | | | This unifies source-routing for both IPv6 and IPv4 (default off). Based on a patch by Kristian Evensen
* Rewrite IPv6 prefix assignmentSteven Barth2013-04-031-0/+2
|
* Initial IPv6 prefix supportSteven Barth2013-01-151-0/+3
| | | | Signed-off-by: Steven Barth <steven@midlink.org>
* add simple device config params to interface blob attributes, and add a flag ↵Felix Fietkau2012-07-121-0/+1
| | | | that indicates if it is present
* add interface alias supportFelix Fietkau2012-05-231-0/+4
|
* implement a generic peerdns option to suppress proto handler dns entriesFelix Fietkau2012-05-191-0/+1
|
* add copyright headersFelix Fietkau2012-05-041-0/+13
|
* convert interface event queueing to global interface notifierFelix Fietkau2012-05-041-3/+0
|
* add a new event for interface reloadFelix Fietkau2012-05-041-0/+1
|
* add a new event for interface freeFelix Fietkau2012-05-041-0/+1
|
* add global interface event notifierFelix Fietkau2012-05-041-1/+1
|