From a80bbfedb3ef270930252a48aa00a75aac375856 Mon Sep 17 00:00:00 2001 From: Xiangfu Date: Wed, 4 Jul 2012 18:12:22 +0800 Subject: [PATCH] cleanup milkymist openwrt files --- milkymist-files/files/etc/config/dhcp | 27 ---- milkymist-files/files/etc/config/firewall | 147 ---------------------- milkymist-files/files/etc/config/fstab | 19 --- milkymist-files/files/etc/config/network | 14 --- milkymist-files/files/etc/config/uhttpd | 84 ------------- milkymist-files/files/opt/m1-wireless.lua | 96 -------------- milkymist-files/files/opt/m1-wireless.sh | 72 ----------- 7 files changed, 459 deletions(-) delete mode 100644 milkymist-files/files/etc/config/dhcp delete mode 100644 milkymist-files/files/etc/config/firewall delete mode 100644 milkymist-files/files/etc/config/fstab delete mode 100644 milkymist-files/files/etc/config/network delete mode 100644 milkymist-files/files/etc/config/uhttpd delete mode 100755 milkymist-files/files/opt/m1-wireless.lua delete mode 100755 milkymist-files/files/opt/m1-wireless.sh diff --git a/milkymist-files/files/etc/config/dhcp b/milkymist-files/files/etc/config/dhcp deleted file mode 100644 index 1efde32..0000000 --- a/milkymist-files/files/etc/config/dhcp +++ /dev/null @@ -1,27 +0,0 @@ - -config 'dnsmasq' - option 'domainneeded' '1' - option 'boguspriv' '1' - option 'filterwin2k' '0' - option 'localise_queries' '1' - option 'rebind_protection' '1' - option 'rebind_localhost' '1' - option 'local' '/lan/' - option 'domain' 'lan' - option 'expandhosts' '1' - option 'nonegcache' '0' - option 'authoritative' '1' - option 'readethers' '1' - option 'leasefile' '/tmp/dhcp.leases' - option 'resolvfile' '/tmp/resolv.conf.auto' - -config 'dhcp' 'lan' - option 'interface' 'lan' - option 'start' '100' - option 'leasetime' '12h' - option 'limit' '1' - -config 'dhcp' 'wan' - option 'interface' 'wan' - option 'ignore' '1' - diff --git a/milkymist-files/files/etc/config/firewall b/milkymist-files/files/etc/config/firewall deleted file mode 100644 index bde345c..0000000 --- a/milkymist-files/files/etc/config/firewall +++ /dev/null @@ -1,147 +0,0 @@ - -config 'defaults' - option 'syn_flood' '1' - option 'input' 'ACCEPT' - option 'output' 'ACCEPT' - option 'forward' 'REJECT' - -config 'zone' - option 'name' 'lan' - option 'network' 'lan' - option 'input' 'ACCEPT' - option 'output' 'ACCEPT' - option 'forward' 'REJECT' - -config 'zone' - option 'name' 'wan' - option 'input' 'REJECT' - option 'output' 'ACCEPT' - option 'forward' 'REJECT' - option 'masq' '1' - option 'mtu_fix' '1' - option 'network' 'wan wwan' - -config 'forwarding' - option 'src' 'lan' - option 'dest' 'wan' - -config 'rule' - option 'name' 'Allow-DHCP-Renew' - option 'src' 'wan' - option 'proto' 'udp' - option 'dest_port' '68' - option 'target' 'ACCEPT' - option 'family' 'ipv4' - -config 'rule' - option 'name' 'Allow-Ping' - option 'src' 'wan' - option 'proto' 'icmp' - option 'icmp_type' 'echo-request' - option 'family' 'ipv4' - option 'target' 'ACCEPT' - -config 'rule' - option 'name' 'Allow-DHCPv6' - option 'src' 'wan' - option 'proto' 'udp' - option 'src_ip' 'fe80::/10' - option 'src_port' '547' - option 'dest_ip' 'fe80::/10' - option 'dest_port' '546' - option 'family' 'ipv6' - option 'target' 'ACCEPT' - -config 'rule' - option 'name' 'Allow-ICMPv6-Input' - option 'src' 'wan' - option 'proto' 'icmp' - list 'icmp_type' 'echo-request' - list 'icmp_type' 'destination-unreachable' - list 'icmp_type' 'packet-too-big' - list 'icmp_type' 'time-exceeded' - list 'icmp_type' 'bad-header' - list 'icmp_type' 'unknown-header-type' - list 'icmp_type' 'router-solicitation' - list 'icmp_type' 'neighbour-solicitation' - option 'limit' '1000/sec' - option 'family' 'ipv6' - option 'target' 'ACCEPT' - -config 'rule' - option 'name' 'Allow-ICMPv6-Forward' - option 'src' 'wan' - option 'dest' '*' - option 'proto' 'icmp' - list 'icmp_type' 'echo-request' - list 'icmp_type' 'destination-unreachable' - list 'icmp_type' 'packet-too-big' - list 'icmp_type' 'time-exceeded' - list 'icmp_type' 'bad-header' - list 'icmp_type' 'unknown-header-type' - option 'limit' '1000/sec' - option 'family' 'ipv6' - option 'target' 'ACCEPT' - -config 'include' - option 'path' '/etc/firewall.user' - -config 'zone' - option 'name' 'newzone' - option 'input' 'ACCEPT' - option 'forward' 'REJECT' - option 'network' ' ' - option 'output' 'ACCEPT' - -config 'rule' - option 'target' 'ACCEPT' - option 'src' 'wan' - option 'dest_port' '22' - option 'name' 'ssh' - option 'family' 'ipv4' - option 'proto' 'tcp udp' - -config 'rule' - option 'target' 'ACCEPT' - option 'src' 'wan' - option 'dest_port' '80' - option 'name' 'web' - option 'family' 'ipv4' - option 'proto' 'tcp udp' - -config 'redirect' - option 'target' 'DNAT' - option 'src' 'wan' - option 'dest' 'lan' - option 'proto' 'tcp udp' - option 'src_dport' '4444' - option 'dest_ip' '192.168.42.100' - option 'dest_port' '4444' - option 'name' 'osc' - -config 'redirect' - option 'target' 'DNAT' - option 'src' 'wan' - option 'dest' 'lan' - option 'proto' 'tcp' - option 'src_dport' '21' - option 'dest_ip' '192.168.42.100' - option 'dest_port' '21' - option 'name' 'ftp' - -config 'redirect' - option 'target' 'DNAT' - option 'src' 'wan' - option 'dest' 'lan' - option 'proto' 'tcp udp' - option 'src_dport' '23' - option 'dest_ip' '192.168.42.100' - option 'dest_port' '23' - option 'name' 'telnet' - -config rule - option target 'ACCEPT' - option src 'wan' - option proto 'tcp udp' - option dest_port '8080' - option name 'mjpg' diff --git a/milkymist-files/files/etc/config/fstab b/milkymist-files/files/etc/config/fstab deleted file mode 100644 index b2c8def..0000000 --- a/milkymist-files/files/etc/config/fstab +++ /dev/null @@ -1,19 +0,0 @@ -config global automount - option from_fstab 1 - option anon_mount 1 - -config global autoswap - option from_fstab 1 - option anon_swap 0 - -config mount - option target /overlay - option device /dev/sda1 - option fstype ext4 - option options rw,sync - option enabled 1 - option enabled_fsck 0 - -config swap - option device /dev/sda2 - option enabled 1 diff --git a/milkymist-files/files/etc/config/network b/milkymist-files/files/etc/config/network deleted file mode 100644 index c2bd615..0000000 --- a/milkymist-files/files/etc/config/network +++ /dev/null @@ -1,14 +0,0 @@ - -config 'interface' 'loopback' - option 'ifname' 'lo' - option 'proto' 'static' - option 'ipaddr' '127.0.0.1' - option 'netmask' '255.0.0.0' - -config 'interface' 'lan' - option 'ifname' 'eth0' - option 'type' 'bridge' - option 'proto' 'static' - option 'netmask' '255.255.255.0' - option 'ipaddr' '192.168.42.1' - diff --git a/milkymist-files/files/etc/config/uhttpd b/milkymist-files/files/etc/config/uhttpd deleted file mode 100644 index 08ca5e5..0000000 --- a/milkymist-files/files/etc/config/uhttpd +++ /dev/null @@ -1,84 +0,0 @@ -# Server configuration -config uhttpd main - - # HTTP listen addresses, multiple allowed - list listen_http 0.0.0.0:80 -# list listen_http [::]:80 - - # HTTPS listen addresses, multiple allowed - list listen_https 0.0.0.0:443 -# list listen_https [::]:443 - - # Server document root - option home /www - - # Reject requests from RFC1918 IP addresses - # directed to the servers public IP(s). - # This is a DNS rebinding countermeasure. - option rfc1918_filter 1 - - # Certificate and private key for HTTPS. - # If no listen_https addresses are given, - # the key options are ignored. - option cert /etc/uhttpd.crt - option key /etc/uhttpd.key - - # CGI url prefix, will be searched in docroot. - # Default is /cgi-bin - option cgi_prefix /cgi-bin - - # List of extension->interpreter mappings. - # Files with an associated interpreter can - # be called outside of the CGI prefix and do - # not need to be executable. -# list interpreter ".php=/usr/bin/php-cgi" -# list interpreter ".cgi=/usr/bin/perl" - - # Lua url prefix and handler script. - # Lua support is disabled if no prefix given. -# option lua_prefix /luci -# option lua_handler /usr/lib/lua/luci/sgi/uhttpd.lua - - # CGI/Lua timeout, if the called script does not - # write data within the given amount of seconds, - # the server will terminate the request with - # 504 Gateway Timeout response. - option script_timeout 60 - - # Network timeout, if the current connection is - # blocked for the specified amount of seconds, - # the server will terminate the associated - # request process. - option network_timeout 30 - - # TCP Keep-Alive, send periodic keep-alive probes - # over established connections to detect dead peers. - # The value is given in seconds to specify the - # interval between subsequent probes. - # Setting this to 0 will disable TCP keep-alive. - option tcp_keepalive 1 - - # Basic auth realm, defaults to local hostname -# option realm OpenWrt - - # Configuration file in busybox httpd format -# option config /etc/httpd.conf - - -# Certificate defaults for px5g key generator -config cert px5g - - # Validity time - option days 730 - - # RSA key size - option bits 1024 - - # Location - option country DE - option state Berlin - option location Berlin - - # Common name - option commonname OpenWrt - diff --git a/milkymist-files/files/opt/m1-wireless.lua b/milkymist-files/files/opt/m1-wireless.lua deleted file mode 100755 index e0b683b..0000000 --- a/milkymist-files/files/opt/m1-wireless.lua +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env lua - -local io = require "io" -local os = require "os" -local table = require "table" - -function trim (s) - return (string.gsub(s, "^%s*(.-)%s*$", "%1")) -end - -function split(delim, text) - local list = {} - if string.len(text) <= 0 then - return list - end - delim = delim or "" - local pos = 1 - -- if delim matches empty string then it would give an endless loop - if string.find("", delim, 1) and delim ~= "" then - error("delim matches empty string!") - end - local first, last - while 1 do - if delim ~= "" then - first, last = string.find(text, delim, pos) - else - first, last = string.find(text, "%s+", pos) - if first == 1 then - pos = last+1 - first, last = string.find(text, "%s+", pos) - end - end - if first then -- found? - table.insert(list, string.sub(text, pos, first-1)) - pos = last+1 - else - table.insert(list, string.sub(text, pos)) - break - end - end - return list -end - -function exec(command) - local pp = io.popen(command) - local data = pp:read("*a") - pp:close() - - return data -end - -function iwscan(iface) - local siface = iface or "" - local cnt = exec("iwlist "..siface.." scan 2>/dev/null") - local iws = {} - - cnt = trim(cnt) - for i, l in pairs(split("\n Cell", cnt)) do - local ESSID = l:match("ESSID:\"(.-)\"") - if ESSID then - local Q = l:match("Quality[:=](.-)[ ]") - local A = l:match("Authentication Suites.- : (.-)\n") - local P = l:match("Pairwise Ciphers.- : (.-)\n") - - local enc - if not l:find("Encryption key:on") then - enc = "none" - else - local wpa = l:find("WPA Version 1") - local rsn = l:find("WPA2 Version 1") - if wpa and rsn then enc = "psk+psk2" - elseif rsn then enc = "psk2" - elseif wpa then enc = "psk" - else enc = "wep" end - end - - local a = Q:match("(%d-)/") - local b = Q:match("/(%d-)$") - Q = math.floor(tonumber(a)/tonumber(b)*100) - - local r = Q .. "%," .. ESSID .. "," .. enc - - table.insert(iws, r) - end - end - - return iws -end - -local t = iwscan("wlan0") -if t == {} then - print(); -else - for k,v in pairs(t) do print(v) end -end - diff --git a/milkymist-files/files/opt/m1-wireless.sh b/milkymist-files/files/opt/m1-wireless.sh deleted file mode 100755 index 5042878..0000000 --- a/milkymist-files/files/opt/m1-wireless.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -if [ "$1" == "set" ] && [ "$#" == "4" ]; then - uci delete network.wwan - uci commit wireless - - uci set network.wwan=interface - uci set network.wwan.proto=dhcp - uci commit wireless - - uci delete wireless.@wifi-iface[0] - uci commit wireless - - uci set wireless.@wifi-device[0].disabled=0 - uci add wireless wifi-iface > /dev/null 2>&1 - uci set wireless.@wifi-iface[0].device='radio0' - uci set wireless.@wifi-iface[0].network='wwan' - uci set wireless.@wifi-iface[0].mode='sta' - - #none for an open network, - #wep for WEP, - #psk for WPA-PSK, or - #psk2 - - uci set wireless.@wifi-iface[0].ssid=$2 - uci set wireless.@wifi-iface[0].key=$3 - uci set wireless.@wifi-iface[0].encryption=$4 - - uci commit wireless - wifi up > /dev/null 2>&1 - udhcpc -i wlan0 -b > /dev/null 2>&1 - - ifconfig wlan0 | grep "inet addr" - - exit 0 -fi - - -if [ "$1" == "get" ]; then - ifconfig -a | grep wlan0 > /dev/null 2>&1 - - if [ "$?" != "0" ]; then - iw phy phy0 interface add wlan0 type station - ifconfig wlan0 up - sleep 1 - fi - - /opt/m1-wireless.lua - - exit 0 -fi - -if [ "$1" == "status" ]; then - sleep 1 - IP=`ifconfig wlan0 2>/dev/null | grep "inet addr" | \ - sed -e 's/^ *//g' | cut -d":" -f2 | cut -d" " -f1` - if [ "$?" != 0 ] || [ "${IP}" == "" ]; then - echo "Disconnected" - echo "0.0.0.0" - exit 1 - fi - - ESSID=`iwconfig wlan0 2>/dev/null | grep ESSID | cut -d":" -f 2 | sed -e 's/\"//g'` - - echo "${ESSID}" - echo "${IP}" - - exit 0 -fi - -echo "Usage: $0 [get/set/status] PARAMS..." -exit 1