Commit Graph

27 Commits (34bbbbf9c3b39e7b2d81df590aad5cdbd00280d6)

Author SHA1 Message Date
Jo-Philipp Wich 6426e4edef base-files: network.sh: fix a number of IPv6 logic flaws
* 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>
7 years ago
Jo-Philipp Wich 7f91cabd0d base-files: network.sh: properly report local IPv6 addresses
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>
7 years ago
Steven Barth 14e6559eee base-files: add network_get_ipaddrs_all()
Return all IPv4 and IPv6 addresses.

Signed-off-by: Mathias Kresin <openwrt@kresin.me>

SVN-Revision: 42856
10 years ago
Luka Perkov a8b6ca8797 base-files: whitespace fixes
Signed-off-by: Luka Perkov <luka@openwrt.org>

SVN-Revision: 42542
10 years ago
Jo-Philipp Wich f63509ac89 base-files: /lib/functions/network.sh: fix network_get_ipaddr6
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
10 years ago
Jo-Philipp Wich 7eb721425e base-files: depend on jsonfilter and rewrite network.sh to use it
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
10 years ago
Jo-Philipp Wich fe230cac18 base-files: add network_get_protocol() to /lib/functions/network.sh
SVN-Revision: 39099
11 years ago
Luka Perkov 3ceb6b3274 base-files: fix whitespaces
Signed-off-by: Luka Perkov <luka@openwrt.org>

SVN-Revision: 39006
11 years ago
Jo-Philipp Wich 55178554c2 base-files: reject invalid uci keys in network_get_device() and related procedures (#13886)
SVN-Revision: 37345
11 years ago
Jo-Philipp Wich 265a2deba3 base-files: network.sh: extend network_get_ipaddr6() / network_get_subnet6() to take ipv6-prefix-assignment into account, add further helper functions to fetch all ips of a given interface
SVN-Revision: 36942
11 years ago
Jo-Philipp Wich 026271d03c base-files: change network_find_wan() procedure to ignore default gateways in different routing tables
SVN-Revision: 36553
11 years ago
Steven Barth 231f8c2969 base-files: fix network_get_prefix6
SVN-Revision: 35300
11 years ago
Jo-Philipp Wich 1941fb309d base-files: network.sh: fix typo in previous commit
SVN-Revision: 35287
11 years ago
Jo-Philipp Wich 3b2db1838a base-files: network.sh: simplify network_get_prefix6()
SVN-Revision: 35286
11 years ago
Steven Barth 847cd984b9 base-files: add support for ipv6-prefixes in connection with netifd
SVN-Revision: 35168
11 years ago
Jo-Philipp Wich 3339316fbe base-files: use json_is_a() in network.sh
SVN-Revision: 34733
12 years ago
Jo-Philipp Wich 17acf9bf27 base-files: rework cache handling in network.sh to keep the entire parsed ifstatus, use jshn namespaces to support using it concurrently with other jshn users
SVN-Revision: 34725
12 years ago
Jo-Philipp Wich 1600ba99e4 base-files: various enhancements to network.sh
- 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
12 years ago
Jo-Philipp Wich dac5ed38b6 base-files: remove route enabled check in lib/functions/network.sh after netifd bump
SVN-Revision: 33391
12 years ago
Jo-Philipp Wich b2e5c5f82e base-files: implement network_get_dnsserver() and network_get_dnssearch() in /lib/functions/network.sh
SVN-Revision: 32531
12 years ago
Jo-Philipp Wich e654014352 base-files: only consider enabled default routes when finding the wan iface (#11774)
SVN-Revision: 32525
12 years ago
Jo-Philipp Wich 57a7257569 base-files: implement network_get_gateway(), network_get_gateway6(), network_find_wan() and network_find_wan6() in /lib/functions/network.sh
SVN-Revision: 32397
12 years ago
Jo-Philipp Wich 9869b4da3c base-files: implement network_defer_device() and network_ready_device() wrappers for upcoming netifd iface deferring support
SVN-Revision: 32106
12 years ago
Jo-Philipp Wich c11151bc70 base-files: add network_is_up()
SVN-Revision: 31978
12 years ago
Jo-Philipp Wich bf52cbf108 base-files: let network_get_device() return the l3 interface, introduce network_get_physdev() to obtain the underlying iface (if applicable)
SVN-Revision: 31960
12 years ago
Jo-Philipp Wich 8ef9450b37 base-files: add network_get_device() to network.sh
SVN-Revision: 31937
12 years ago
Jo-Philipp Wich f1d04190c5 base-files: introduce /lib/functions/network.sh This file will contain 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
12 years ago