summaryrefslogtreecommitdiffhomepage
path: root/interface.h
AgeCommit message (Collapse)Author
2020-10-28bridge: add support for defining port member vlans via hotplug opsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-04-14interface: allow renaming interface when moving to jail netnsDaniel Golle
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>
2020-04-13interface: allocate and free memory for jail nameDaniel Golle
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>
2020-01-18add basic support for jail network namespacesDaniel Golle
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>
2019-04-15interface: add neighbor config supportmeurisa
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>
2018-11-19treewide: make some functions staticHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-11-13interface: rework code to get rid of interface_set_dynamicHans Dedecker
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>
2018-08-20interface: let interface_set_down() return voidHans Dedecker
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>
2018-08-20interface: make __interface_set_down() staticHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2018-08-20interface: extend interface error messages in interface_set_up()Hans Dedecker
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>
2018-07-05Introduce new interface event "create" (IFEV_CREATE)Alexander Couzens
"create" will be called before the proto handlers initialised. Acked-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
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-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-02-11interface: add prefix assignment priority supportHans Dedecker
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]
2016-11-04interface: Fix triggering of interface update eventHans Dedecker
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>
2016-09-14interface-ip: DNS name server sorting support in resolv.conf.autoHans Dedecker
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>
2016-07-29interface: report link up events for force_link interfacesFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-01-17netifd: Do not add local/source policy rules multiple timesKristian Evensen
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>
2015-12-19interface: Trigger interface update event when interface data is updated via ↵Hans Dedecker
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>
2015-08-25Changes for more readability.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-01-19netifd: Make interface identifier of delegated IPv6 address configurableHans Dedecker
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>
2014-07-30netifd: Allow to add link devices which can be marked as non externalHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-07-24interface: fix restart after reload with external devicesFelix Fietkau
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>
2014-04-11interface: add support for a parameter to force setup without a carrier on ↵Felix Fietkau
the underlying device Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-02-27netifd: Link layer state awareness support on interface levelHans Dedecker
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>
2014-01-17Add indicator-flags to ubus and hotplug update-eventsSteven Barth
2013-12-14Revert "netifd: Link layer state support on interface level"Felix Fietkau
This reverts commit 7335c3e19ea09674245dda3653d3f40705e68d6b.
2013-12-08netifd: Link layer state support on interface levelHans Dedecker
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>
2013-10-22add helper function for adding/removing devices to interfacesFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-19interface: rework code to get rid of arbitrary IFNAMSIZ limitation for ↵Felix Fietkau
interface names Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-19interface: remove "dynamic" argument for interface_init, add the ↵Felix Fietkau
interface_set_dynamic function instead Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-18Add option "delegate" to toggle prefix delegationSteven Barth
2013-10-17Add protocol update notifications and hotplug legacy callsSteven Barth
2013-10-17Add ubus function to create nested interfacesSteven Barth
2013-06-10config: use the new uci_blob library codeFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-30IPv6: reorganize prefix assignmentSteven Barth
* put parameters in a more suitable place * add support for prefix classes
2013-05-17Add option to define target routing table for protocol routes.Steven Barth
This unifies source-routing for both IPv6 and IPv4 (default off). Based on a patch by Kristian Evensen
2013-04-03Rewrite IPv6 prefix assignmentSteven Barth
2013-01-15Initial IPv6 prefix supportSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2012-07-12add simple device config params to interface blob attributes, and add a flag ↵Felix Fietkau
that indicates if it is present
2012-05-23add interface alias supportFelix Fietkau
2012-05-19implement a generic peerdns option to suppress proto handler dns entriesFelix Fietkau
2012-05-04add copyright headersFelix Fietkau
2012-05-04convert interface event queueing to global interface notifierFelix Fietkau
2012-05-04add a new event for interface reloadFelix Fietkau
2012-05-04add a new event for interface freeFelix Fietkau
2012-05-04add global interface event notifierFelix Fietkau
2012-05-04add a ubus interface to dynamically create host routes to a particular ip ↵Felix Fietkau
address, returns the interface that the route goes through
2012-03-23add support for attaching arbitrary state data to interfacesFelix Fietkau
2012-03-23move l3 device tracking to interface core to enforce proper order of ↵Felix Fietkau
address/route removal on device or interface state changes