Add aaa-12 添加IPV4格式判断机制

RCA:
SOL:
修改人:tongyebin
检视人:
This commit is contained in:
tongyebin 2019-08-29 18:15:43 +08:00
parent d697aa5556
commit dfec2c88da
1 changed files with 23 additions and 1 deletions

View File

@ -1059,7 +1059,29 @@ ret_code routing_config_chk(uint source, uint *config_type,
return RET_CHKERR;
}
}
if(conf_buff->version == IPV4_VERSION)
{
int a = -1,b = -1,c = -1,d = -1;
int a1 = -1,b1 = -1,c1 = -1,d1 = -1;
sscanf(conf_buff->destip,"%d.%d.%d.%d",&a,&b,&c,&d);
if(a<0 || a>255 || b<0 || b>255 || c<0 || c>255 || d<0 |d>255)
{
rpc_log_info("ip address wrong:%d %d %d %d\n",a,b,c,d);
return RET_INPUTERR;
}
if(strcmp(conf_buff->gateway,"") != 0)
{
sscanf(conf_buff->gateway,"%d.%d.%d.%d",&a1,&b1,&c1,&d1);
if(a1<0 || a1>255 || b1<0 || b1>255 || c1<0 || c1>255 || d1<0 |d1>255)
{
rpc_log_info("gateway address wrong:%d %d %d %d\n",a1,b1,c1,d1);
return RET_INPUTERR;
}
}
}
else
{
return RET_CHKERR;