From 0cbe6146d5c51ee0f7806a83990e9dfc2daf687b Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Mon, 21 Jan 2013 09:48:28 +0000 Subject: [PATCH] luci-0.11: Merge r9624 - r9626 --- contrib/package/freifunk-gwcheck/Makefile | 2 +- .../files/usr/sbin/ff_olsr_test_gw.sh | 75 +++++++++++--- .../luci-static/freifunk-generic/cascade.css | 18 ++-- .../luci-static/freifunk-generic/mobile.css | 98 +++---------------- .../freifunk-generic/smallscreen.css | 3 + .../view/themes/freifunk-generic/header.htm | 7 +- 6 files changed, 91 insertions(+), 112 deletions(-) create mode 100644 themes/freifunk-generic/htdocs/luci-static/freifunk-generic/smallscreen.css diff --git a/contrib/package/freifunk-gwcheck/Makefile b/contrib/package/freifunk-gwcheck/Makefile index 1563b0cb3..fe55e6963 100644 --- a/contrib/package/freifunk-gwcheck/Makefile +++ b/contrib/package/freifunk-gwcheck/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=freifunk-gwcheck -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) diff --git a/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh b/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh index a622a4fc4..3d31b4694 100755 --- a/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh +++ b/contrib/package/freifunk-gwcheck/files/usr/sbin/ff_olsr_test_gw.sh @@ -1,4 +1,16 @@ #!/bin/sh +# Copyright 2013 Manuel Munz +# Licensed under the GNU General Public License (GPL) v3 +# This script monitors the local internet gateway + +. /lib/functions/network.sh + +#Exit if this script is already running +pid="$(pidof ff_olsr_test_gw.sh)" +if [ ${#pid} -gt 5 ]; then + logger -t gwcheck "Gateway check script is already running, exit now" + exit 1 +fi #check if dyngw_plain is installed and enabled, else exit dyngwplainlib=`uci show olsrd |grep dyn_gw_plain |awk {' FS="."; print $1"."$2 '}` @@ -7,13 +19,17 @@ if [ -n "$dyngwplainlib" ]; then exit 1 fi else - echo "dyngw_plain not found in olsrd config, exit" exit 1 fi +#Exit if this script is already running +pid="$(pidof ff_olsr_test_gw.sh)" +if [ ${#pid} -gt 5 ]; then + logger -p debug -t gwcheck "Gateway check script is already running, exit now" + exit 1 +fi -# check if we have a defaultroute with metric=0 in one of these tables: main table and gw-check table. -# If not exit here. +# exit if there is no defaultroute with metric=0 in main or gw-check table. defroutemain="$(ip r s |grep default |grep -v metric)" defroutegwcheck="$(ip r s t gw-check |grep default |grep -v metric)" if [ -z "$defroutegwcheck" -a -z "$defroutemain" ]; then @@ -47,36 +63,73 @@ check_internet() { echo 0 break else - logger -t gw-check "Could not get test file from http://$t/conntest.html" + logger -p debug -t gw-check "Could not fetch http://$t/conntest.html" fi done } +resolve() { + echo "$(nslookup $1 2>/dev/null |grep 'Address' |grep -v '127.0.0.1' |awk '{ print $3 }')" +} + +get_dnsservers() { + # this gets all dns servers for the wan interface. If ubus is not present (like on older + # openwrt versions before Attitude fallback to get these from /var/state/network. + + dns="" + if [ -x /bin/ubus ]; then + network_get_dnsserver dns wan + else + dns="$(grep network.wan.resolv_dns /var/state/network | cut -d "=" -f 2)" + fi +} + iw=$(check_internet) + if [ "$iw" == 0 ]; then # check if we have a seperate routing table for our tests. # If yes, move defaultroute to normal table and delete table gw-check + # Also delete ip rules to use table gw-check for our testhosts and wan dns servers + if [ -n "$defroutegwcheck" ]; then ip r a $defroutegwcheck ip r d $defroutegwcheck t gw-check - ip ru del fwmark 0x2 lookup gw-check for host in $testserver; do - iptables -t mangle -D OUTPUT -d $host -p tcp --dport 80 -j MARK --set-mark 0x2 + ips="$(resolve $host)" + for ip in $ips; do + [ -n "$(ip ru s | grep "to $ip lookup gw-check")" ] && ip rule del to $ip table gw-check + done + done + + get_dnsservers + for d in $dns; do + [ -n "$(ip ru s | grep "to $d lookup gw-check")" ] && ip rule del to $d table gw-check done + + #ip r d default via 127.0.0.1 metric 100000 logger -t gw-check "Internet is available again, restoring default route ( $defroutegwcheck)" fi else # Check failed. If we have a defaultroute with metric=0 and it is already in table gw-check then do nothing. # If there is a defaultroute with metric=0 then remove it from the main routing table and add to table gw-check. + # Also setup ip rules to use table gw-check for our testhosts and wan dns servers + if [ -z "$(ip ru s | grep gw-check)" -a -n "$defroutemain" ]; then - ip rule add fwmark 0x2 lookup gw-check - for host in $testserver; do - iptables -t mangle -I OUTPUT -d $host -p tcp --dport 80 -j MARK --set-mark 0x2 - done ip r a $defroutemain table gw-check ip r d $defroutemain - logger -t gw-check "Internet is not available, deactivating the default route ( $defroutemain)" fi + for host in $testserver; do + ips="$(resolve $host)" + for ip in $ips; do + [ -z "$(ip ru s | grep "to $ip lookup gw-check")" ] && ip rule add to $ip table gw-check + done + done + get_dnsservers + for d in $dns; do + [ -z "$(ip ru s | grep "to $d lookup gw-check")" ] && ip rule add to $d table gw-check + done + #ip r a default via 127.0.0.1 metric 100000 + logger -t gw-check "Internet is not available, deactivating the default route ( $defroutemain)" fi diff --git a/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/cascade.css b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/cascade.css index d5fe77279..2baac1459 100644 --- a/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/cascade.css +++ b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/cascade.css @@ -174,6 +174,8 @@ a img { .header_left{ text-align:left; + max-width: 50%; + float:left; } .header_left a{ @@ -182,21 +184,14 @@ a img { text-decoration: none; } -.header_left .spacer { -height: 12px; -min-height:12px; -width:99%; -} - #header h1, .header_right { - position: absolute; + max-width: 45%; text-align: right; - top: 10px; - right: 10px; font-size: 70%; font-weight: normal; line-height: 160%; + float:right; } ul.dropdowns { @@ -296,7 +291,6 @@ ul.dropdowns ul ul ul li:hover ul { color: #004a9c; border-bottom: 1px dotted #5A5A5A; } - #menubar .warning { color: red; background-color: #FFF; @@ -415,7 +409,7 @@ html #menubar a:visited.warning { * html .lang_pt-br #submenu_admin_network_firewall { width: 15em; } #modemenu { - width: auto; +/* width: auto;*/ background: #000; color: #fff; list-style: none; @@ -448,6 +442,7 @@ textarea#syslog { font-family: monospace; } + #maincontent { clear: both; width: 90%; @@ -976,6 +971,7 @@ td.cbi-value-error { padding: 0.3em; } + .wrapper { min-height: 100%; height: auto !important; diff --git a/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css index e20ab69d3..37d77b4f4 100644 --- a/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css +++ b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/mobile.css @@ -1,84 +1,14 @@ -.high_res_only{ - display:none !important; -} - -#main_bg_pattern { - position:absolute; - background: url(images/PF_background_pattern.png) repeat-x; - top:0px; - left:0px; - width:980px; - z-index:0; -} - -#main_bg { - min-height:2000px; -} - -#heading{ - margin-left:285px !important; -} - #header{ padding-left:0px !important; padding-bottom:24px; } -#menubar{ - font-size:35px; -} - - - #maincontent .multiColumn { - margin:1em 0px; - width:100%; - } - - #maincontent .multiColumn .first{ - width:100% !important; - float:none !important; - display:block !important; - padding-right:0px; - } - - #maincontent .multiColumn .second{ - width:100% !important; - float:none !important; - display:block !important; - padding-right:0px; - } - #maincontent .multiColumn .terminateMultiColumn{ - clear:both; - float:none; - display:block; - text-align:left !important; - padding-top:2em; - } - - #maincontent ul{ - margin-bottom:1em; - } - - - - - -#sidebar_container{ - display:none; -} - -#adbar_low_res_container{ - display:block !important; -} -#main_content_container{ - margin-top:50px !important; +.header_left{ + max-width: 100%; } -.lt_spec{ - padding:0px; - width:54px; - height:42px; - background:transparent url(images/lt_round.png) no-repeat 0% 0% !important; +#mainlogo { + max-width: 90%; } #content { @@ -86,8 +16,8 @@ } #maincontent{ - font-size:25px!important; - line-height:40px; + font-size:1.2em; + line-height:1.5em; } input[type=submit], @@ -97,11 +27,7 @@ input[type=submit], display:inline !important; float:none !important; padding:10px 30px !important; - margin: 0px 10px !important; - font-size:25px !important; - font-family: impact, sans-serif !important; - background:#ff8800 none !important; - border-color:#000000 !important; + margin: 10px 10px 10px 0 !important; } .cbi-input-text, @@ -109,13 +35,11 @@ input[type=submit], .cbi-input-user, .cbi-input-password{ display:block !important; - font-size:25px !important; margin: 0 !important; padding:0 !important; } .cbi-value-field{ - font-size:25px; margin:0 !important; margin-bottom: 1em !important; width:100% !important; @@ -124,12 +48,12 @@ input[type=submit], .cbi-section legend{ white-space:normal !important; } -.cbi-section code{ - font-size:24px; -} .cbi-value-title{ - font-size:25px; font-weight:bold; float:none !important; } + +img { + max-width:100%; +} diff --git a/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/smallscreen.css b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/smallscreen.css new file mode 100644 index 000000000..660cd8df4 --- /dev/null +++ b/themes/freifunk-generic/htdocs/luci-static/freifunk-generic/smallscreen.css @@ -0,0 +1,3 @@ +.header_right { + display:none; +} diff --git a/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm b/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm index a8c257e40..7b173bdb6 100644 --- a/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm +++ b/themes/freifunk-generic/luasrc/view/themes/freifunk-generic/header.htm @@ -75,6 +75,7 @@ You may obtain a copy of the License at + <% if node and node.css then %> @@ -83,6 +84,7 @@ You may obtain a copy of the License at <%= css %> <% end -%> + <%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(tostring(node.title)) or '')) %> - LuCI @@ -117,12 +119,11 @@ You may obtain a copy of the License at <%else%>
- Logo + <%if show_comm then%> <%=community%>
<%end%> -
<%=luci.version.distversion%>
@@ -134,6 +135,8 @@ You may obtain a copy of the License at
+
+ <%end%> -- 2.25.1