File tree Expand file tree Collapse file tree 1 file changed +4
-22
lines changed Expand file tree Collapse file tree 1 file changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -17,35 +17,17 @@ local function ip2int(ip)
17
17
return (oct4 << 24 ) + (oct3 << 16 ) + (oct2 << 8 ) + oct1
18
18
end
19
19
20
- function loadcookieport (ip , port , cookie )
21
- local ip = ip2int (ip )
22
-
23
- if not cookies [ip ] then
24
- cookies [ip ] = {}
25
- end
26
-
27
- cookies [ip ][port ] = cookie
28
- end
29
-
30
20
function loadcookie (ip , cookie )
31
21
cookies [ip2int (ip )] = cookie
32
22
end
33
23
34
- function checkcookieport (pkt , ip , port )
35
- local cookiepkt = tonumber (string.match (tostring (pkt ), " Cookie:%s__xdp=(.-)\r\n " ))
36
- if not cookies [ip ] then
37
- return true
38
- end
24
+ function checkcookie (pkt , ip )
25
+ local pattern = ' Cookie:%s*=__xdp=(%d+)%s*'
26
+ local cookiepkt = tonumber (string.match (tostring (pkt ), pattern ))
39
27
40
- if not cookies [ip ][ port ] then
28
+ if not cookies [ip ] then
41
29
return true
42
30
end
43
31
44
- return cookies [ip ][port ] == cookiepkt and true or false
45
- end
46
-
47
- function checkcookie (pkt , ip )
48
- local cookiepkt = tonumber (string.match (tostring (pkt ), " Cookie:%s__xdp=(.-)\r\n " ))
49
-
50
32
return cookies [ip ] == cookiepkt and true or false
51
33
end
You can’t perform that action at this time.
0 commit comments