summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
AgeCommit message (Collapse)Author
2018-01-17luci-base: log login attemptsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-03luci-base: fix luci.sys.wifi.getiwinfo() on radio namesJo-Philipp Wich
Fall back to using a phy-wide iwinfo handle if the vif query yields no result. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-02luci-base: reorder private functionsJo-Philipp Wich
The _wifi_sid_by_ifname() function depends on _wifi_state_by_ifname() so reorder the private helper functions accordingly to avoid nil value call attempts. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-02luci-base: rework wireless state handling (#1179)Jo-Philipp Wich
- fix mapping of ubus wireless state to uci declared vifs - fix leaking foreign vif info into per-phy iwinfo stats Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-11-11timezone data: update to 2017cHannu Nyman
Update timezone data to 2017c http://mm.icann.org/pipermail/tz-announce/2017-October/000047.html Briefly: Northern Cyprus switches from +03 to +02/+03 on 2017-10-29. Fiji ends DST 2018-01-14, not 2018-01-21. Namibia switches from +01/+02 to +02 on 2018-04-01. Sudan switches from +03 to +02 on 2017-11-01. Tonga likely switches from +13/+14 to +13 on 2017-11-05. Turks & Caicos switches from -04 to -05/-04 on 2018-11-04. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-10-29Fix typos in luci-base/luasrc/http/protocol.luaFelix Yan
2017-10-17luci-base: gracefully handle broken firewall forwarding sectionsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-09-02http: add random security headersJo-Philipp Wich
Fixes #1343. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-08-22luci-base: datatypes: add cidr, ipnet validator typeYousong Zhou
- Rewrite ipmask to use these subtypes - Add ip{4,6}prefix validators to cbi.js Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2017-08-13luci-base: improve language detectionJo-Philipp Wich
Properly deal with client accept languages containing a culture identifier such as "zh-CN" or "pt-BR". Fixes #1226. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-07-28luci-base: let luci.sys.net.devices() return all netdevsJo-Philipp Wich
The previous implementation of the function only returned ethernet interfaces because it relied on the AF_PACKET family entries returned by getifaddrs(). Change the function to simply collect all interface names it sees in order to avoid missing tunnel interfaces. Fixes FS#917. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-07-11luci-base: properly handle authentication without authenticatorJo-Philipp Wich
Some controller actions like the ones in "servicectl" require authentication but are not meant to provide an authenticator because they're only invoked by scripts. Rework the dispatcher logic to handle this situation and only bail out if an authenticator name other than "htmlauth" is set. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-07-11luci-base: use rpcd-mod-rrdns for reverse DNS lookupsJo-Philipp Wich
Drop the individual calls to nixio.getnameinfo() in luci.sys.net and rely on the "network.rrdns.lookup" ubus call instead to fetch domain information within a guaranteed timeout. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-07-11luci-base: drop unused functions in luci.sysJo-Philipp Wich
Drop a number of redundant functions from luci.sys to shrink the code a bit: * luci.sys.net.arptable() - replaced by luci.ip.neighbors() * luci.sys.net.routes() - replaced by luci.ip.routes() * luci.sys.net.routes6() - replaced by luci.ip.routes6() * luci.sys.net.deviceinfo() - replaced by nixio.getaddrinfo() * luci.sys.net.pingtest() - no known user Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-07-09luci-base: use rpcd session loginsJo-Philipp Wich
Drop the custom credentials checking in favor to perform proper session logins via rpcd. This is needed to properly setup ACLs when spawning rpcd sessions in order to support direct client side ubus access in the future. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-05-21luci-base: support ip6ifaceid option for proto_staticHannu Nyman
Add support for 'ip6ifaceid' option for proto_static in LuCI. Information about the option: The option is optional and defaults to '::1'. Allowed values: 'eui64', 'random', fixed value like '::1' or '::1:2' When IPv6 prefix (like 'a:b:c:d::') is received from a delegating server, the ip6ifaceid suffix (like '::1') is used to form the IPv6 address ('a:b:c:d::1') for the interface. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-05-08luci-base: add Etc/GMT timezonesHannu Nyman
Add Etc/GMT timezones like GMT+5 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-05-06luci-base: luci.dispatcher: allow overriding sysauth templateJo-Philipp Wich
In some cases it is useful to be able to override the template used for the sysauth login dialog. Add a new property "sysauth_template" which allows overriding the template name from controller files. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-04-10timezone data: update to 2017bHannu Nyman
Update timezone data to 2017b. http://mm.icann.org/pipermail/tz-announce/2017-February/000045.html http://mm.icann.org/pipermail/tz-announce/2017-March/000046.html Key changes in 2017a-2017b: * Mongolia no longer observes DST. * Chile's Region of Magallanes moves from -04/-03 to -03 year-round. * Switch to numeric time zone abbreviations for South America, as part of the ongoing project of removing invented abbreviations. * Haiti resumed observance of DST in 2017. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-02-28treewide: cleanup references to madwifi from LuCIHannu Nyman
Remove the code related to the deprecated madwifi driver. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-02-27luci-proto-wireguard: add support for fwmark optiondanrl
Adds support for the fwmark option. FwMark is a 32-bit fwmark for outgoing packets. If set to 0 or "off", this option is disabled. Signed-off-by: Dan Luedtke <mail@danrl.com>
2017-02-15luci-base: added dhcpv6 datatypesdanrl
Signed-off-by: Dan Luedtke <mail@danrl.com>
2017-02-09luci-base: add hexstring datatypeHannu Nyman
Add datatype 'hexstring' for input validaiton datatypes. It will accept any hexadecimal string. (no length validation, as rangelength can be used for that.) Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-02-07Merge pull request #965 from cshore-firmware/pull-request-odhcpd-macDaniel Dickinson
base: status: For odhpcd leases display MAC formatted with colons
2017-01-30luci-base: fix logic errors in ipmask4 and ipmask6 datatype validatorsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-28mod-admin-full: Add IPv6 Prefix Delegation information to Status PagesCody R. Brown
The Overview page and Network>Interfaces page currently do not give much information about IPv6, particularly with Prefix Delegated setups. In these setups, ISP will delegate a prefix to the router. Currently LuCI doesn't display this Prefix Delegation from the ISP anywhere. A number of changes was added to this commit: 1) self:_ubus("ipv6-prefix") was extracted and put into protocol.ip6prefix. 2) Network>Interfaces page, if a .ip6prefix is present, show it under Status. (IPv6-PD). 3) On the Overview page, "Type" and "Prefix Delegated" has been added to the IPv6 Network Overview Status: - Type will display the .proto, similar to the IPv4 case. If a .ip6prefix is present, it'll display a "-pd" at the end of the Type: i.e. dhcpv6-pd vs. dhcpv6. - If no .ip6prefix is present, it'll do what it does currently, and just show Address, or :: if no address is present. - If .ip6prefix is present, it'll show the "Prefix Delegated", it'll also hide "Address" if no address is present, else it'll show ifc6.ip6addr as well. Signed-off-by: Cody R. Brown <dev@codybrown.ca>
2017-01-26luci-base: mvalue: fix column wrappingJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-24luci-base: datatypes.lua: add missing parentheses in conditionalJo-Philipp Wich
The missing parens lead to a wrong expression precedence, causing a runtime error when attempting to compare nil with a number. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-23luci-base: ipmask, ipmask4 and ipmask6 validatorsJo-Philipp Wich
These validators accept IP address specifications in the form - address - address/bits - address/netmask Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-23luci-base: datatypes.lua: cleanup white spaceJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-01-23luci-base: luci.tools.status: properly parse infinite dnsmasq leasesCody R. Brown
The expiry time in a dnsmasq lease file line may be 0 (i.e. expiry date = 01/01/1970 00:00:00 GMT) to denote an infinite lease time, so adjust the code to properly support that. The expiry attribute of the lease object will be set to "false" in case of an infinite lease. This is to mimic the odhcp code below. If the expiry date is not equal to 0, then just do exactly what was done before (return the os.diff of current time and ts). Signed-off-by: Cody R. Brown <dev@codybrown.ca>
2017-01-20base: status: For odhpcd leases display MAC formatted with colonsDaniel Dickinson
This should result in the MAC address display being the same using odhcpd for v4 DHCP as when using DNSMasq for v4 DHCP. Signed-off-by: Daniel Dickinson <lede@cshore.thecshore.com>
2016-12-30base: webadmin: Don't take substring of nil variableDaniel Dickinson
When converting interface names to UCI network names webadmin fails if there is no UCI network name because webadmin failed to ensure uciname has a value before attempting to take a substring. Signed-off-by: Daniel Dickinson <lede@cshore.thecshore.com>
2016-12-21luci-base: luci.sys.iptparser: properly check for table supportJo-Philipp Wich
Do not assume that the "raw" table is present on any system, instead check /proc/net/ip{,6}_tables_names to determine which iptables tables are available. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-12-10Merge pull request #663 from NeoRaider/styleable-checkboxesDaniel Dickinson
luci-base: view: make checkboxes and radio buttons styleable
2016-12-09time zone data: Update to 2016jHannu Nyman
Changes: Saratov, Russia switches from +03 to +04 on 2016-12-04 at 02:00. This hives off a new zone Europe/Saratov from Europe/Volgograd. The new zone Asia/Atyrau for Atyraƫ Region, Kazakhstan, is like Asia/Aqtau except it switched from +04/+05 to +05/+06 in spring 1999, not fall 1994. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2016-12-09luci-base: luci.tools.status: properly parse infinite odhcpd leasesJo-Philipp Wich
The expiry time in an odhcpd lease file line may be -1 to denote an infinite lease time, so adjust the code to properly support that. The expiry attribute of the lease object will be set to "false" in case of an infinite lease. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-11-08time zone data: Update to 2016iHannu Nyman
Note that several of the time zones now use a numeric name that is quoted with < > (e.g. "<+03>-3") musl 1.1.15 and earlier have a bug with < > quoted time zone names. Fix for the bug * has already been patched in musl upstream with http://git.musl-libc.org/cgit/musl/commit/?id=8ca27ac4bfe73bff785d0c26c1de0da92b55e5c6 * has been committed in LEDE with https://github.com/lede-project/source/commit/671cb35880308404a17c430c4b3b13dd506a5671 * has been submitted to Openwrt as pull request https://github.com/openwrt/openwrt/pull/163 Key changes in 2016d-2016i: --------------------------- 2016d: America/Caracas switches from -0430 to -04 on 2016-05-01. Asia/Magadan switches from +10 to +11 on 2016-04-24. New zone Asia/Tomsk, split off from Asia/Novosibirsk. 2016f: Asia/Novosibirsk switches from +06 to +07 on 2016-07-24. Asia/Novokuznetsk and Asia/Novosibirsk now use numeric time zone abbreviations instead of invented ones. 2016g: Turkey switched from EET/EEST (+02/+03) to permanent +03, effective 2016-09-07. Use "+03" rather than an invented abbreviation for the new time. Several zones in Antarctica and the former Soviet Union, along with zones intended for ships at sea that cannot use POSIX TZ strings, now use numeric time zone abbreviations instead of invented or obsolete alphanumeric abbreviations. 2016h: Asia/Gaza and Asia/Hebron end DST on 2016-10-29, not 2016-10-21. Predict that future fall transitions will be on the last Saturday of October. Asia/Colombo now uses numeric time zone abbreviations like "+0530" instead of alphabetic ones like "IST" and "LKT". 2016i: Pacific/Tongatapu begins DST on 2016-11-06, ending on 2017-01-15. Assume future observances in Tonga will be from the first Sunday in November through the third Sunday in January, like Fiji. Switch to numeric time zone abbreviations for this zone. Northern Cyprus is now +03 year round, causing a split in Cyprus time zones starting 2016-10-30 at 04:00. This creates a zone Asia/Famagusta. Antarctica/Casey switched from +08 to +11 on 2016-10-22. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2016-08-18luci-base: properly style login alert messageJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-08-15luci-base: support reading switch topology from /etc/board.jsonJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-08-04luci-base: fix handling of monitor ifacesJo-Philipp Wich
Wireless monitor interfaces usually have no SSID set in their config and various network model utility functions did not handle this case properly, mainly while trying to incorperate the SSID string into various description labels. Fall back to the internal network id (radioX.networkY) in cases where neither the SSID nor the BSSID are available. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-08-04luci-base: improve string format error reportingJo-Philipp Wich
In mod metamethod, execute string format under pcall() and rethrow error in caller context to report caller of function in errors and not the meta method itself. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-06-03luci-base: fix whitespaceHannu Nyman
change spaces to tabs Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2016-04-26luci-base: fix syntax error in luci.model.networkJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-04-26luci-base: add more ignore patterns to luci.model.networkJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-04-26luci-base: fix luci.model.network.ignore_interface()Jo-Philipp Wich
Fix the underlying _iface_ignore() function to not ignore virtual interfaces, in order to let ignore_interface() return true for PPP and similar devices. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-04-17luci-base: read odhcpd leasefile location via uciHannu Nyman
Check the location of the odhcpd leasefile from /etc/config/dhcp via uci. Fallback to the default location. This fixes #702 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2016-04-08luci-base: utils: Make checklib return a booleanDaniel Dickinson
Using tristate is counter-intuitive and probably doesn't provide a lot of benefit so we use a boolean and treat "don't know" as false (because it is safer than showing options that are not actually available). Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
2016-04-01Update network.luaOskari Rauta
Fix display of WAN status when WAN is provided by using WWAN device or similar with other similar similar methods. Explanation: Before this, protocol was fetched from /etc/config/network for interface which often is wan_4 - but protocol is configured in file as wan, and therefore protocol is always none, since configuration is made for wan and then setup as wan_4 and possibly wan_6 if ipv6 is being used. This commit uses ubus to get used active protocol. For example, in case of qmi, it displays protocol as dhcp since even if I configured wan to use qmi, dhcp was used as a protocol for getting IP address.
2016-03-30timezone data: update to 2016cHannu Nyman
Update timezone data to 2016c. 2016b: http://mm.icann.org/pipermail/tz-announce/2016-March/000036.html Changes affecting future time stamps New zones Europe/Astrakhan and Europe/Ulyanovsk for Astrakhan and Ulyanovsk Oblasts, Russia, both of which will switch from +03 to +04 on 2016-03-27 at 02:00 local time. They need distinct zones since their post-1970 histories disagree. New zone Asia/Barnaul for Altai Krai and Altai Republic, Russia, which will switch from +06 to +07 on the same date and local time. Also, Asia/Sakhalin moves from +10 to +11 on 2016-03-27 at 02:00. As a trial of a new system that needs less information to be made up, the new zones use numeric time zone abbreviations like "+04" instead of invented abbreviations like "ASTT". Haiti will not observe DST in 2016. Palestine's spring-forward transition on 2016-03-26 is at 01:00, not 00:00. Guess future transitions will be March's last Saturday at 01:00, not March's last Friday at 24:00. 2016c: http://mm.icann.org/pipermail/tz-announce/2016-March/000037.html Changes affecting future time stamps Azerbaijan no longer observes DST. Chile reverts from permanent to seasonal DST. Guess that future transitions are August's and May's second Saturdays at 24:00 mainland time. Also, call the period from 2014-09-07 through 2016-05-14 daylight saving time instead of standard time, as that seems more appropriate now. Note for Openwrt usage: Either musl or busybox does not like the new timezone format. Although the rule looks ok in /etc/TZ, timezone is interpreted wrongly by date, uptime etc. "Old timezones" are handle correctly, but these new "<+04>-4" style zones do not work. Example below: Europe/Helsinki root@OpenWrt:~# cat /etc/TZ EET-2EEST,M3.5.0/3,M10.5.0/4 root@OpenWrt:~# uptime 11:00:52 up 18:17, load average: 0.43, 0.13, 0.11 root@OpenWrt:~# date Wed Mar 30 11:00:55 EEST 2016 Europe/Astrakhan ( Time is showed as GMT instead of the correct zone and zone name is parsed wrongly ) root@OpenWrt:~# cat /etc/TZ <+04>-4 root@OpenWrt:~# uptime 08:02:52 up 18:19, load average: 0.17, 0.18, 0.13 root@OpenWrt:~# date Wed Mar 30 08:02:59 +04>-4 2016 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>