Commit graph

102 commits

Author SHA1 Message Date
Omar Kallel
a25b8584cb Fix bugs: Device.WiFi.Radio 2020-03-19 09:45:26 +01:00
Amin Ben Ramdhane
e3777371b1 WiFi: update parameters with new ubus objects 2020-03-18 22:47:41 +01:00
Omar Kallel
a1ceee7441 Fix returned value format of the parameter Device.DynamicDNS.SupportedServices 2020-03-18 17:34:39 +01:00
Amin Ben Ramdhane
37992a5bc9 Fix the size of ProtocolsVersion 2020-03-17 23:50:39 +01:00
Amin Ben Ramdhane
2997e9781b Update the object definition according to the code generation 2020-03-17 17:20:30 +01:00
Amin Ben Ramdhane
389ae8cdb7 add get value of Device.IP.Interface.{i}.IPv4Address.{i}.Staus parameter 2020-03-17 16:20:59 +01:00
Daniel Danzberger
ff759d2cca tr181: Add OS specific implementations
When code is build with --enable-generic-openwrt,
the tr181 implementations from dmtree/tr181/.*-openwrt.c are used.
Otherwise for IOPSYS-WRT, dmtree/tr181/*-iopsyswrt.c sources are used.

Note that all functions that have OS specific handlers, are prefixed
with 'os__' and are implemented in their OS specific file.

Functions that are only available in IOPSYS-WRT are prefixed with
'os_iopsys_*'.

More OpenWrt OS impelementations will follow in future commits.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-03-17 12:54:26 +01:00
Amin Ben Ramdhane
ce8bf4e319 Update the time format according to the standard 2020-03-16 23:29:02 +01:00
Amin Ben Ramdhane
65f38dccb1 DeviceInfo: Update parameters according to new ubus format 2020-03-16 18:05:17 +01:00
Amin Ben Ramdhane
faf175823b ManagementServer: fix some issues according to the standard
- Fix the value of Device.ManagementServer.PeriodicInformTime parameter
2020-03-16 17:59:59 +01:00
Amin Ben Ramdhane
0205794276 PTM: fix some issues according to the standard
- Device.PTM.Link.{i}.Enable : add set value function
 - Device.PTM.Link.{i}.Status : add get value function
 - Fix the value of some parameters
2020-03-16 17:58:33 +01:00
Amin Ben Ramdhane
0b6a9b2f12 ATM: fix some issues according to the standard
- Device.ATM.Link.{i}.Enable : add set value function
 - Device.ATM.Link.{i}.Status : add get value function
 - Fix the value of some parameters
2020-03-16 17:57:14 +01:00
Amin Ben Ramdhane
198c207e6e VoiceService: fix some issues according to the standard
- VoiceService.{i}.VoiceProfile.{i}.Name : add set value
 - Fix the value of some parameters
2020-03-16 17:50:55 +01:00
Amin Ben Ramdhane
a1f7ce98cf Ticket refs #1254: Improvement validation parameters 2020-03-13 16:28:32 +01:00
Jeff Lyons
1f9c6b08d3 add default response to get_value_security_mode to prevent SEGV 2020-03-13 08:19:16 +00:00
Amin Ben Ramdhane
488066671c tr104,tr157: Remove unused functions 2020-03-10 23:43:37 +01:00
Amin Ben Ramdhane
323b40d8aa Only export symbols to the library that belong to the API interface (complement: tr104, tr143 and tr157) 2020-03-10 23:32:03 +01:00
Amin Ben Ramdhane
69fc84cc37 Remove static definitions of functions used by other packages
These functions are called in icwmp package.
2020-03-10 22:25:48 +01:00
Daniel Danzberger
26ec85f20e Fix warnings when neither mbedtls nor openssl is build
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-03-10 17:44:23 +01:00
Daniel Danzberger
521e38a853 Fix snprintf destination buffer sizes
Fixes snprintf truncated output compiler warnings.

Example:
--
../dmentrylibrary.c:31:38: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
   31 |     snprintf(buf, sizeof(buf), "%s/%s", folder_path, entry->d_name);
      |                                      ^
../dmentrylibrary.c:31:5: note: ‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256
   31 |     snprintf(buf, sizeof(buf), "%s/%s", folder_path, entry->d_name);
--

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-03-10 14:34:08 +01:00
Daniel Danzberger
a377f7dfd2 tr181: Remove unused functions
This fixes 'defined but not used' compiler warnings

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-03-10 13:36:37 +01:00
Daniel Danzberger
0460307fb4 Only export symbols to the library that belong to the API interface
This commit makes all symbols that are not part of the API Interface,
or used only in the object files where they are defined, static.

Causing the following benefits:
 - The compiler can resolve functions for better performance
 - The library size is decreased

NOTE: Spec file generators need to be adjusted for newer spec's to not do the same mistakes again

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-03-09 21:23:57 +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
e15bb5d2c9 Update DeviceInfo.ProcessStatus.Process. object 2020-03-02 19:31:26 +01:00
Amin Ben Ramdhane
862c54780e Update WiFi object with new ubus calls: wifi, wifi.radio, wifi.ap 2020-03-02 19:28:07 +01:00
Amin Ben Ramdhane
be7204e16e Update json file + upnp: add mapping parameters 2020-02-21 18:49:28 +01:00
Amin Ben Ramdhane
29b85e3edd Add a comment for unsupported parameters 2020-02-21 18:48:27 +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
Amin Ben Ramdhane
3848bac3aa WiFi Object: use new wifi.radio and wifi.ap ubus objects
- read WiFi.Radio and WiFi.SSID from iopsys wifi.radio and wifi.ap ubus objects instead of reading them from sysfs or ifconfig
2020-02-20 10:13:10 +01:00
Daniel Danzberger
1ea3b384d6 tr181: dynamicdns: fix invalid call to snprintf
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
84f3354f5c tr181: dhcpv4: Use uint64_t for lease timestamp
The timestamp written by dnsmasq in the dhcp.leases file has 64 bit.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
c0729c7e2d tr181: dhcpv4: fix invalid bit shift when calculating netmask
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
eee74363db tr181: fix segfault on random stack value
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
bae3028d48 tr181: dhcpv4: fix segfault on interface_get_ipv4
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
ff77bdaebc tr181: wifi: remove invalid Radio statistics
There are no radio device (phy) statistic counters in linux.
To implement this, it would be necessary to collect stats from all
wirless interfaces on this phy.
Maybe this can be implemented in the future.

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
a3f395926f tr181: ppp: read stats from sysfs instead of ubus
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
405a55318d tr181: wifi: read stats from sysfs instead of ubus
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
ba1ab53f9f tr181: bridging: read statistics from sysfs
NOTE:
Current ifname resolution for the bridge port isn't working.
Hence Ports stats are not getting set.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:53:48 +01:00
Daniel Danzberger
2a34538a94 tr181: usb: read usb net stats 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
d744cc4832 tr181: bridge: Fix use of uninitalized meomory
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
1cec0190fd tr181: fix return of uninitalized pointer
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
258331fdd5 Fix memleaks from not freed regcomp allocations
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2020-02-19 11:51:28 +01:00