Commit 756cfc9b authored by 吴洲洋's avatar 吴洲洋

add nat

parent 7dca8db7
......@@ -379,8 +379,10 @@ startup_config_process (vlib_main_t * vm,
{
//add it to inif config in 20210311
{
#define BUF_LEN 1024
#define IF_UP_IPADDR "set interface state %s up\nset interface ip address %s %s/%d\n\n"
#define BUF_LEN 1024
#define IF_UP_IPADDR "set interface state %s up\nset interface ip address %s %s/%d\n\n"
#define SET_INTER_NAT44 "set interface nat44 in %s out %s output-feature\n\n"
#define SET_NAT44_ADDRESS "nat44 add address %s\n\n"
u8 *buf = NULL;
char cmd[BUF_LEN] = {0};
......@@ -389,12 +391,15 @@ startup_config_process (vlib_main_t * vm,
strcat(if_cmd, IF_UP_IPADDR);
strcat(if_cmd, IF_UP_IPADDR);
strcat(if_cmd, "ip route add 0.0.0.0/0 via %s %s\n\n");
strcat(if_cmd, SET_INTER_NAT44);
strcat(if_cmd, SET_NAT44_ADDRESS);
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);
if_info->if_n6.name, if_info->if_n6.gateway,
if_info->if_n3.name, if_info->if_n6.name,if_info->if_n6.ipaddr);
vec_resize (buf, strlen(cmd));
strncpy((char *)buf, cmd,strlen(cmd));
......
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