aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions/network.sh
Commit message (Collapse)AuthorAgeFilesLines
* base-files: fix comment typo in lib/functions/network.shWalter Sonius2020-09-021-1/+1
| | | | | | | | Fix typo in comment. Signed-off-by: Walter Sonius <walterav1984@gmail.com> [commit title/message facelift] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: add network_get_uptime() to /lib/functions/network.shFlorian Eckert2019-06-291-0/+5
| | | | | | Add missing ubus api call for uptime value. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* base-files: add network_get_metric() to /lib/functions/network.shFlorian Eckert2018-09-251-0/+5
| | | | | Signed-off-by: Florian Eckert <fe@dev.tdt.de> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com> [PKG_RELEASE increase]
* base-files: network.sh: gracefully handle missing network.interface ubus nsJo-Philipp Wich2018-07-171-4/+10
| | | | | | | | | | | | | | | | | | | | | When attempting to use any of the functions in network.sh while netifd is not started yet, the ubus interface dump query will fail with "Not found", yielding an empty response. Subsequently, jsonfilter is invoked with an empty string instead of a valid JSON document, causing it to emit a second "unexpected end of data" error. This caused the dnsmasq init script to log the following errors during early boot on some systems: procd: /etc/rc.d/S19dnsmasq: Command failed: Not found. procd: /etc/rc.d/S19dnsmasq: Failed to parse json data: unexpected end of data. Fix the issue by allowing the ubus query to fail with "Not found" but still logging other failures, and by passing an empty JSON object to jsonfilter if the interface status cache is empty. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: network.sh: fix a number of IPv6 logic flawsJo-Philipp Wich2017-06-081-17/+48
| | | | | | | | | | | | | | | | | | | | | | * Change network_get_subnet6() to sensibly guess a suitable prefix Attempt to return the first non-linklocal, non-ula range, then attempt to return the first non-linklocal range and finally fall back to the previous behaviour of simply returning the first found item. * Fix network_get_ipaddrs_all() Instead of replicating the flawed logic appending a fixed ":1" suffix to IPv6 addresses, rely on network_get_ipaddrs() and network_get_ipaddrs6() to build a single list of all interface addresses. * Fix network_get_subnets6() Instead of replicating the flawed logic appending a fixed ":1" suffix to IPv6 addresses, rely on the ipv6-prefix-assignment.local-address field to figure out the proper network address. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: network.sh: properly report local IPv6 addressesJo-Philipp Wich2017-06-081-17/+13
| | | | | | | | | | Rework the network_get_ipaddr6() and network_get_ipaddrs6() functions to fetch the effective local IPv6 address of delegated prefix from the "local-address" field instead of naively hardcoding ":1" as static suffix. Fixes FS#829. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: add network_get_ipaddrs_all()Steven Barth2014-10-091-0/+23
| | | | | | | | Return all IPv4 and IPv6 addresses. Signed-off-by: Mathias Kresin <openwrt@kresin.me> SVN-Revision: 42856
* base-files: whitespace fixesLuka Perkov2014-09-141-1/+1
| | | | | | Signed-off-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 42542
* base-files: /lib/functions/network.sh: fix network_get_ipaddr6Jo-Philipp Wich2014-08-111-1/+12
| | | | | | | | | | | | When looking for the first ipaddr also consider the current prefix just like network_get_ipaddrs6 does. If ipv6-address was empty the function did not return the first ipaddr even if the list was non-empty. fixes commit 83e9122f88a002871d5cdf421cf6aa6052b7e006 Signed-off-by: Henning Schild <henning@hennsch.de> SVN-Revision: 42139
* base-files: depend on jsonfilter and rewrite network.sh to use itJo-Philipp Wich2014-06-191-318/+125
| | | | | | | | | | | Switches /lib/functions/network.sh from jshn based json parsing to jsonfilter expression while keeping the existing api. Expensive methods like "network_find_wan" are up to 20x faster now. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 41281
* base-files: add network_get_protocol() to /lib/functions/network.shJo-Philipp Wich2013-12-161-2/+7
| | | | SVN-Revision: 39099
* base-files: fix whitespacesLuka Perkov2013-12-091-9/+9
| | | | | | Signed-off-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 39006
* base-files: reject invalid uci keys in network_get_device() and related ↵Jo-Philipp Wich2013-07-151-0/+4
| | | | | | procedures (#13886) SVN-Revision: 37345
* base-files: network.sh: extend network_get_ipaddr6() / network_get_subnet6() ↵Jo-Philipp Wich2013-06-171-43/+107
| | | | | | to take ipv6-prefix-assignment into account, add further helper functions to fetch all ips of a given interface SVN-Revision: 36942
* base-files: change network_find_wan() procedure to ignore default gateways ↵Jo-Philipp Wich2013-05-061-10/+14
| | | | | | in different routing tables SVN-Revision: 36553
* base-files: fix network_get_prefix6Steven Barth2013-01-221-1/+1
| | | | SVN-Revision: 35300
* base-files: network.sh: fix typo in previous commitJo-Philipp Wich2013-01-211-1/+1
| | | | SVN-Revision: 35287
* base-files: network.sh: simplify network_get_prefix6()Jo-Philipp Wich2013-01-211-7/+4
| | | | SVN-Revision: 35286
* base-files: add support for ipv6-prefixes in connection with netifdSteven Barth2013-01-151-0/+30
| | | | SVN-Revision: 35168
* base-files: use json_is_a() in network.shJo-Philipp Wich2012-12-171-7/+7
| | | | SVN-Revision: 34733
* base-files: rework cache handling in network.sh to keep the entire parsed ↵Jo-Philipp Wich2012-12-161-129/+159
| | | | | | ifstatus, use jshn namespaces to support using it concurrently with other jshn users SVN-Revision: 34725
* base-files: various enhancements to network.shJo-Philipp Wich2012-12-161-30/+153
| | | | | | | | | | | - support reading inactive gateways and DNS information in network_get_gateway(), network_get_dnsserver() and network_get_dnssearch() by passing "true" as optional last argument - internally cache fetched values to speed up subsequent accesses to the same data, introduce network_flush_cache() to clear them - add some inline function documentation SVN-Revision: 34722
* base-files: remove route enabled check in lib/functions/network.sh after ↵Jo-Philipp Wich2012-09-131-4/+2
| | | | | | netifd bump SVN-Revision: 33391
* base-files: implement network_get_dnsserver() and network_get_dnssearch() in ↵Jo-Philipp Wich2012-06-291-0/+31
| | | | | | /lib/functions/network.sh SVN-Revision: 32531
* base-files: only consider enabled default routes when finding the wan iface ↵Jo-Philipp Wich2012-06-291-2/+4
| | | | | | (#11774) SVN-Revision: 32525
* base-files: implement network_get_gateway(), network_get_gateway6(), ↵Jo-Philipp Wich2012-06-171-0/+59
| | | | | | network_find_wan() and network_find_wan6() in /lib/functions/network.sh SVN-Revision: 32397
* base-files: implement network_defer_device() and network_ready_device() ↵Jo-Philipp Wich2012-06-071-0/+16
| | | | | | wrappers for upcoming netifd iface deferring support SVN-Revision: 32106
* base-files: add network_is_up()Jo-Philipp Wich2012-05-291-0/+6
| | | | SVN-Revision: 31978
* base-files: let network_get_device() return the l3 interface, introduce ↵Jo-Philipp Wich2012-05-291-4/+6
| | | | | | network_get_physdev() to obtain the underlying iface (if applicable) SVN-Revision: 31960
* base-files: add network_get_device() to network.shJo-Philipp Wich2012-05-281-0/+15
| | | | SVN-Revision: 31937
* base-files: introduce /lib/functions/network.sh This file will contain ↵Jo-Philipp Wich2012-05-281-0/+41
common procedures to deal with network interfaces. Initially provides network_get_ipaddr(), network_get_ipaddr6(), network_get_subnet() and network_get_subnet6() to determine the primary IP addresses or subnets of a given logical interface. SVN-Revision: 31935