summaryrefslogtreecommitdiffhomepage
path: root/ubus.c
AgeCommit message (Collapse)Author
2019-05-16treewide: pass bool as second argument of blobmsg_check_attrHans Dedecker
blobmsg_check_attr() takes as second argument a bool; fix it where needed Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
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-26netifd: fix resource leak on error in netifd_add_dynamic()Hans 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-07-16ubus: display correct prefix size for IPv6 prefix addressHans Dedecker
Make sure the displayed prefix size is identical to the kernel installed prefix size for local IPv6 prefix addresses Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-10-18ubus: display the point-to-point IPv4 addressHans Dedecker
Display the point-to-point IPv4 address as well when dumping the IP address list in ubus. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-10-07ubus: fix ubus error code on reload failureHans Dedecker
Return the more approriate error code UBUS_STATUS_NOT_FOUND in case network reload fails Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-06-17ubus: remove superfluous error check in netifd_add_dynamicHans Dedecker
Check for main device and main device having default config for a dynamic interface was orginally added in commit 266d92dd83bd5bfe520f3e2838794bf9bb827c07 with as purpose to set the device config. The latter was later removed in commit 4bf89afc22b43d5bd155d32d3998348a77179c1a which makes the device checks superfluous. Also not all interfaces have a main device (eg tunnel interfaces) resulting into netifd_add_dynamic returning an error code when such interfaces are added. As an example 6rd interfaces dynamically added by the DHCP script the log messages are cluttered with the trace 'wan (7803): Command failed: Unknown error' after each DHCP renew. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
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-04-05netifd: propagate error code on netifd_reload()Alexandru Ardelean
The context is that we generate some of the UCI config for netifd via scripts/programs. Every once in a while, there's a goof when doing that UCI generation, and netifd prints out the error at stderr, but returns 0 (success) err-code. This change will fail the ubus call if UCI config is invalid or missing for /etc/config/network. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com> 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]
2017-01-31treewide: fix white space errorsHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2017-01-25interface-ip: route proto config support (FS#170)Hans Dedecker
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>
2016-12-12ubus: Display the IPv6 prefix assigned addressHans Dedecker
Display the IPv6 address obtained from a prefix assignment as local-address element in the ubus ipv6-prefix-assignment list so it's explicitly clear which IPv6 address from the delegated prefix is assigned to interface. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-11-22ubus: Use device_find to find a device when displaying device infoHans Dedecker
Replace device_get by device_find in netifd_dev_status as device_get will fail to find the device if it's created via config as an aliased vlan device in dotted notation (eg @iface.200). In such case get_vlan_device_chain will figure out the layer3 device but get_vlan_device will not find the vlan device in the dependency list of the layer 3 device as it has been created as a dependency of the aliased device. 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-08-26device: prepare for adding device handlers dynamicallyArne Kappen
- remove const from device handler struct - pass device handler type to create function Signed-off-by: Arne Kappen <akappen@inet.tu-berlin.de> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
2016-06-06system-linux: Replace device_get by device_find where appropriateHans Dedecker
Replace device_get by device_find so it's clear a device needs to be found present in the device list. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2016-02-01ubus: Fix possible 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-11-19ubus: export dynamic-flag for interfacesSteven Barth
Signed-off-by: Steven Barth <steven@midlink.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-04-14Cleanup issues reported by scan-buildSteven Barth
Signed-off-by: Steven Barth <steven@midlink.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-29add_dynamic: remove redundant codeSteven Barth
device_config is unneeded since add_dynamic is used to create aliases checking of setup state is unneeded because of race condition fixes Signed-off-by: Steven Barth <steven@midlink.org>
2014-07-28ubus: add del_dynamic as complement to add_dynamicSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2014-07-25Only add dynamic interfaces if the underlying interface is readySteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2014-06-18netifd: Route type supportHans Dedecker
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>
2014-06-05add a interface. prefix to ubus_notify callsJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-04-24netifd: Mark interface as dynamic after it has been added in the interface listHans Dedecker
Adding an interface in the interface list in case of a config update will override the node version of the old interface and thus overriding the dynamic interface marker. In case of config update interface_set_dynamic is done on an invalid interface pointer as the new interface pointer has been freed. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-04-19ubus: check the l3_dev pointer before dereferencing itFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-21ubus: use list_empty() instead of the compat wrapperFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-20ubus: fix displaying interface data itemsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-11Revert "ubus events: don't incorrectly announce an interface as being up"Felix Fietkau
Made obsolete by b114b86c70766f67f503077ad1de013c17fbf366 This reverts commit 4d1a597f65bbb49aa843112812d5ca929478c706.
2014-03-05ubus events: don't incorrectly announce an interface as being upSteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2014-02-17wireless: add a "get_validate" methode to ubusJohn Crispin
Signed-off-by: John Crispin <blogic@openwrt.org>
2014-02-14netifd : Fix ubus route src mask printingHans Dedecker
Fix printing of route src mask attribute when it contains 3 digits Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2014-01-17Add indicator-flags to ubus and hotplug update-eventsSteven Barth
2013-12-12Set dynamic interface flag after adding them so the version is preservedSteven Barth
2013-12-08netifd: Don't export default route via UBUS when disabledHans Dedecker
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2013-12-08netifd: Export ip4table/ip6table via UBUSHans Dedecker
Export ip4table/ip6table parameters via UBUS to facilitate route inspection and usage by other applications Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
2013-11-29wireless: add support for global up/down commandFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-11-29add initial support for handling wireless devices via scriptsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-11-27IPv6: add class support to regular IPv6 addressesSteven Barth
2013-10-30IPv6: Export delegation setting via ubusSteven Barth
This allows foreign prefix delegators to quickly distinguish between managed and unmanaged prefixes. Signed-off-by: Steven Barth <steven@midlink.org>
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 source-restricted routesSteven Barth