Commit graph

34 commits

Author SHA1 Message Date
Ember
a1946c8fc8 Validate DMRD packet length before enqueuing
The received packet length was stored as unsigned char (max 255) and
used without validating it matches the expected 55-byte DMRD packet
size. Reject packets that don't match the expected length to prevent
stale data reads and silent truncation.
2026-04-05 17:53:52 -07:00
Ember
891a2a87b7 Fix upper bound in length check: 50 → 46 to match buffer geometry
The memcpy writes (length - 4) bytes at offset 8 into a 50-byte buffer,
so the maximum safe length is 46 (8 + 42 = 50), not 50. With length=50
the previous check still allowed a 4-byte stack overflow.
2026-04-04 17:02:53 -07:00
Ember
6dd98bd856 Fix stack buffer overflow in writeRadioPosition and writeTalkerAlias
Both functions copy packet data into 50-byte stack buffers without
validating the length parameter. Add bounds checks to reject packets
that would overflow the buffer or cause unsigned underflow.
2026-04-04 16:49:26 -07:00
Jonathan Naylor
4ff688045f Update the C++ version and other changes. 2025-03-17 14:09:42 +00:00
Jonathan Naylor
fd54e3eb7c Merge branch 'master' into mqtt 2025-03-15 17:23:14 +00:00
Jonathan Naylor
ec5c32b57a Update the C++ code. 2025-03-15 17:03:06 +00:00
Jonathan Naylor
b205134508 Merge branch 'master' into mqtt 2024-02-02 11:35:50 +00:00
Jonathan Naylor
2b81fe225b Re-organise the UDP handling. 2024-02-02 11:35:07 +00:00
Jonathan Naylor
8ca1bb8d72 Add DMR Master logging-in to the JSON status messages. 2023-07-23 14:30:49 +01:00
Daniel Caujolle-Bert
6c36e29f88 Add new remote command:
- hosts: display connected hosts, or NONE if disconnected (surrounded with double quotes).
2022-01-21 08:13:24 +00:00
Daniel Caujolle-Bert
d9a09a9364
Fix network ports datatype (unsigned int -> unsigned short). UDPSocket: fix old bug using m_port instead of m_port[x]. 2021-04-25 07:44:55 +02:00
Jonathan Naylor
daa54d3d32 Don't use default arguments for closing the network connection. 2021-04-09 10:16:52 +01:00
Daniel Caujolle-Bert
86f492745e Do not try to send RPTCL if the connection is already broken. 2021-04-02 06:29:57 +02:00
Daniel Caujolle-Bert
41a49d5785 Implement remote command support.
- Defaut port is 7643 (totally arbitrary)

- Using RemoteCommandDMRG, each network can be enabled or disabled (net1 .. net5, xlx):
    ~ $ RemoteCommandDMRG 7643 disable net2
    M: 2021-03-20 11:48:40.494 Command sent: "disable net2" to port: 7643
    M: 2021-03-20 11:48:40.545 OK

- Using RemoteCommandDMRG, a connection status can be retrieved:
    ~ $ RemoteCommandDMRG 7643 status
    M: 2021-03-20 11:49:13.513 Command sent: "status" to port: 7643
    M: 2021-03-20 11:49:13.563 xlx:conn net1:conn net2:n/a net3:n/a net4:conn net5:n/a

A returned string is expected from the socket connection, this is why I did not reuse the MMDVMHost's RemoteCommand (unless MMDVMHost RemoteControl is modified as well).

The exit value can be used in scripting (also 1 if we didn't get any reply).
2021-03-20 13:03:19 +01:00
Jonathan Naylor
b11a967171 Reformat the latitude and longitude values. 2020-09-16 13:28:11 +01:00
Jonathan Naylor
f4d9895842 More IPv6 upgrades. 2020-09-05 20:49:30 +01:00
Jonathan Naylor
5e3e9f10b9 Merge branch 'IPv6' into SimpleDMR 2020-09-03 11:16:10 +01:00
Jonathan Naylor
83fbcaaf0a Some cleanups. 2020-08-30 14:42:40 +01:00
Jonathan Naylor
8ef67976ab Ensure the correct width of the configuration packet. 2020-08-28 10:58:33 +01:00
Jonathan Naylor
1606c4e644 Move the location to the DMR Gateway from the Host. 2020-08-27 10:37:26 +01:00
Jonathan Naylor
b344248e0a Simplify the Host to DMR Gateway protocol. 2020-08-26 14:20:04 +01:00
SASANO Takayoshi
06ed2e0080 modified for new UDPSocket.cpp 2020-04-07 18:05:12 +09:00
SASANO Takayoshi
eb20786f36 set INADDR_ANY/IN6ADDR_ANY_INIT address string to m_socket
when CUDPSocket::open() is called with m_address (in CUDPSocket) is nothing,
IPv4 socket is created by "0.0.0.0" (INADDR_ANY) address.

This causes a bug that DMRGateway cannot connect to reflector on IPv6.

Avoid this problem, set IP address string to m_socket (in CDMRNetwork) before
calling CUDPSocket::open().

This is a workaround, I think there is better idea.
2019-10-23 20:01:03 +09:00
SASANO Takayoshi
249bae1e7b replace sockaddr_in -> sockaddr_storage to support IPv6 2019-10-23 12:04:06 +09:00
Jonathan Naylor
0c31af146c Pass through the MMDVM's home position to all connected networks. 2018-10-30 07:42:04 +00:00
Jonathan Naylor
afe593d7b5 Add identification of the DMR Gateway to connected networks. 2018-06-04 21:56:10 +01:00
Jonathan Naylor
367116bdf4 Add optional names for each network for use in the log, 2017-08-01 21:51:22 +01:00
g0wfv
fc4d79abe9 Alter MSTNAK responses to differentiate stages of retry 2017-06-08 10:31:08 +01:00
Jonathan Naylor
8bc79767c5 Allow for a startup XLX reflector. 2017-05-30 13:42:30 +01:00
Jonathan Naylor
90f5e17be9 Pass through new GPS and TA data. 2017-05-17 18:58:46 +01:00
Jonathan Naylor
ab0f0d5806 Fix RSSI and BER data. 2017-05-11 20:23:41 +01:00
Jonathan Naylor
80ef1757c0 Fix compiler warnings. 2017-04-28 17:01:53 +01:00
Jonathan Naylor
ee978a6521 Fix bugs and improve logging. 2017-04-27 20:39:46 +01:00
Jonathan Naylor
c04c3e1aef Initial commit. 2017-04-20 20:51:30 +01:00