OCT cpp check
This commit is contained in:
parent
60b1037916
commit
5d74d4f1be
|
@ -89,9 +89,6 @@ void dpi_cache_list_init(void)
|
|||
*/
|
||||
int dpi_cache_node_hash(struct dpi_cache_node node)
|
||||
{
|
||||
int i = 0;
|
||||
int dip = 0;
|
||||
|
||||
pkt_info_t info;
|
||||
info.port = node.port;
|
||||
info.sport = 0;
|
||||
|
@ -100,6 +97,8 @@ int dpi_cache_node_hash(struct dpi_cache_node node)
|
|||
if (node.ipv4 == true ) {
|
||||
info.dstip = node.ip.ip4.s_addr;
|
||||
} else {
|
||||
int i = 0;
|
||||
int dip = 0;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
dip ^= node.ip.ip6.s6_addr32[i];
|
||||
}
|
||||
|
@ -115,7 +114,6 @@ int dpi_cache_node_hash(struct dpi_cache_node node)
|
|||
*/
|
||||
bool dpi_cache_node_compare(struct dpi_cache_node src,struct dpi_cache_node dst,bool update_appid)
|
||||
{
|
||||
int i = 0;
|
||||
if (src.port != dst.port){
|
||||
return false;
|
||||
}
|
||||
|
@ -129,6 +127,7 @@ bool dpi_cache_node_compare(struct dpi_cache_node src,struct dpi_cache_node dst,
|
|||
return false;
|
||||
}
|
||||
}else{
|
||||
int i = 0;
|
||||
for (i = 0; i < 4; i++){
|
||||
if (src.ip.ip6.s6_addr32[i] != dst.ip.ip6.s6_addr32[i]){
|
||||
return false;
|
||||
|
@ -152,11 +151,10 @@ bool dpi_cache_node_compare(struct dpi_cache_node src,struct dpi_cache_node dst,
|
|||
*/
|
||||
bool dpi_cache_node_search(struct dpi_cache_node node,int flag)
|
||||
{
|
||||
struct list_head * pList;
|
||||
struct dpi_cache_node *pNode;
|
||||
struct list_head * pList = NULL;
|
||||
int hash = dpi_cache_node_hash(node);
|
||||
list_for_each(pList,&dpi_cache_head[hash]){
|
||||
pNode = list_entry(pList,struct dpi_cache_node,list);
|
||||
struct dpi_cache_node *pNode = list_entry(pList,struct dpi_cache_node,list);
|
||||
if (dpi_cache_node_compare(node,*pNode,flag)){
|
||||
return true;
|
||||
}
|
||||
|
@ -249,6 +247,7 @@ int dpi_cache_timer_init(void) {
|
|||
printk(KERN_INFO"timer pending:%d\n", timer_pending(&gTimer));
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
void test_func(void)
|
||||
{
|
||||
struct dpi_cache_node node1,node2,node3;
|
||||
|
@ -273,13 +272,16 @@ void test_func(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
void dpi_cache_timer_exit(void) {
|
||||
printk(KERN_INFO"%s jiffies:%ld\n", __func__, jiffies);
|
||||
del_timer(&gTimer);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(dpi_cache_node_add);
|
||||
static int __init dpi_cahce_module_init(void)
|
||||
{
|
||||
create_crc_table();
|
||||
dpi_cache_list_init();
|
||||
dpi_cache_timer_init();
|
||||
|
||||
|
|
|
@ -86,8 +86,7 @@ void print_result(FILE *fp)
|
|||
|
||||
int rpdb_popen(char *cmd)
|
||||
{
|
||||
FILE *fp = NULL;
|
||||
fp = popen(cmd, "r");
|
||||
FILE *fp = popen(cmd, "r");
|
||||
if(!fp)
|
||||
{
|
||||
perror("popen");
|
||||
|
@ -638,7 +637,11 @@ int rpdb_add_delete_table(char *gateway,char* tbl_name,int op)
|
|||
fp = fopen(RT_TABLES_PATH,"ra+");
|
||||
if(NULL == fp) return -1;
|
||||
fp_tmp = fopen("/tmp/rt_tables","w");
|
||||
if (fp_tmp == NULL) return -1;
|
||||
if (fp_tmp == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
while(!feof(fp)) /* 遍历文件每一行,查找 路由表是否存在 */
|
||||
{
|
||||
memset(line_cnt,0,1024);
|
||||
|
@ -660,16 +663,17 @@ int rpdb_add_delete_table(char *gateway,char* tbl_name,int op)
|
|||
{
|
||||
if(index < 1)
|
||||
{
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(index > 1)
|
||||
{
|
||||
fclose(fp);
|
||||
rpdb_calc(table_name,RPDB_ROUTE_DEL);
|
||||
return mark;
|
||||
}
|
||||
|
||||
fp = fopen(RT_TABLES_PATH,"r+");
|
||||
if (NULL == fp)
|
||||
{
|
||||
return -1;
|
||||
|
@ -677,7 +681,11 @@ int rpdb_add_delete_table(char *gateway,char* tbl_name,int op)
|
|||
else
|
||||
{
|
||||
fp_tmp = fopen("/tmp/rt_tables","w");
|
||||
if (fp_tmp == NULL) return -1;
|
||||
if (fp_tmp == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
while(!feof(fp)) /* 遍历文件每一行,查找 路由表是否存在 */
|
||||
{
|
||||
memset(line_cnt,0,1024);
|
||||
|
@ -712,6 +720,8 @@ int rpdb_add_delete_table(char *gateway,char* tbl_name,int op)
|
|||
}
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
* 路由添加接口
|
||||
|
@ -779,4 +789,4 @@ int main()
|
|||
printf("~~~~~~%d\n",rpdb_add_del_route("2a01:198:603:0:396e:4789:8e99:890f",NULL,RPDB_ROUTE_ADD));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue