summaryrefslogtreecommitdiffhomepage
path: root/interface.c
AgeCommit message (Collapse)Author
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-08-11Prevent premature device free in interface_claim_deviceFelix Fietkau
interface_set_device_config can trigger a device free (for example if the device is here only present in a bridge), which renders dev invalid and leads to segfault. Add a lock to prevent this and clean-up the code for readability. Signed-off-by: Gino Peeters <peeters.gino@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-08-11proto-shell: Support teardown on layer 3 link lossHans Dedecker
Commit c6858766 added interface teardown support on layer 3 device link loss mainly for shell protocols who have no proto task like xl2tp. However for shell protocols having a proto task it is not always the correct action to teardown the interface; as an example the PPP daemon can be put into persist state trying to re-establish the link via a hold-off mechanism if layer 3 link loss is detected. Therefore shell handlers can enable via TEARDOWN_ON_L3_LINK_DOWN a proto flag which will teardown the interface when layer 3 link loss is detected 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-02-01interface: Fix possbile segfaultHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@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-12-17interface: toggle proto_ip along with config_ip to fix ordering issues with ↵Felix Fietkau
routes/rules added dynamically Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-08-25Changes for more readability.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-08Fix removal of dynamic interfacesSteven Barth
Also remove obsolete "del_dynamic" call (use "down" instead) Signed-off-by: Steven Barth <steven@midlink.org>
2015-05-23interface: teardown on l3_dev link lost.Yousong Zhou
This is mainly for shell protocols that has no_proto_task so that we can still teardown and setup the interface on l3_dev link lost instead of depending on running state of proto_task. Also rename related callbacks for better clarification. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-05-23interface: minor fix for unnecessary ++ operation.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-05-23interface: remove redundant iface_attr_info.Yousong Zhou
BLOBMSG_TYPE_STRING is the default type for elements of BLOBMSG_TYPE_ARRAY. Array type IFACE_ATTR_DNS_SEARCH was already missing there, so drop the whole part anyway. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-04-19interface: allow an interface to specify device configs even when there are ↵Felix Fietkau
other interfaces attached to the same device Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-04-19netifd: fix an uninitialized variableFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-04-18device: add support for removing interface config on reloadFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-04-18interface: detect and handle changes in device configFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-04-03netifd: Interface last error supportHans Dedecker
Adds interface last error support which preserves the last reported error reported by the protocol handler till the interface is up; e.g. survives network reload and interface restarts. This is mainly usefull for tracking down why an interface fails to establish; eg auth failure/traffic limit for PPP interfaces Protocol handlers register last error support by setting lasterror=1 in the proto_init function Signed-off-by: Johan Peeters <johan.peeters111@gmail.com> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-03-19netifd:Make sure interface device config is also cachedHans Dedecker
Fixes issue interface device config is not applied in some cases. As the interface device config was applied but not always cached; an interface device config diff was not always detected. Simplify device config setting by exposing as api only device_apply_config Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2015-01-24interface: apply device config passed through interface configFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
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-12-23netifd: Handle link down event in interface setup state as wellHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-12-08netifd: Fix interface auto disable when doing network reloadHans Dedecker
Keep interface down when interface auto parameter is set to 0 when doing network reload Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-10-24netifd : Reinsert ip parameters (addresses/routes) based on old interface ↵Hans Dedecker
config state Reinserts the config IP parameters as the config_ip parameter of the new interface is set to false in interface_alloc and thus not loading the config ip options of the old interface Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-10-12netifd: Fix lost interface device config for devices having default configHans Dedecker
As the PPP main device (either a simple or old style vlan device) is freed when PPP interfaces are reloaded; interface device specific config (eg mtu/macaddr/...) is lost as the interface config is not re-applied on the newly created device. Patch fixes the issue by re-applying the interface device config after the main device is claimed and is having default config. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-08-31interface: call proto teardown before marking the interface as downFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-08-31interface: do not try to bring up an unavailable interfaceFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-08-31interface: cancel the remove timer on cleanupFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
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-27interface: enable force_link by default for proto=staticFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
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-07-23Make dynamic interfaces always autostartSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2014-06-29interface: clean up l3 device reference on remove/reloadFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-26interface: fix indentationFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-06-18netifd: Check device_claim return code in all casesHans Dedecker
Fixes observed issue a tunnel interface is reported as up although device_claim failed Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-05-21Fix a spurious segfault when tearing down interfacesSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2014-05-09netifd: Check interface state only when main device is set during ↵Hans Dedecker
interface_change_config Fixes a regression issue introduced by commit d2a33f3f0fe704e4396fa2ada08401cb955ba7cb for device less protocol handlers. An active interface using a deviceless protocol handler will be be teared down when the interface config is checked upon an update as the interface link and enabled parameters are unset as no underlying device is present (eg tunnel interfaces) Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-05-02interface: clear iface->available before changing main_devFelix Fietkau
Fixes bogus interface restart loop on interface_remove_link Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-02interface: use interface_set_main_dev() from interface_remove_linkFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-02interface: do not set l3_dev along with main_dev anymoreFelix Fietkau
Made unnecessary by recent fixes to l3_dev handling Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-19interface: ensure that l3_dev gets set whenever the proto handler marks the ↵Felix Fietkau
interface as 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-04-05interface: always delete l3 dev on proto downFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-21netifd: Reload proto on topology changeHelmut Schaa
Introduce a new device event "topology change" that gets signaled by bridges on adding/removing members. On "topology changes" the proto handlers are requested to "renew" which is most useful for DHCP. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
2014-03-20netifd: Check interface autostart parameter when handling interface state ↵Hans Dedecker
changes Fixes an issue when 2 interfaces make use of the same ifname (device) and one of the interfaces has autostart disabled; bringing up the other interface would also start the interface for which autostart is disabled (link_state and enabled will both be true for the autostart disabled interface and thus a setup will be launched) Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-03-11netifd: Set interface state in teardown state before launching an interface ↵Hans Dedecker
event Interface state needs to be set in teardown state before launching an interface event otherwise the up state will be reported as true in the ubus interface notify message Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-03-11netifd: Fix bridge MTU setting when a bridge member is addedHans Dedecker
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>
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-17Remove automatically assigned IPv6 routing tableSteven Barth
This puts IPv6 routes back into the main table where they are expected. Instead the newly-fixed source-address restrictions should be used.
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.