Add aaa-12 增加dhcp网桥删除操作
SOL 增加dhcp网桥删除操作 修改人:wuqihy 检视人:yinbin Signed-off-by: wuqihy <wuqihy@cmhi.chinamobile.com>
This commit is contained in:
parent
a03decbc7d
commit
0f3c0bb217
|
@ -39,7 +39,7 @@ COMMON_SRCS = configserver.c \
|
||||||
log_config/log_config_console.c log_config/log_config_init.c log_config/log_config_cm.c log_config/log_config_monitor.c log_config/log_config_remote.c log_config/log_config_file.c \
|
log_config/log_config_console.c log_config/log_config_init.c log_config/log_config_cm.c log_config/log_config_monitor.c log_config/log_config_remote.c log_config/log_config_file.c \
|
||||||
nat_config/natconfig.c \
|
nat_config/natconfig.c \
|
||||||
vlan_config/vlan_config.c \
|
vlan_config/vlan_config.c \
|
||||||
|
dhcp_config/dhcp_client_config.c dhcp_config/dhcp_dhcpd_lease.c dhcp_config/dhcp_host_config.c dhcp_config/dhcp_lib.c dhcp_config/dhcp_relay_config.c dhcp_config/dhcp_shared_network_config.c dhcp_config/dhcp_subnet_config.c\
|
||||||
# MRS Board Source Files
|
# MRS Board Source Files
|
||||||
PLAT_LINUX_SRCS = $(COMMON_SRCS)
|
PLAT_LINUX_SRCS = $(COMMON_SRCS)
|
||||||
PLAT_ARM64_SRCS = $(COMMON_SRCS)
|
PLAT_ARM64_SRCS = $(COMMON_SRCS)
|
||||||
|
|
|
@ -1,5 +1,46 @@
|
||||||
#include "dhcp_lib.h"
|
#include "dhcp_lib.h"
|
||||||
|
|
||||||
|
void dhcp_config_init(void)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
ret = br_event_register(BR_DELETE_EVENT_PRE,del_interface_dhcp_cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
int del_interface_dhcp_cb(BR_EVENT_TYPE event_type, br_event_t event_arg)
|
||||||
|
{
|
||||||
|
ret_code ret = RET_OK;
|
||||||
|
char *segment = get_interface_subnet(event_arg.br_name);
|
||||||
|
if(NULL == segment){
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
char *mask = get_interface_mask(event_arg.br_name);
|
||||||
|
if(NULL == mask){
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
int len = 500;
|
||||||
|
char *cmd = (char *)malloc(len + 1);
|
||||||
|
if(NULL == cmd)
|
||||||
|
{
|
||||||
|
return RET_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(cmd, 0, len + 1);
|
||||||
|
snprintf(cmd, len, "sed -r -i 's/%s //g' /etc/default/isc-dhcp-server", event_arg.br_name);
|
||||||
|
system(cmd);
|
||||||
|
memset(cmd, 0, len + 1);
|
||||||
|
snprintf(cmd, len, "sed -r -i ':a;N;$!ba;s/[ \\t]*subnet[ \\t]+%s[ \\t]+netmask[ \\t]+%s[ \\t]*\\{[a-zA-Z#:; \\t\\n0-9\\.\\,\\-]+\\}/#/g' /etc/dhcp/dhcpd.conf", segment, mask);
|
||||||
|
system(cmd);
|
||||||
|
system("sed -r -i '/#/d' /etc/dhcp/dhcpd.conf");
|
||||||
|
if(segment){
|
||||||
|
free(segment);
|
||||||
|
}
|
||||||
|
if(mask){
|
||||||
|
free(mask);
|
||||||
|
}
|
||||||
|
/*ÔËÐÐÅäÖÃÎļþ*/
|
||||||
|
system("service isc-dhcp-server restart");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
char *getfileall(char *fname)
|
char *getfileall(char *fname)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include "../web_config/auth_recover_config.h"
|
#include "../web_config/auth_recover_config.h"
|
||||||
#include "natconfig.h"
|
#include "natconfig.h"
|
||||||
#include "vlan_config.h"
|
#include "vlan_config.h"
|
||||||
|
#include "dhcp_lib.h"
|
||||||
#define RET_CODE_LEN 16
|
#define RET_CODE_LEN 16
|
||||||
#define RET_MSG_LEN 128
|
#define RET_MSG_LEN 128
|
||||||
|
|
||||||
|
@ -31,7 +31,11 @@
|
||||||
{ \
|
{ \
|
||||||
VLAN_CONFIG_MODULE, \
|
VLAN_CONFIG_MODULE, \
|
||||||
vlan_config_init \
|
vlan_config_init \
|
||||||
} \
|
}, \
|
||||||
|
{ \
|
||||||
|
DHCP_CONFIG_MODULE, \
|
||||||
|
dhcp_config_init \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -217,6 +221,60 @@
|
||||||
vlan_config_proc, \
|
vlan_config_proc, \
|
||||||
vlan_config_get, \
|
vlan_config_get, \
|
||||||
vlan_config_get_all \
|
vlan_config_get_all \
|
||||||
|
},\
|
||||||
|
{\
|
||||||
|
DHCP_HOST_CONFIG, \
|
||||||
|
CONFIG_FROM_WEB, \
|
||||||
|
FALSE, \
|
||||||
|
dhcp_host_config_chk, \
|
||||||
|
dhcp_host_config_proc, \
|
||||||
|
dhcp_host_config_get, \
|
||||||
|
NULL \
|
||||||
|
},\
|
||||||
|
{\
|
||||||
|
DHCP_SUBNET_CONFIG, \
|
||||||
|
CONFIG_FROM_WEB, \
|
||||||
|
FALSE, \
|
||||||
|
dhcp_subnet_config_chk, \
|
||||||
|
dhcp_subnet_config_proc, \
|
||||||
|
dhcp_subnet_config_get, \
|
||||||
|
NULL \
|
||||||
|
},\
|
||||||
|
{\
|
||||||
|
DHCP_RELAY_CONFIG, \
|
||||||
|
CONFIG_FROM_WEB, \
|
||||||
|
FALSE, \
|
||||||
|
dhcp_relay_config_chk, \
|
||||||
|
dhcp_relay_config_proc, \
|
||||||
|
NULL, \
|
||||||
|
NULL \
|
||||||
|
},\
|
||||||
|
{\
|
||||||
|
DHCP_CLIENT_CONFIG, \
|
||||||
|
CONFIG_FROM_WEB, \
|
||||||
|
FALSE, \
|
||||||
|
dhcp_client_config_chk, \
|
||||||
|
dhcp_client_config_proc, \
|
||||||
|
dhcp_client_get, \
|
||||||
|
NULL \
|
||||||
|
},\
|
||||||
|
{\
|
||||||
|
DHCP_DHCPD_LEASE, \
|
||||||
|
CONFIG_FROM_WEB, \
|
||||||
|
FALSE, \
|
||||||
|
dhcp_dhcpd_lease_config_chk, \
|
||||||
|
NULL, \
|
||||||
|
NULL, \
|
||||||
|
dhcp_dhcpd_lease_get_all \
|
||||||
|
},\
|
||||||
|
{\
|
||||||
|
DHCP_SHARED_NETWORK_CONFIG, \
|
||||||
|
CONFIG_FROM_WEB, \
|
||||||
|
FALSE, \
|
||||||
|
dhcp_shared_network_config_chk, \
|
||||||
|
dhcp_shared_network_config_proc, \
|
||||||
|
NULL, \
|
||||||
|
dhcp_shared_network_config_get_all \
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,19 @@
|
||||||
#include "rpc.h"
|
#include "rpc.h"
|
||||||
#include "netconfig.h"
|
#include "netconfig.h"
|
||||||
|
|
||||||
|
#include "dhcp_client_config.h"
|
||||||
|
#include "dhcp_host_config.h"
|
||||||
|
#include "dhcp_relay_config.h"
|
||||||
|
#include "dhcp_shared_network_config.h"
|
||||||
|
#include "dhcp_subnet_config.h"
|
||||||
|
#include "dhcp_dhcpd_lease.h"
|
||||||
|
|
||||||
|
|
||||||
|
void dhcp_config_init(void);
|
||||||
|
|
||||||
|
int del_interface_dhcp_cb(BR_EVENT_TYPE event_type, br_event_t event_arg);
|
||||||
|
|
||||||
|
|
||||||
char *getfileall(char *fname);
|
char *getfileall(char *fname);
|
||||||
|
|
||||||
char *getfilefirstline(char *fname);
|
char *getfilefirstline(char *fname);
|
||||||
|
|
Loading…
Reference in New Issue