Changeset 8b987c8 in freewrt


Ignore:
Timestamp:
Sep 18, 2006, 9:42:28 PM (19 years ago)
Author:
Thorsten Glaser <tg@…>
Branches:
freewrt_1_0, freewrt_2_0
Children:
45e7b1b
Parents:
93cb32c
Message:

add the old /usr/lib/common.awk from base-files rev. 471
to /usr/lib/webif/common.awk and use it; bump package patchlevel

this _might_ unbreak webif

reported by ArteK in IRC

git-svn-id: svn://www.freewrt.org/trunk/freewrt@634 afb5a338-a214-0410-bd46-81f09a774fd1

Location:
package/webif
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • package/webif/Makefile

    r93cb32c r8b987c8  
    99PKG_NAME:=              webif
    1010PKG_VERSION:=           0.2
    11 PKG_RELEASE:=           2
     11PKG_RELEASE:=           3
    1212
    1313include $(TOPDIR)/mk/package.mk
  • package/webif/files/usr/lib/webif/common.awk

    r93cb32c r8b987c8  
     1# $FreeWRT$
     2
     3function portstr(type, str) {
     4        gsub(/-/, ":", str)
     5        if (insmod_mport != 1) {
     6                print "insmod ipt_multiport >&- 2>&-"
     7                insmod_mport = 1
     8        }
     9        if (type == "src") return " -m multiport --sports " str
     10        else return " -m multiport --dports " str
     11}
     12
     13function str2ipt(str) {
     14        str2data(str)
     15        _cmd = ""
     16        if (_l["src"] != "") _cmd = _cmd " -s " _l["src"]
     17        if (_l["dest"] != "") _cmd = _cmd " -d " _l["dest"]
     18        if (_l["proto"] != "") {
     19                _cmd = _cmd " -p " _l["proto"]
     20        }
     21        # scripts need to check for proto="" and emit two rules in that case
     22        if ((_l["proto"] == "") || (_l["proto"] == "tcp") || (_l["proto"] == "udp")) {
     23                if (_l["sport"] != "") _cmd = _cmd portstr("src", _l["sport"])
     24                if (_l["dport"] != "") _cmd = _cmd portstr("dest", _l["dport"])
     25        }
     26        if (_l["layer7"] != "") {
     27                if (insmod_l7 != 1) {
     28                        print "insmod ipt_layer7 >&- 2>&-"
     29                        insmod_l7 = 1
     30                }
     31                _cmd = _cmd " -m layer7 --l7proto " _l["layer7"]
     32        }
     33        return _cmd
     34}
     35
     36function str2data(str) {
     37        delete _l
     38        _n = split(str, _o, "[\t ]")
     39        for (_i = 1; _i <= _n; _i++) {
     40                _n2 = split(_o[_i], _c, "=")
     41                if (_n2 == 2) _l[_c[1]] = _c[2]
     42        }
     43}
     44
     45function bitcount(c) {
     46        c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
     47        c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
     48        c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f)
     49        c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff)
     50        c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff)
     51        return c
     52}
     53
     54function validate_netmask(nm) {
     55        return and(-nm,compl(nm))
     56}
     57
     58function ip2int(ip) {
     59        for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
     60        return ret
     61}
     62
     63function int2ip(ip,ret,x) {
     64        ret=and(ip,255)
     65        ip=rshift(ip,8)
     66        for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
     67        return ret
     68}
     69
    170function start_form(title, field_opts, field_opts2) {
    271        print "<div class=\"settings\"" field_opts ">"
  • package/webif/files/www/cgi-bin/webif/lan.sh

    r93cb32c r8b987c8  
    3838                save_setting dhcp dhcp_enabled $FORM_dhcp_enabled
    3939                FORM_dhcp_num=$(
    40 awk -f /usr/lib/common.awk -f - $FORM_dhcp_start $FORM_dhcp_end <<EOF
     40awk -f /usr/lib/webif/common.awk -f - $FORM_dhcp_start $FORM_dhcp_end <<EOF
    4141BEGIN   {
    4242        ipstart=ip2int(ARGV[1])
Note: See TracChangeset for help on using the changeset viewer.