Commit graph

37 commits

Author SHA1 Message Date
Amin Ben Ramdhane
bf8737c49e Update the time format according to the standard 2020-03-17 14:11:52 +01:00
Amin Ben Ramdhane
ce8bf4e319 Update the time format according to the standard 2020-03-16 23:29:02 +01:00
Omar Kallel
e92a4d81b2 Improve dmasprintf function: dynamic allocation instead of buffer fix size 2020-03-16 17:02:54 +01:00
Amin Ben Ramdhane
a1f7ce98cf Ticket refs #1254: Improvement validation parameters 2020-03-13 16:28:32 +01:00
Daniel Danzberger
43b4cff541 Don't define _XOPEN_SOURCE when compiling with _GNU_SOURCE
_XOPEN_SOURCE is included by _GNU_SOURCE.
This fixes redefinition errors of _XOPEN_SOURCE when the libc
implementations define it because of _GNU_SOURCE.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-03-09 12:25:13 +01:00
Omar Kallel
fbedd21f07 Ticket refs #1835: Device.Security. object (code style review) 2020-03-04 12:06:11 +01:00
Omar Kallel
5b0bc22622 Ticket Refs #1835: TR-181: Device.Security object 2020-03-03 15:30:08 +01:00
Amin Ben Ramdhane
d80716634a Ticket refs #1254: validation parameters: add the missing objects 2020-02-21 11:47:42 +01:00
Amin Ben Ramdhane
905d78844c Ticket refs #1254: TR-x69: add support for parameter validation 2020-02-20 23:25:49 +01:00
Daniel Danzberger
dd31072c40 dmubus: remove deprectated is_error macro
This fixes undefined reference erros when linking against newer
libjson-c versions.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
2351a47144 dmbbf: don't call undefined functions
The function enabled_notify_check_value_change_param() calls these 2
functions that have no definition or decleration:

- add_list_value_change()
- send_active_value_change()

This commit comments them out.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
fe370c6ae5 dmcommon: avoid memory duplication when fusion dup_list
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
4ebedcf707 tr181: dhcpv4: fixes and improvements
- don't export symbols that are not used ouside of dhcpv4.c
- make read only values const
- remove uneceessary memory allocations and duplications
- avoid "router.network" calls for compatibitliy with generic openwrt builds
- move redundand code to functions
- remove tab indents on empty lines
- avoid opening and parsing DHCP_LEASE_FILE multiple times

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
7779fc6928 dmubus: improve chache handling
- use less memory
- decrease lookup time
- make read only variables const
- remove unused variables / macros

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
588db7e54f dmubus: fixes and improvements
- use libubus instead of fork and exec ubus program
- move redundant code to static functions
- don't export ubus_ctx. It's only used in dmubus.c
- mark static gobals static
- remove unecessary json to blobmsg conversions/allocations when preparing parameters for ubus_invoke
- fix memleaks on not freeing ubus_ctx from ubus_connect
- fix invoking requests on random stack value id when ubus_lookup_id failed
- don't connect/disconnect on every request
- don't reallocate blob_buf on every request

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
ef30a322a0 Fix invalid logic when checking datamodel type
This fixes BBFDM_CWMP values not shown when BBFDM_BOTH is set as bbfdatamodel_type.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
cda2d2a61c tr181: wifi: fix invalid SSID stats
There is not always an "ifname" option in the wifi-iface section.
This commit uses ubus to resolve the right interface for the SSID.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
b135d0b5ae Remove get_stats_from_ifconfig_command function
This function was only used to query interface statistics,
which are now read direclty from sysfs.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
3e903fc731 tr181: ethernet: Fixes and cleanups
- use sysfs instread of ubus and ifconfig command execution for Inteface stats.
  This reduces uneccessary memory and cpu overhead and speeds up the query time for
  IP.Interface queries by a multiple.

- move redundant code to static functions
- fix rx/tx multicast/broadcast stats can never be obtained from ifconfig
- fix invalid stats for unknownprotopackets.
- fix stats not correclty reported when counters exceed 32bit int values.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
219d9b4984 tr181: ip: Fixes and cleanups
- use sysfs instread of ubus and ifconfig command execution for Inteface stats.
  This reduces uneccessary memory and cpu overhead and speeds up the query time for
  IP.Interface queries by a multiple.

- move redundant code to static functions
- fix rx/tx multicast/broadcast stats can never be obtained from ifconfig
- fix invalid stats for unknownprotopackets.
- fix stats not correclty reported when counters exceed 32bit int values.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
8708940709 Read mac address from sysfs instead of ubus
This is much faster

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
7ce4410723 dmuci: fix some const compiler warnings
Read-only values should be marked with const to help the compiler
optimize code. But this would requrire a bigger rewirte of all the code,
hence the original code did not use const at all.

This should be done in the future to ensure good code quality
and performance.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
994897a70d dmcommon.c: use const on read only value
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
345c466875 tr181: USB: Fixes and cleanups
- avoid uneccessary memory allocations
- move {read,write}FileContent functions to usb source file where they are used exclusively and make them static
- fix bad logic in readFileContent
- move redundant code to static functions
- fix get_USBUSBHostsHostDevice_MaxChildren never returning any value
- fix no interface instances being created
- make some functions that are not exported static
- fix segfault on get_USBInterface_Enable when the interface is down
- fix segfault on get_USBInterface_Status when the interface is down.
- fix segfault on missing format character in get_USBInterface_LowerLayers.
- fix segfault and double frees on recrusive browseUSBUSBHostsHostInst() calls.
- reduce overall memory usage
- use const on read-only values
- fix invalid comparision on strstr return value

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
fb12136904 dmuci: fix returning of invalid pointers
This fixes segfaults and pointers with invalid strings for:
 - dmuci_add_section
 - dmuci_set_value_by_section
 - dmuci_set_value

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
033380161d Fix memleak from not freed uci_list_configs pointers
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
95e1f34a7f Fix memleaks from unclosed opendir calls
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
65cacf7f49 Fix memleaks created by calls to strsplit
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
cdf945ac57 Avoid strlen on uninitialized memory
Update fsize by the actual read bytes from fread,
because ftell will always return 4k on sysfs files.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
ddf03e43c7 Fix segfault when /etc/bbfm/[pkg] can't be created
Use unified function 'dmmap_file_path_get' and reuse it in
every function where the segfault occured.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00
Daniel Danzberger
2c118cd2b3 Fix several segfaults when UCI values are not available
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:27 +01:00
Daniel Danzberger
8fb844f970 Fix memory issues on 64bit systems
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:27 +01:00
Jomily K Joseph
c0bb8e7f24 Revert "Layer2 Deployment : Changes done to support VLAN deployments for layer 2"
This reverts commit 1f3e1d8744
2020-02-19 06:04:37 +01:00
jjoseph
1f3e1d8744 Layer2 Deployment : Changes done to support VLAN deployments for layer 2
- Changes done in Bridging.Bridge.X.Port, Bridging.Bridge.X.VLAN Objects
- Changes done in IP.Interface Objects
- Changes done in Ethernet Objects

TODO : Few more deployments needs to be covered. Also to add supoort for
	VLANPort and VLANTermination.
2020-02-18 16:05:29 +05:30
Amin Ben Ramdhane
ff14c27fc3 clean up the source code
- remove unused variables
- fix coding style of most function (Indentation, Tabulation, ..)
- check the source code using cppcheck tool
- change sprintf by snprintf
2020-02-12 19:08:49 +01:00
Omar Kallel
dd91c79319 Ticket refs #1334: TR-181: Device.UPnP. object 2020-02-07 16:36:11 +01:00
Amin Ben Ramdhane
4ab526b9f2 Ticket refs#1598: libbbfdm: plug-in based with support for dynamic loading of libraries + separate libbbfdm into two libraries: libbbf_api (API) and libbbfdm (data model) 2020-01-21 22:43:37 +01:00