mirror of
https://github.com/CHN-beta/xmurp-ua.git
synced 2026-01-11 01:09:25 +08:00
引起boom
This commit is contained in:
@@ -11,7 +11,6 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <asm/limits.h>
|
||||
#include <linux/time.h>
|
||||
|
||||
const static unsigned char* str_ua_begin = "User-Agent: ";
|
||||
|
||||
@@ -41,6 +41,8 @@ void rkpManager_del(struct rkpManager* rkpm)
|
||||
|
||||
u_int8_t rkpManager_execute(struct rkpManager* rkpm, struct sk_buff* skb)
|
||||
{
|
||||
printk("syn %d ack %d\n", tcp_hdr(skb) -> syn, tcp_hdr(skb) -> ack);
|
||||
printk("sport %d dport %d\n", tcp_hdr(skb) -> source, tcp_hdr(skb) -> dest);
|
||||
if(rkpSettings_first(skb))
|
||||
// 新增加一个流或覆盖已经有的流
|
||||
{
|
||||
@@ -80,12 +82,15 @@ u_int8_t rkpManager_execute(struct rkpManager* rkpm, struct sk_buff* skb)
|
||||
rkps_new -> next = rkpm -> data[id];
|
||||
rkpm -> data[id] = rkps_new;
|
||||
}
|
||||
|
||||
return NF_ACCEPT;
|
||||
}
|
||||
else
|
||||
// 使用已经有的流
|
||||
{
|
||||
u_int8_t id = (ntohs(tcp_hdr(skb) -> source) + ntohs(tcp_hdr(skb) -> dest)) & 0xFF;
|
||||
struct rkpStream *rkps = rkpm -> data[id];
|
||||
printk("rkpStream_belong %d\n", rkpStream_belong(rkps, skb));
|
||||
while(rkps != 0)
|
||||
if(rkpStream_belong(rkps, skb))
|
||||
return rkpStream_execute(rkps, skb);
|
||||
|
||||
@@ -76,13 +76,17 @@ void rkpStream_del(struct rkpStream* rkps)
|
||||
}
|
||||
bool rkpStream_belong(const struct rkpStream* rkps, const struct sk_buff* skb)
|
||||
{
|
||||
printk("rkpStream_belong\n");
|
||||
printk("syn %d ack %d\n", tcp_hdr(skb) -> syn, tcp_hdr(skb) -> ack);
|
||||
printk("sport %d dport %d\n", tcp_hdr(skb) -> source, tcp_hdr(skb) -> dest);
|
||||
printk("rkpSettings_request %d\n", rkpSettings_request(skb));
|
||||
if(rkpSettings_request(skb))
|
||||
{
|
||||
if(rkps -> id[0] != ntohl(ip_hdr(skb) -> saddr))
|
||||
return false;
|
||||
if(rkps -> id[1] != ntohl(ip_hdr(skb) -> daddr))
|
||||
return false;
|
||||
if(rkps -> id[2] != (ntohs(tcp_hdr(skb) -> source) << 16) + ntohs(tcp_hdr(skb) -> dest))
|
||||
if(rkps -> id[2] != ((u_int32_t)ntohs(tcp_hdr(skb) -> source) << 16) + ntohs(tcp_hdr(skb) -> dest))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -92,7 +96,7 @@ bool rkpStream_belong(const struct rkpStream* rkps, const struct sk_buff* skb)
|
||||
return false;
|
||||
if(rkps -> id[1] != ntohl(ip_hdr(skb) -> saddr))
|
||||
return false;
|
||||
if(rkps -> id[2] != (ntohs(tcp_hdr(skb) -> dest) << 16) + ntohs(tcp_hdr(skb) -> source))
|
||||
if(rkps -> id[2] != ((u_int32_t)ntohs(tcp_hdr(skb) -> dest) << 16) + ntohs(tcp_hdr(skb) -> source))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user