Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split protos by commas, and ranges by :
Want to be able express ports, protos, etc, with compressed syntax eventually. One day I'd like to be able to express this at a high level allowed_protos = 6,16,icmp,49:51,hipl and then do it in ONE iptables rule, rather than 8.
- Loading branch information
Dave Taht
committed
Dec 30, 2011
1 parent
75aad8c
commit 311ae1c
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/lua | ||
|
||
-- split | ||
|
||
-- FIXME we want to construct a two dimensional table | ||
-- then join it | ||
|
||
function proto_split(s,max) | ||
c = 1 | ||
t = split(',',s) | ||
p = 0 | ||
for i,v in ipairs(t) do | ||
c = c + (p = # split(':',v)) | ||
if c > max then | ||
n = n + 1 | ||
s[n] = v | ||
c = p | ||
else | ||
s[n] = s[n] .. "," .. v | ||
end | ||
end | ||
return(s) | ||
end | ||
|
||
t = proto_split("a,b,c,d,e,f,g,h,i:j",4) | ||
print(# t) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/lua | ||
|
||
require 'ceroenv' | ||
ceroenv.wtf() | ||
env = ceroenv.new() | ||
ceroenv.show() | ||
|
||
PPREREQ= {sch_sfq,sch_red,cls_flow,cls_none} | ||
if ceroenv.prereq(PPREREQ) ~= nil then | ||
print("Awesome") | ||
end | ||
|
||
|
||
-- print(ceroenv.ge("SHELL")) | ||
-- print(ceroenv.env["QMODEL"]) |