From 562d5c3b6aa05073333ab09adb68ce3710e14c2a Mon Sep 17 00:00:00 2001 From: tongyebin Date: Fri, 30 Aug 2019 10:56:19 +0800 Subject: [PATCH] =?UTF-8?q?Mod=20=20aaa-12=20=E4=BF=AE=E6=94=B9=E9=9D=99?= =?UTF-8?q?=E6=80=81=E8=B7=AF=E7=94=B1check=E9=80=BB=E8=BE=91=20RCA?= =?UTF-8?q?=EF=BC=9A=20SOL=EF=BC=9A=20=E4=BF=AE=E6=94=B9=E4=BA=BA=EF=BC=9A?= =?UTF-8?q?tongyebin=20=E6=A3=80=E8=A7=86=E4=BA=BA=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../static_routing_config.c | 63 +++++++++---------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/Platform/user/configm/config-server/static_routing_config/static_routing_config.c b/Platform/user/configm/config-server/static_routing_config/static_routing_config.c index 71d50835e..1b196f1e8 100644 --- a/Platform/user/configm/config-server/static_routing_config/static_routing_config.c +++ b/Platform/user/configm/config-server/static_routing_config/static_routing_config.c @@ -1043,28 +1043,6 @@ ret_code routing_config_chk(uint source, uint *config_type, { return RET_CHKERR; } - - else 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 if(strcmp(conf_buff->gateway,"") == 0 && strcmp(conf_buff->dev,"") == 0) { @@ -1072,23 +1050,44 @@ ret_code routing_config_chk(uint source, uint *config_type, return RET_CHKERR; } - } - - else if ((*config_type == CM_CONFIG_GET_ALL)) + else if(conf_buff->version == IPV4_VERSION) { - if ((*output_len)<(ROUTING_TABLE_MAX_NUMBER * sizeof(routing_t))) - { - rpc_log_info("getall check error\n"); - return RET_CHKERR; - } - } + 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_CHKERR; + } + + 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_CHKERR; + } + } + } + + } + + else if ((*config_type == CM_CONFIG_GET_ALL)) + { + if ((*output_len)<(ROUTING_TABLE_MAX_NUMBER * sizeof(routing_t))) + { + rpc_log_info("getall check error\n"); + return RET_CHKERR; + } + } else { return RET_CHKERR; } - if(conf_length <= CM_BUFF_SIZE) {