Commit d93251fa authored by wangyongshou's avatar wangyongshou

modify error of config interfce state/ip, ip route

parent f922788c
......@@ -80,6 +80,7 @@ void upf_create_gtpu_tunnel(const u32 n3_local_ip, const u32 n3_remote_ip, const
{
u8 *buf = NULL;
char cmd[UPF_BUF] = {0} ;
char n3_local[UPF_BUF] = {0};
char n3_remote[UPF_BUF] = {0};
vlib_main_t * vm = &vlib_global_main;
......@@ -87,15 +88,16 @@ void upf_create_gtpu_tunnel(const u32 n3_local_ip, const u32 n3_remote_ip, const
upf_ip4_to_str(n3_local_ip, n3_local, UPF_BUF);
upf_ip4_to_str(n3_remote_ip, n3_remote, UPF_BUF);
char cmd[UPF_BUF] = {0} ;
snprintf(cmd, UPF_BUF, GTPU_TUNNEL, n3_local, n3_remote, teid);
int len = snprintf(cmd, UPF_BUF, GTPU_TUNNEL, n3_local, n3_remote, teid);
unformat_input_t sub_input;
vec_resize (buf, UPF_BUF);
//vec_copy(buf, cmd);
unformat_input_t sub_input;
vec_resize (buf, strlen(cmd));
strncpy((char *)buf, cmd, strlen(cmd));
clib_upf_debug(um->log_fd,"len:%u, strlen:%u", len, strlen(cmd));
clib_upf_debug(um->log_fd, "\n\n***** Startup Config *****\n\n%s\n***** End Startup Config *****\n\n",cmd);
if(vec_len (buf))
......@@ -123,7 +125,8 @@ void upf_create_ip_route(const u32 ue_ip, const char *gtpu_name)
snprintf(cmd, UPF_BUF, IP_ROUTE, ueaddr, gtpu_name);
unformat_input_t sub_input;
vec_resize (buf, UPF_BUF);
vec_resize (buf, strlen(cmd));
strncpy((char *)buf, cmd, strlen(cmd));
clib_upf_debug(um->log_fd, "\n\n***** Startup Config *****\n\n%s\n***** End Startup Config *****\n\n",cmd);
......
......@@ -390,14 +390,14 @@ startup_config_process (vlib_main_t * vm,
strcat(if_cmd, IF_UP_IPADDR);
strcat(if_cmd, "ip route add 0.0.0.0/0 via %s %s\n\n");
vec_resize (buf, BUF_LEN);
snprintf(cmd, BUF_LEN, if_cmd,
if_info->if_n3.name, if_info->if_n3.name,if_info->if_n3.ipaddr, if_info->if_n3.netmask,
if_info->if_n6.name, if_info->if_n6.name,if_info->if_n6.ipaddr, if_info->if_n6.netmask,
if_info->if_n6.name, if_info->if_n6.gateway);
vec_copy(buf, cmd);
vec_resize (buf, strlen(cmd));
strncpy((char *)buf, cmd,strlen(cmd));
clib_upf_debug(um->log_fd, "\n\n***** Startup Config *****\n\n%s\n***** End Startup Config *****\n\n",cmd);
......@@ -413,6 +413,7 @@ startup_config_process (vlib_main_t * vm,
}
}
}
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment