Mod aaa-12 扩展tc、pbr、auth字段
SOL 修改人:gechangwei 检视人:gechangwei Signed-off-by: gechangwei <gechangwei@cmhi.chinamobile.com>
This commit is contained in:
parent
bf6d2816db
commit
2c3cd00247
|
@ -71,6 +71,15 @@ int cmhi_set_conntrack_u32(const struct sk_buff *skb, uint32_t value, cmhi_ext_t
|
||||||
case ACTION:
|
case ACTION:
|
||||||
ct->cmhi.action = value;
|
ct->cmhi.action = value;
|
||||||
break;
|
break;
|
||||||
|
case AUTH_MARK:
|
||||||
|
ct->cmhi.auth_mark = value;
|
||||||
|
break;
|
||||||
|
case TC_MARK:
|
||||||
|
ct->cmhi.tc_mark = value;
|
||||||
|
break;
|
||||||
|
case PBR_MARK:
|
||||||
|
ct->cmhi.pbr_mark = value;
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
printk(KERN_INFO"[CT_API]set-conntrak_u32: value is not u32\n");
|
printk(KERN_INFO"[CT_API]set-conntrak_u32: value is not u32\n");
|
||||||
return CMHI_EXT_ERR;
|
return CMHI_EXT_ERR;
|
||||||
|
@ -198,6 +207,15 @@ int cmhi_get_conntrack_u32(const struct sk_buff *skb, uint32_t *value, cmhi_ext_
|
||||||
case ACTION:
|
case ACTION:
|
||||||
*value = ct->cmhi.action;
|
*value = ct->cmhi.action;
|
||||||
break;
|
break;
|
||||||
|
case AUTH_MARK:
|
||||||
|
*value = ct->cmhi.auth_mark;
|
||||||
|
break;
|
||||||
|
case TC_MARK:
|
||||||
|
*value = ct->cmhi.tc_mark;
|
||||||
|
break;
|
||||||
|
case PBR_MARK:
|
||||||
|
*value = ct->cmhi.pbr_mark;
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
printk(KERN_INFO"[CT_API]get-conntrak_u32: value is not u32\n");
|
printk(KERN_INFO"[CT_API]get-conntrak_u32: value is not u32\n");
|
||||||
return CMHI_EXT_ERR;
|
return CMHI_EXT_ERR;
|
||||||
|
@ -248,6 +266,15 @@ int cmhi_del_conntrack(const struct sk_buff *skb, cmhi_ext_type type)
|
||||||
case ACTION:
|
case ACTION:
|
||||||
ct->cmhi.action = 0;
|
ct->cmhi.action = 0;
|
||||||
break;
|
break;
|
||||||
|
case AUTH_MARK:
|
||||||
|
ct->cmhi.auth_mark = 0;
|
||||||
|
break;
|
||||||
|
case TC_MARK:
|
||||||
|
ct->cmhi.tc_mark = 0;
|
||||||
|
break;
|
||||||
|
case PBR_MARK:
|
||||||
|
ct->cmhi.pbr_mark = 0;
|
||||||
|
break;
|
||||||
default: {
|
default: {
|
||||||
printk(KERN_INFO"[CT_API]del-conntrak: wrong type\n");
|
printk(KERN_INFO"[CT_API]del-conntrak: wrong type\n");
|
||||||
return CMHI_EXT_ERR;
|
return CMHI_EXT_ERR;
|
||||||
|
|
|
@ -14,6 +14,9 @@ typedef enum{
|
||||||
APP_ID,
|
APP_ID,
|
||||||
POLICY_VERSION,
|
POLICY_VERSION,
|
||||||
ACTION,
|
ACTION,
|
||||||
|
AUTH_MARK,
|
||||||
|
TC_MARK,
|
||||||
|
PBR_MARK,
|
||||||
}cmhi_ext_type;
|
}cmhi_ext_type;
|
||||||
|
|
||||||
//modify cmhi_ext_info u_int32_t status
|
//modify cmhi_ext_info u_int32_t status
|
||||||
|
|
|
@ -63,8 +63,36 @@ static unsigned int test_set_correct_value(void *priv, struct sk_buff *skb, cons
|
||||||
}
|
}
|
||||||
printk(KERN_INFO"[test_set_correct_value] set action successed\n");
|
printk(KERN_INFO"[test_set_correct_value] set action successed\n");
|
||||||
|
|
||||||
goto out;
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] test set auth_mark 60\n");
|
||||||
|
ret = cmhi_set_conntrack_u32(skb, 60, AUTH_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] set auth_mark failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] set auth_mark successed\n");
|
||||||
|
|
||||||
|
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] test set tc_mark 70\n");
|
||||||
|
ret = cmhi_set_conntrack_u32(skb, 70, TC_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] set tc_mark failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] set tc_mark successed\n");
|
||||||
|
|
||||||
|
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] test set pbr_mark 80\n");
|
||||||
|
ret = cmhi_set_conntrack_u32(skb, 80, PBR_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] set pbr_mark failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_set_correct_value] set pbr_mark successed\n");
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
goto out;
|
||||||
out:
|
out:
|
||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
}
|
}
|
||||||
|
@ -131,6 +159,10 @@ static unsigned int test_get_value_by_correct_interface(void *priv, struct sk_bu
|
||||||
u_int32_t policy_version;
|
u_int32_t policy_version;
|
||||||
u_int32_t action;
|
u_int32_t action;
|
||||||
|
|
||||||
|
u_int32_t auth_mark;
|
||||||
|
u_int32_t tc_mark;
|
||||||
|
u_int32_t pbr_mark;
|
||||||
|
|
||||||
printk(KERN_INFO"[test_get_value_by_correct_interface]begin!!!!\n");
|
printk(KERN_INFO"[test_get_value_by_correct_interface]begin!!!!\n");
|
||||||
|
|
||||||
ret = cmhi_get_conntrack_u32(skb, &user_id, USER_ID);
|
ret = cmhi_get_conntrack_u32(skb, &user_id, USER_ID);
|
||||||
|
@ -174,6 +206,30 @@ static unsigned int test_get_value_by_correct_interface(void *priv, struct sk_bu
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
printk(KERN_INFO"[test_get_value_by_correct_interface]: get action: %d successed\n", action);
|
printk(KERN_INFO"[test_get_value_by_correct_interface]: get action: %d successed\n", action);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ret = cmhi_get_conntrack_u32(skb, &auth_mark, AUTH_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_get_value_by_correct_interface]: get auth_mark failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_get_value_by_correct_interface]: get auth_mark: %d successed\n", auth_mark);
|
||||||
|
|
||||||
|
ret = cmhi_get_conntrack_u32(skb, &tc_mark, TC_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_get_value_by_correct_interface]: get tc_mark failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_get_value_by_correct_interface]: get tc_mark: %d successed\n", tc_mark);
|
||||||
|
|
||||||
|
ret = cmhi_get_conntrack_u32(skb, &pbr_mark, PBR_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_get_value_by_correct_interface]: get pbr_mark failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_get_value_by_correct_interface]: get pbr_mark: %d successed\n", pbr_mark);
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -346,6 +402,31 @@ static unsigned int test_del_value(void *priv, struct sk_buff *skb, const struct
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
printk(KERN_INFO"DemoB_test: del action by bit successed\n");
|
printk(KERN_INFO"DemoB_test: del action by bit successed\n");
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
ret = cmhi_del_conntrack(skb, AUTH_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_del_value]: del AUTH_MARK failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_del_value]: del AUTH_MARK successed\n");
|
||||||
|
|
||||||
|
ret = cmhi_del_conntrack(skb, TC_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_del_value]: del TC_MARK failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_del_value]: del TC_MARK successed\n");
|
||||||
|
|
||||||
|
ret = cmhi_del_conntrack(skb, PBR_MARK);
|
||||||
|
if(ret == CMHI_EXT_ERR){
|
||||||
|
printk(KERN_INFO"[test_del_value]: del PBR_MARK failed\n");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
printk(KERN_INFO"[test_del_value]: del PBR_MARK successed\n");
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Reference in New Issue