Add aaa-12 修改dhcp relay
SOL 改relay的set函数 修改人:wuqihy 检视人:yinbin Signed-off-by: wuqihy <wuqihy@cmhi.chinamobile.com>
This commit is contained in:
parent
e0d34f1a17
commit
92bdefd5d5
|
@ -508,7 +508,7 @@ char *wan_if_str(){
|
|||
memset(ifname, 0, sizeof(ifname));
|
||||
//printf("ifname size: %d\n", sizeof(ifname));
|
||||
int wan_count = if_wan_get(ifname, MAX_IF_NUM);
|
||||
char *wanif;
|
||||
char *wanif = (char *)malloc(sizeof(ifname)+wan_count+1);
|
||||
memset(wanif, 0, sizeof(ifname)+wan_count+1);
|
||||
//printf("wan get cnt %d\n", wan_count);
|
||||
int i;
|
||||
|
@ -517,7 +517,7 @@ char *wan_if_str(){
|
|||
strcat(wanif, " ");
|
||||
strcat(wanif, ifname[i]);
|
||||
}
|
||||
free(ifname);
|
||||
//free(ifname);
|
||||
if(!strcmp(wanif, "")){
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -93,8 +93,9 @@ ret_code dhcp_relay_config_proc(uint source, uint config_type,
|
|||
//system("service isc-dhcp-relay restart");
|
||||
system("systemctl restart isc-dhcp-relay.service");
|
||||
dhcp_relay_info_save(servers->valuestring, interfaces->valuestring);*/
|
||||
|
||||
if(!wan_if_str()){
|
||||
|
||||
char *wanIf = wan_if_str();
|
||||
if(!wanIf){
|
||||
ret = RET_INPUTERR;
|
||||
goto INPUT_ERROR;
|
||||
}
|
||||
|
@ -102,8 +103,12 @@ ret_code dhcp_relay_config_proc(uint source, uint config_type,
|
|||
snprintf(cmd, len, "echo 'SERVERS=\"%s\"' >> /etc/default/isc-dhcp-relay", servers->valuestring);
|
||||
system(cmd);
|
||||
memset(cmd, 0, len + 1);
|
||||
snprintf(cmd, len, "echo 'INTERFACES=\"%s%s\"' >> /etc/default/isc-dhcp-relay", interfaces->valuestring, wan_if_str());
|
||||
snprintf(cmd, len, "echo 'INTERFACES=\"%s%s\"' >> /etc/default/isc-dhcp-relay", interfaces->valuestring, wanIf);
|
||||
system(cmd);
|
||||
if(wanIf){
|
||||
free(wanIf);
|
||||
wanIf = NULL;
|
||||
}
|
||||
|
||||
//save relay info
|
||||
memset(cmd, 0, len + 1);
|
||||
|
|
Loading…
Reference in New Issue