mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-03-14 21:20:28 +01:00
DHCPv4: fix some issues under DHCPv4.Server.Pool. object and enhance the code
- Fix get/set of LeaseTime, StaticAddressNumberOfEntries parameters
- Fix an issue in add object of DHCPv4.Server.Pool.{i}. object
- enhance get/set of some parameters: Enable, Status, SubnetMask, DomainName, IPRouters. so get the value from data instead of the mapping for all the sections and get the corresponding section based on its section name
This commit is contained in:
parent
e33a424611
commit
026b527588
3 changed files with 324 additions and 477 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -322,57 +322,6 @@ int dmcmd_read(int pipe, char *buffer, int size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int ipcalc(char *ip_str, char *mask_str, char *start_str, char *end_str, char *ipstart_str, char *ipend_str)
|
||||
{
|
||||
struct in_addr ip, mask, ups, upe;
|
||||
int start, end;
|
||||
|
||||
inet_aton(ip_str, &ip);
|
||||
inet_aton(mask_str, &mask);
|
||||
|
||||
start = atoi(start_str);
|
||||
|
||||
ups.s_addr = htonl(ntohl(ip.s_addr & mask.s_addr) + start);
|
||||
strcpy(ipstart_str, inet_ntoa(ups));
|
||||
|
||||
if (end_str) {
|
||||
end = atoi(end_str);
|
||||
upe.s_addr = htonl(ntohl(ups.s_addr) + end - 1);
|
||||
strcpy(ipend_str, inet_ntoa(upe));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ipcalc_rev_start(char *ip_str, char *mask_str, char *ipstart_str, char *start_str)
|
||||
{
|
||||
struct in_addr ip, mask, ups;
|
||||
int start;
|
||||
|
||||
inet_aton(ip_str, &ip);
|
||||
inet_aton(mask_str, &mask);
|
||||
inet_aton(ipstart_str, &ups);
|
||||
|
||||
start = ntohl(ups.s_addr) - ntohl(ip.s_addr & mask.s_addr);
|
||||
sprintf(start_str, "%d", start);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ipcalc_rev_end(char *ip_str, char *mask_str, char *start_str, char *ipend_str, char *end_str)
|
||||
{
|
||||
struct in_addr ip;
|
||||
struct in_addr mask;
|
||||
struct in_addr upe;
|
||||
int end;
|
||||
|
||||
inet_aton(ip_str, &ip);
|
||||
inet_aton(mask_str, &mask);
|
||||
inet_aton(ipend_str, &upe);
|
||||
|
||||
end = ntohl(upe.s_addr) - ntohl(ip.s_addr & mask.s_addr) - atoi(start_str);
|
||||
sprintf(end_str, "%d", end);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int network_get_ipaddr(char **value, char *iface)
|
||||
{
|
||||
json_object *res, *jobj;
|
||||
|
|
|
|||
|
|
@ -257,9 +257,6 @@ int dmcmd(char *cmd, int n, ...);
|
|||
int dmcmd_read(int pipe, char *buffer, int size);
|
||||
void dmcmd_read_alloc(int pipe, char **value);
|
||||
int dmcmd_no_wait(char *cmd, int n, ...);
|
||||
int ipcalc(char *ip_str, char *mask_str, char *start_str, char *end_str, char *ipstart_str, char *ipend_str);
|
||||
int ipcalc_rev_start(char *ip_str, char *mask_str, char *ipstart_str, char *start_str);
|
||||
int ipcalc_rev_end(char *ip_str, char *mask_str, char *start_str, char *ipend_str, char *end_str);
|
||||
int network_get_ipaddr(char **value, char *iface);
|
||||
void update_section_list(char *config, char *section, char *option, int number, char *filter, char *option1, char *val1, char *option2, char *val2);
|
||||
int wan_remove_dev_interface(struct uci_section *interface_setion, char *dev);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue