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)
1717 return (oct4 << 24 ) + (oct3 << 16 ) + (oct2 << 8 ) + oct1
1818end
1919
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-
3020function loadcookie (ip , cookie )
3121 cookies [ip2int (ip )] = cookie
3222end
3323
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 ))
3927
40- if not cookies [ip ][ port ] then
28+ if not cookies [ip ] then
4129 return true
4230 end
4331
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-
5032 return cookies [ip ] == cookiepkt and true or false
5133end
You can’t perform that action at this time.
0 commit comments