mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Fix memory issues on 64bit systems
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
This commit is contained in:
parent
c0bb8e7f24
commit
8fb844f970
6 changed files with 45 additions and 28 deletions
|
|
@ -1852,11 +1852,13 @@ int set_DHCPv4Client_PassthroughDHCPPool(char *refparam, struct dmctx *ctx, void
|
|||
/*#Device.DHCPv4.Client.{i}.SentOptionNumberOfEntries!UCI:network/interface,@i-1/sendopts*/
|
||||
int get_DHCPv4Client_SentOptionNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct dhcp_client_args* dhcp_client_args= (struct dhcp_client_args*)data;
|
||||
char *v = NULL;
|
||||
size_t length;
|
||||
|
||||
if (((struct dhcp_client_args *)data)->dhcp_client_conf != NULL)
|
||||
dmuci_get_value_by_section_string(((struct dhcp_client_args *)data)->dhcp_client_conf, "sendopts", &v);
|
||||
if(dhcp_client_args->dhcp_client_conf != NULL)
|
||||
dmuci_get_value_by_section_string(dhcp_client_args->dhcp_client_conf, "sendopts", &v);
|
||||
|
||||
if (v == NULL) {
|
||||
*value = "0";
|
||||
return 0;
|
||||
|
|
@ -2102,6 +2104,7 @@ int get_DHCPv4ClientReqOption_Tag(char *refparam, struct dmctx *ctx, void *data,
|
|||
int set_DHCPv4ClientReqOption_Tag(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *pch, *spch, *list, *v;
|
||||
size_t length;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -2520,8 +2523,7 @@ int set_DHCPv4RelayForwarding_VendorClassIDMode(char *refparam, struct dmctx *ct
|
|||
int get_DHCPv4RelayForwarding_Chaddr(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char *mac, **macarray, *res = NULL, *tmp = "";
|
||||
size_t length;
|
||||
int i;
|
||||
size_t length, i;
|
||||
|
||||
if (((struct dhcp_client_args *)data)->macclassifier == NULL) {
|
||||
*value = "";
|
||||
|
|
@ -2564,8 +2566,7 @@ int set_DHCPv4RelayForwarding_Chaddr(char *refparam, struct dmctx *ctx, void *da
|
|||
int get_DHCPv4RelayForwarding_ChaddrMask(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char *mac, **macarray, *res = NULL, *tmp = "";
|
||||
size_t length;
|
||||
int i;
|
||||
size_t length, i;
|
||||
|
||||
if (((struct dhcp_client_args *)data)->macclassifier == NULL) {
|
||||
*value= "";
|
||||
|
|
@ -2974,8 +2975,7 @@ int browseDHCPv4ClientSentOptionInst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
struct uci_section *dmmap_sect;
|
||||
struct dhcp_client_option_args dhcp_client_opt_args = {0};
|
||||
char *instance, *instnbr = NULL, *v1, *v2, **sentopts = NULL, **buf = NULL, *tmp, *optionvalue, *v = NULL;
|
||||
size_t length = 0, lgh2;
|
||||
int i, j;
|
||||
size_t length = 0, lgh2, i, j;
|
||||
|
||||
if (dhcp_client_args->dhcp_client_conf != NULL)
|
||||
dmuci_get_value_by_section_string(dhcp_client_args->dhcp_client_conf, "sendopts", &v);
|
||||
|
|
@ -3024,8 +3024,7 @@ int browseDHCPv4ClientReqOptionInst(struct dmctx *dmctx, DMNODE *parent_node, vo
|
|||
struct uci_section *dmmap_sect;
|
||||
struct dhcp_client_option_args dhcp_client_opt_args = {0};
|
||||
char *instance, *instnbr = NULL, *v1, **reqtopts = NULL, *v = NULL;
|
||||
size_t length = 0;
|
||||
int i;
|
||||
size_t length = 0, i, j;
|
||||
|
||||
if (dhcp_client_args->dhcp_client_conf != NULL)
|
||||
dmuci_get_value_by_section_string(dhcp_client_args->dhcp_client_conf, "reqopts", &v);
|
||||
|
|
@ -3060,8 +3059,7 @@ int browseDHCPv4ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
struct dhcp_args *curr_dhcp_args = (struct dhcp_args*)prev_data;
|
||||
struct uci_section *dmmap_sect;
|
||||
char **tagvalue = NULL, *instance, *instnbr = NULL, *optionvalue = NULL, *tmp, *v1, *v2, *v;
|
||||
size_t length;
|
||||
int j;
|
||||
size_t length, j;
|
||||
struct dhcp_client_option_args dhcp_client_opt_args = {0};
|
||||
|
||||
dmuci_get_value_by_section_list(curr_dhcp_args->dhcp_sec, "dhcp_option", &dhcp_options_list);
|
||||
|
|
@ -3111,8 +3109,7 @@ char *get_dhcp_network_from_relay_list(char *net_list)
|
|||
{
|
||||
struct uci_section *s;
|
||||
char **net_list_arr, *v;
|
||||
int i;
|
||||
size_t length;
|
||||
size_t length, i;
|
||||
|
||||
net_list_arr = strsplit(net_list, " ", &length);
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
|
|
|
|||
|
|
@ -372,8 +372,7 @@ int browseDHCPv6ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
struct dhcpv6_args *curr_dhcp_args = (struct dhcpv6_args*)prev_data;
|
||||
struct uci_section *dmmap_sect;
|
||||
char **tagvalue = NULL, *instance, *instnbr = NULL, *optionvalue= NULL, *tmp, *v1, *v2, *v;
|
||||
size_t length;
|
||||
int j;
|
||||
size_t length, j;
|
||||
struct dhcpv6_client_option_args dhcp_client_opt_args = {0};
|
||||
|
||||
dmuci_get_value_by_section_list(curr_dhcp_args->dhcp_sec, "dhcp_option", &dhcp_options_list);
|
||||
|
|
@ -1418,8 +1417,7 @@ int get_DHCPv6ServerPool_SourceAddress(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
struct uci_section *macaddrclassifier;
|
||||
char *mac, **macarray, *res = NULL, *tmp = "";
|
||||
int i;
|
||||
size_t length;
|
||||
size_t length, i;
|
||||
|
||||
macaddrclassifier = get_dhcpv6_classifier("mac", ((struct dhcpv6_args *)data)->interface);
|
||||
if (macaddrclassifier == NULL) {
|
||||
|
|
@ -1463,8 +1461,7 @@ int get_DHCPv6ServerPool_SourceAddressMask(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
struct uci_section *macaddrclassifier;
|
||||
char *mac, **macarray, *res = NULL, *tmp = "";
|
||||
int i;
|
||||
size_t length;
|
||||
size_t length, i;
|
||||
|
||||
macaddrclassifier = get_dhcpv6_classifier("mac", ((struct dhcpv6_args *)data)->interface);
|
||||
if (macaddrclassifier == NULL) {
|
||||
|
|
|
|||
|
|
@ -1201,9 +1201,8 @@ int set_rule_source_port_range_max(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
int set_rule_icmp_type(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
int i;
|
||||
size_t length;
|
||||
char **devices = NULL;
|
||||
size_t length, i;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
|
|||
|
|
@ -691,7 +691,8 @@ int get_radio_operating_channel_bandwidth(char *refparam, struct dmctx *ctx, voi
|
|||
json_object *res;
|
||||
char *wlan_name;
|
||||
dmuci_get_value_by_section_string(((struct wifi_radio_args *)data)->wifi_radio_sec, "bandwidth", value);
|
||||
if ((*value)[0] == '\0') {
|
||||
|
||||
if (value[0] == NULL) {
|
||||
wlan_name = section_name(((struct wifi_radio_args *)data)->wifi_radio_sec);
|
||||
dmubus_call("router.wireless", "status", UBUS_ARGS{{"vif", wlan_name, String}}, 1, &res);
|
||||
DM_ASSERT(res, *value = "");
|
||||
|
|
@ -1695,8 +1696,7 @@ int get_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
int set_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
size_t length;
|
||||
int i;
|
||||
size_t length, i;
|
||||
char **arr;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
|
|||
|
|
@ -594,13 +594,13 @@ char *update_instance_alias(int action, char **last_inst, void *argv[])
|
|||
char *update_instance_without_section(int action, char **last_inst, void *argv[])
|
||||
{
|
||||
char *instance, buf[64] = {0};
|
||||
int instnbr = (int) argv[0];
|
||||
long instnbr = (long) argv[0];
|
||||
|
||||
if (action == INSTANCE_MODE_ALIAS) {
|
||||
snprintf(buf, sizeof(buf), "[cpe-%d]", instnbr);
|
||||
sprintf(buf, "[cpe-%ld]", instnbr);
|
||||
instance = dmstrdup(buf);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "%d", instnbr);
|
||||
sprintf(buf, "%ld", instnbr);
|
||||
instance = dmstrdup(buf);
|
||||
}
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,30 @@
|
|||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE /* for strptime */
|
||||
#include <time.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <glob.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <uci.h>
|
||||
#include <ctype.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
|
||||
#include "dmbbf.h"
|
||||
#include "dmuci.h"
|
||||
#include "dmubus.h"
|
||||
#include "dmcommon.h"
|
||||
|
||||
char *array_notifcation_char[__MAX_notification] = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue