Skip to content

Commit 8428c21

Browse files
authored
Merge pull request #2 from jimklimov/bump-libmodbus-3.1.11
Bump `rtu_usb` branch to libmodbus v3.1.11
2 parents 512aba6 + 4ab8d48 commit 8428c21

28 files changed

+499
-306
lines changed

.clabot

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
11
{
22
"contributors": [
3-
"rm5248",
43
"0x34d",
4+
"20162026",
5+
"2128506",
56
"alongl",
67
"arkapkaj",
78
"bobbybelieve",
89
"ccdmuro",
910
"cedricboudinet",
1011
"DavidKorczynski",
1112
"devotip",
13+
"diplfranzhoepfinger",
1214
"embeddedmz",
1315
"fcntlcc",
16+
"fedepell",
17+
"franzhoepfinger",
18+
"franzhollerer",
19+
"ghorwin",
1420
"jbysewski",
1521
"jcarrano",
22+
"jeroendoggen",
1623
"jetforme",
1724
"jiriki86",
1825
"jordanjohnson56",
26+
"kay30kim",
27+
"kyllingstad",
28+
"mek-x",
1929
"merkag",
2030
"mhei",
31+
"msk-repo-0x4d",
2132
"ndunks",
2233
"peternewman",
34+
"philj56",
35+
"raymondbh",
2336
"ringlej",
37+
"rm5248",
38+
"rongli-eaton",
2439
"sebastianpsm",
40+
"SergeyMy",
2541
"sirsoweird",
2642
"taikiakita",
27-
"vvck",
28-
"woodsnake",
2943
"vancepym",
30-
"mek-x"
44+
"vvck",
45+
"woodsnake"
3146
],
3247
"message": "We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient..."
3348
}

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
github: [stephane]
2+
polar: stephane

NEWS

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,35 @@
11
# NEWS
22

3+
## libmodbus 3.1.11 (2024-10-22)
4+
5+
- RTU - Check CRC before filtering on slave ID
6+
- HAVE_NETINET_IN_H as guard around header (closes #765)
7+
- Use default port 502 in documentation.
8+
- Fix float endianness issue introduced in v3.1.8 (49af73d).
9+
Thank you @ghorwin for your excellent work on the subject.
10+
Closes #665, #694, #757, #770.
11+
- Proper display of used CFLAGS.
12+
- Don't build with debug flag by default anymore.
13+
- Check request length in `modbus_reply` when used in `memcpy`.
14+
Thank you Nozomi Networks Labs Advisory for the report.
15+
- Fix insecure data handling. CID 416366: INTEGER_OVERFLOW found with Coverity
16+
Scan.
17+
- Remove useless cast in setsockopt call (closes #721)
18+
- Link against socket and nsl libs when building on SunOS. Thank you @lanurmi.
19+
- Update documentation about tcp-pi requiring 1 KiB of extra memory (closes #715).
20+
Thank you @psychon.
21+
- Documentation improvements by @cedricboudinet and @mhei.
22+
- Revert TCP checks for recovery (closes #711).
23+
- Don't use loop initial declaration (closes #752).
24+
- Fix wrong generated version for double number in win32 (closes #675).
25+
- Don't use gai_strerror if not available.
26+
- Add checks for netinet/ip.h and gai_strerror (#745)
27+
- Log error in read input registers if debug (closes #755).
28+
- Fix errno value on timeout with TCP connect (closes #736, #756).
29+
Thank you @kyllingstad for the issue and @psychon for the fix.
30+
- Free addrinfo struct on getaddrinfo() gerrors.
31+
- Fix doc of modbus_mapping_new_start_address (#615).
32+
333
## libmodbus 3.1.10 (2022-12-07)
434

535
Urgent release to fix a regression.
@@ -388,7 +418,7 @@ RTS flow control.
388418
- Enable RS485 support only when available
389419
- Export modbus_set/get_serial_mode functions on all platforms
390420
- API change for read/write multiple registers function:
391-
- modbus_read_and_write_registers -> modbus_write_and_read_registers
421+
- modbus_read_and_write_registers -> modbus_write_and_read_registers
392422
The function name was confusing because the write operation is performed
393423
before the read. Take care to swap the arguments in the migration process.
394424
- Documentation of modbus*write_and_read_registers, modbus_mapping_new/free,
@@ -411,13 +441,13 @@ RTS flow control.
411441
modbus_receive_confirmation)
412442
- Fix flush function of TCP backend on Windows
413443
- API changes for server/slave:
414-
- modbus_receive doesn't take socket/fd argument anymore
415-
- new function modbus_set_socket to set socket/fd
444+
- modbus_receive doesn't take socket/fd argument anymore
445+
- new function modbus_set_socket to set socket/fd
416446
- API changes for timeout functions:
417-
- modbus_get_timeout_begin -> modbus_get_response_timeout
418-
- modbus_set_timeout_begin -> modbus_set_response_timeout
419-
- modbus_get_timeout_end -> modbus_get_byte_timeout
420-
- modbus_set_timeout_end -> modbus_set_byte_timeout
447+
- modbus_get_timeout_begin -> modbus_get_response_timeout
448+
- modbus_set_timeout_begin -> modbus_set_response_timeout
449+
- modbus_get_timeout_end -> modbus_get_byte_timeout
450+
- modbus_set_timeout_end -> modbus_set_byte_timeout
421451
- Fix longstanding limitation of server to wait forever
422452
- New functions modbus_set/get_serial_mode by Manfred Gruber and Stéphane
423453
Raimbault for RS485 communications
@@ -434,9 +464,9 @@ RTS flow control.
434464
modbus_reply_exception()
435465
- New function modbus_get_header_length(modbus_t \*ctx)
436466
- New functions to manipulate data:
437-
- MODBUS_GET_INT32_FROM_INT16
438-
- MODBUS_GET_INT16_FROM_INT8
439-
- MODBUS_SET_INT16_TO_INT8
467+
- MODBUS_GET_INT32_FROM_INT16
468+
- MODBUS_GET_INT16_FROM_INT8
469+
- MODBUS_SET_INT16_TO_INT8
440470
- Fix GH-2. Read/write were swapped in \_FC_READ_AND_WRITE_REGISTERS
441471
- Install an ignore handler for SIGPIPE on \*BSD
442472
Original patch by Jason Oster.
@@ -506,8 +536,7 @@ RTS flow control.
506536

507537
Other changes:
508538

509-
- The code is now published and developed on
510-
<http://github.com/stephane/libmodbus>
539+
- The code is now published and developed on <http://github.com/stephane/libmodbus>
511540
- Waf support has been removed
512541

513542
## libmodbus 2.0.3 (2009-03-22)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# A groovy modbus library
22

33
![Build Status](https://github.com/stephane/libmodbus/actions/workflows/build.yml/badge.svg)
4+
[![Coverity Scan Build Status](https://scan.coverity.com/projects/8058/badge.svg)](https://scan.coverity.com/projects/libmodbus)
45

56
## Overview
67

configure.ac

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#
1414
m4_define([libmodbus_version_major], [3])
1515
m4_define([libmodbus_version_minor], [1])
16-
m4_define([libmodbus_version_micro], [10])
16+
m4_define([libmodbus_version_micro], [11])
1717

1818
m4_define([libmodbus_release_status],
1919
[m4_if(m4_eval(libmodbus_version_minor % 2), [1], [snapshot], [release])])
@@ -29,7 +29,7 @@ AC_INIT([libmodbus],
2929
[http://libmodbus.org/])
3030
AC_CONFIG_SRCDIR([src/modbus.c])
3131
AC_CONFIG_AUX_DIR([build-aux])
32-
AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects])
32+
AM_INIT_AUTOMAKE([check-news foreign 1.11 silent-rules tar-pax subdir-objects])
3333
AC_PROG_CC
3434
AC_USE_SYSTEM_EXTENSIONS
3535
AC_SYS_LARGEFILE
@@ -59,6 +59,7 @@ AC_CANONICAL_HOST
5959
os_win32="false"
6060
os_cygwin="false"
6161
os_qnx="false"
62+
os_sunos="false"
6263
case "${host_os}" in
6364
*mingw32*)
6465
os_win32="true"
@@ -68,6 +69,9 @@ case "${host_os}" in
6869
;;
6970
*cygwin*)
7071
os_cygwin="true"
72+
;;
73+
*solaris*)
74+
os_sunos="true"
7175
;;
7276
esac
7377
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "true")
@@ -85,6 +89,7 @@ AC_CHECK_HEADERS([ \
8589
linux/serial.h \
8690
netdb.h \
8791
netinet/in.h \
92+
netinet/ip.h \
8893
netinet/tcp.h \
8994
sys/ioctl.h \
9095
sys/params.h \
@@ -104,7 +109,7 @@ AC_CHECK_DECLS([__CYGWIN__])
104109
AC_SEARCH_LIBS(accept, network socket)
105110

106111
# Checks for library functions.
107-
AC_CHECK_FUNCS([accept4 getaddrinfo gettimeofday inet_pton inet_ntop select socket strerror strlcpy])
112+
AC_CHECK_FUNCS([accept4 gai_strerror getaddrinfo gettimeofday inet_pton inet_ntop select socket strerror strlcpy])
108113

109114
# Required for MinGW with GCC v4.8.1 on Win7
110115
AC_DEFINE(WINVER, 0x0501, _)
@@ -132,19 +137,23 @@ if test "$os_cygwin" = "false"; then
132137
fi
133138
fi
134139

140+
if test "$os_sunos" = "true"; then
141+
LIBS="$LIBS -lnsl -lsocket"
142+
AC_SUBST(LIBS)
143+
fi
144+
135145
# Check for RS485 support (Linux kernel version 2.6.28+)
136146
AC_CHECK_DECLS([TIOCSRS485], [], [], [[#include <sys/ioctl.h>]])
137147
# Check for RTS flags
138148
AC_CHECK_DECLS([TIOCM_RTS], [], [], [[#include <sys/ioctl.h>]])
139149

140-
# Wtype-limits is not supported by gcc 4.2 (default on recent Mac OS X)
141-
my_CFLAGS="-Wall \
150+
WARNING_CFLAGS="-Wall \
142151
-Wmissing-declarations -Wmissing-prototypes \
143152
-Wnested-externs -Wpointer-arith \
144-
-Wpointer-arith -Wsign-compare -Wchar-subscripts \
153+
-Wsign-compare -Wchar-subscripts \
145154
-Wstrict-prototypes -Wshadow \
146155
-Wformat-security"
147-
AC_SUBST([my_CFLAGS])
156+
AC_SUBST([WARNING_CFLAGS])
148157

149158
# Check for libusb-1.0
150159
AC_ARG_WITH([libusb],
@@ -198,18 +207,32 @@ AC_CONFIG_FILES([
198207
libmodbus.pc
199208
])
200209

210+
AC_ARG_ENABLE([debug],
211+
[AS_HELP_STRING([--enable-debug],
212+
[Enable debug symbols (default is no)])],
213+
[enable_debug=$enableval],
214+
[enable_debug=no])
215+
216+
AS_IF([test "x$enable_debug" = "xyes"], [
217+
CFLAGS="-g -O0"
218+
CXXFLAGS="-g -O0"
219+
], [
220+
CFLAGS="-O2"
221+
CXXFLAGS="-O2"
222+
])
223+
201224
AC_OUTPUT
202225
AC_MSG_RESULT([
203226
$PACKAGE $VERSION
204-
===============
227+
================
205228
206229
prefix: ${prefix}
207230
sysconfdir: ${sysconfdir}
208231
libdir: ${libdir}
209232
includedir: ${includedir}
210233
211234
compiler: ${CC}
212-
cflags: ${CFLAGS}
235+
cflags: ${CFLAGS} ${WARNING_CFLAGS}
213236
ldflags: ${LDFLAGS}
214237
215238
build shared lib: ${enable_shared}

docs/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ communications over TCP IPv4 and IPv6 networks. It does not require a checksum
107107
calculation as lower layer takes care of the same.
108108

109109
Contrary to the TCP IPv4 only backend, the TCP PI backend offers hostname
110-
resolution but it consumes about 1 kB of additional memory.
110+
resolution.
111111

112112
Create a Modbus TCP PI context, you should use [modbus_new_tcp_pi](modbus_new_tcp_pi.md).
113113

@@ -157,6 +157,7 @@ To write and read data in a single operation:
157157
To send and receive low-level requests:
158158

159159
- [modbus_send_raw_request](modbus_send_raw_request.md)
160+
- [modbus_send_raw_request_tid](modbus_send_raw_request_tid.md)
160161
- [modbus_receive_confirmation](modbus_receive_confirmation.md)
161162

162163
To reply to an exception:

docs/modbus_mapping_new_start_address.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ The newly created `mb_mapping` will have the following arrays:
3333

3434
- `tab_bits` set to NULL
3535
- `tab_input_bits` set to NULL
36-
- `tab_input_registers` allocated to store 10 registers (`uint16_t`)
37-
- `tab_registers` set to NULL.
36+
- `tab_registers` allocated to store 10 registers (`uint16_t`)
37+
- `tab_input_registers` set to NULL
3838

3939
The clients can read the first register by using the address 340 in its request.
4040
On the server side, you should use the first index of the array to set the value

docs/modbus_new_tcp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ defined below.
4141
```c
4242
modbus_t *ctx;
4343
44-
ctx = modbus_new_tcp("127.0.0.1", 1502);
44+
ctx = modbus_new_tcp("127.0.0.1", 502);
4545
if (ctx == NULL) {
4646
fprintf(stderr, "Unable to allocate libmodbus context\n");
4747
return -1;

docs/modbus_new_tcp_pi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ defined below.
4242
```c
4343
modbus_t *ctx;
4444
45-
ctx = modbus_new_tcp_pi("::1", "1502");
45+
ctx = modbus_new_tcp_pi("::1", "502");
4646
if (ctx == NULL) {
4747
fprintf(stderr, "Unable to allocate libmodbus context\n");
4848
return -1;

docs/modbus_read_registers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ uint16_t tab_reg[64];
3838
int rc;
3939
int i;
4040
41-
ctx = modbus_new_tcp("127.0.0.1", 1502);
41+
ctx = modbus_new_tcp("127.0.0.1", 502);
4242
if (modbus_connect(ctx) == -1) {
4343
fprintf(stderr, "Connection failed: %s\n", modbus_strerror(errno));
4444
modbus_free(ctx);

0 commit comments

Comments
 (0)