Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
7a67239
Driver for UPS MUST EP2000Pro
DarkMike-ru Dec 20, 2025
b056324
Add words to nut.dict for pass spellcheck
DarkMike-ru Dec 20, 2025
1e927cf
Fixed error handling when calling shutdown.return
DarkMike-ru Dec 20, 2025
832d3d9
Correct format for signed datatypes
DarkMike-ru Dec 21, 2025
1cb20d7
Correct documentation formating
DarkMike-ru Dec 21, 2025
d1020d3
Merge branch 'master' into must_ep2000
DarkMike-ru Dec 22, 2025
4eba1da
Merge branch 'master' into must_ep2000
jimklimov Dec 22, 2025
aebe3d1
docs/man/must_ep2000pro.txt: rephrase for better English [#3228]
jimklimov Dec 22, 2025
6554202
NEWS.adoc: update for must_ep2000pro driver [#3228]
jimklimov Dec 22, 2025
c7189cd
Merge pull request #3228 from DarkMike-ru/must_ep2000
jimklimov Dec 23, 2025
2a9c5fe
docs/man/must_ep2000pro.txt: carry over a comment from PR description…
jimklimov Dec 23, 2025
fe3a9ae
Makefile.am: install-win-bundle-thirdparty: typo fix (broken DLL deli…
jimklimov Dec 23, 2025
043dd50
common/common.c: getfullpath(): rephrase debug log entries [#3207]
jimklimov Dec 24, 2025
05cf80c
common/common.c: getfullpath(): fix infinite loop [#3207]
jimklimov Dec 24, 2025
604e645
clients/upsclient.c, common/common.c, etc: fix inet_ntopAI() and inet…
jimklimov Dec 24, 2025
97359e3
scripts/Windows/wininit.c: add "nut.exe status" and debug-ability of …
jimklimov Dec 24, 2025
35c68a3
Makefile.am: install-win-bundle-thirdparty: do not install already-pr…
jimklimov Dec 26, 2025
41a09d6
common/common.c: refactor getfullpath() and getprocname() WIN32 error…
jimklimov Dec 26, 2025
3c5da1d
scripts/Windows/wininit.c, NEWS.adoc: pepper with debug messages, esp…
jimklimov Dec 26, 2025
3076907
scripts/Windows/wininit.c, NEWS.adoc, docs/man/nut.exe.txt: add "nut.…
jimklimov Dec 26, 2025
8cfe7a0
docs/man/nut.exe.txt: add hints about NUT daemon startup troubleshoot…
jimklimov Dec 26, 2025
a49ad5e
server/upsd.c: mainloop(): log FDs watched in WIN32 and POSIX builds …
jimklimov Dec 26, 2025
bec68f2
server/upsd.c: mainloop(): throttle-sleep if failed a cycle in WIN32 …
jimklimov Dec 26, 2025
1f313cd
server/upsd.c: setuptcp() WIN32: associate with event loop only if so…
jimklimov Dec 26, 2025
38fd602
Merge pull request #3235 from jimklimov/issue-3207
jimklimov Dec 27, 2025
caccd90
include/common.h: use safer definitions of TYPE_FD* related macros fo…
jimklimov Dec 28, 2025
ae82ca1
server/upsd.c: listen_add(): be sure a new (invalid) server->Event is…
jimklimov Dec 28, 2025
97c3af5
server/upsd.c: mainloop(): log also FDs we are polling [#3207]
jimklimov Dec 28, 2025
e21bfc5
clients/nutclient.{h,cpp}: use NUT-defined default PORT value if poss…
jimklimov Dec 28, 2025
36cc3e3
Rename autoconf variable PORT to NUT_PORT [#3238]
jimklimov Dec 28, 2025
ea3dc5c
server/upsd.c, include/common.h: mainloop(): fix WIN32 debug printout…
jimklimov Dec 29, 2025
48c8567
server/upsd.c: mainloop(): revise honouring maxconn (and log about it…
jimklimov Dec 29, 2025
73bca00
server/upsd.c: server_load(): revise tried/succeeded logging [#3207]
jimklimov Dec 29, 2025
e3fc6ae
server/upsd.c: server_load(): log ANY address binding like we do for …
jimklimov Dec 29, 2025
5ab544c
server/upsd.c: main(), poll_reload(): revise WIN32 MAXIMUM_WAIT_OBJEC…
jimklimov Dec 29, 2025
f1f626b
server/upsd.c: setuptcp(): error-check WIN32 event creation and selec…
jimklimov Dec 29, 2025
af5a273
server/upsd.c: setuptcp(): debug-log the FD occupied by new listener …
jimklimov Dec 29, 2025
572c920
server/upsd.c, NEWS.adoc: setuptcp(): copy over server->Event (WIN32)…
jimklimov Dec 29, 2025
01cdfe7
upsd, nut-scanner, libs, NEWS.adoc: only process WSAStartup() once [#…
jimklimov Dec 29, 2025
749989f
server/upsd.c: mainloop(): track also nfds_considered (e.g. discarded…
jimklimov Dec 29, 2025
07820f0
include/common.h: fix fallback WIN32 definition of INVALID_SOCKET to …
jimklimov Dec 29, 2025
c198f2d
server/upsd.c: mainloop(): poll newly connected UPS right away, not i…
jimklimov Dec 29, 2025
3ce1065
server/upsd.c: mainloop(): log DRIVER entries as such (not UPS) for c…
jimklimov Dec 29, 2025
c76c7a7
scripts/Windows/wininit.c: debug fault of WaitForMultipleObjects() an…
jimklimov Dec 29, 2025
d3a9912
scripts/Windows/wininit.c: track also upsdrvctl_pid and all daemon ha…
jimklimov Dec 29, 2025
e795bac
scripts/Windows/wininit.c: SvcInstall(): try to set a nice service de…
jimklimov Dec 29, 2025
60e1600
scripts/Windows/wininit.c, docs/man/nut.exe.txt, NEWS.adoc: try to st…
jimklimov Dec 29, 2025
880afa3
tests/NIT/nit.sh: add tests for `upsc -j` JSON outputs [#3178]
jimklimov Dec 29, 2025
c44fbc2
tests/NIT/Makefile.am, tests/NIT/nit.sh: pass/guess {,TOP_}{BUILD,SRC…
jimklimov Dec 30, 2025
8f617dd
tests/NIT/Makefile.am, tests/NIT/nit.sh: consider EXEEXT (e.g. with N…
jimklimov Dec 30, 2025
207bb0b
server/upsd.c: fix botched indentations [#3237]
jimklimov Dec 30, 2025
c5d8c2a
server/upsd.c: fix WIN32 logging of server->Event and ups->sock_fd as…
jimklimov Dec 30, 2025
79963dd
Merge pull request #3239 from jimklimov/issue-3178
jimklimov Dec 31, 2025
af645d2
Merge pull request #3238 from jimklimov/NUT_PORT
jimklimov Dec 31, 2025
168a395
Merge pull request #3237 from jimklimov/issue-3207
jimklimov Dec 31, 2025
3a5802b
Merge remote-tracking branch 'upstream/master' into FTY as of 20251231
jimklimov Dec 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1623,29 +1623,34 @@ install-win-bundle-thirdparty:
if test -n "$$ARCH" ; then export ARCH ; fi ; \
DESTDIR='$(DESTDIR)' ; export DESTDIR ; \
( cd '$(DESTDIR)' || exit ; \
GREP=$(GREP)' EGREP='$(EGREP)' \
GREP='$(GREP)' EGREP='$(EGREP)' \
DESTDIR="" '$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
BD="`basename \"$$D\"`" ; \
if test -e './$(bindir)/'"$$BD" && diff './$(bindir)/'"$$BD" "$$D" 2>/dev/null >/dev/null ; then \
echo " DLL->bin $$D : skip (already installed there)" 2>&1 ; \
continue ; \
fi ; \
echo " DLL->bin $$D" 2>&1 ; \
cp -pf "$$D" './$(bindir)/' ; \
done ; \
) || exit ; \
( if test x"$(bindir)" = x"$(sbindir)" ; then exit 0 ; fi ; \
cd '$(DESTDIR)/$(sbindir)' || exit ; \
GREP=$(GREP)' EGREP='$(EGREP)' \
GREP='$(GREP)' EGREP='$(EGREP)' \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->sbin $$D" 2>&1 ; \
echo " DLL->sbin $$D (symlink from bindir)" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \
done ; \
) || exit ; \
( if test x"$(driverexecdir)" = x"$(bindir)" ; then exit 0 ; fi ; \
if test x"$(driverexecdir)" = x"$(sbindir)" ; then exit 0 ; fi ; \
cd '$(DESTDIR)/$(driverexecdir)' || exit ; \
GREP=$(GREP)' EGREP='$(EGREP)' \
GREP='$(GREP)' EGREP='$(EGREP)' \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->drv $$D" 2>&1 ; \
echo " DLL->drv $$D (symlink from bindir)" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \
done ; \
) || exit ; \
Expand All @@ -1654,10 +1659,10 @@ install-win-bundle-thirdparty:
if test x"$(cgiexecdir)" = x"$(sbindir)" ; then exit 0 ; fi ; \
if test x"$(driverexecdir)" = x"$(cgiexecdir)" ; then exit 0 ; fi ; \
cd '$(DESTDIR)/$(cgiexecdir)' || exit ; \
GREP=$(GREP)' EGREP='$(EGREP)' \
GREP='$(GREP)' EGREP='$(EGREP)' \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->cgi $$D" 2>&1 ; \
echo " DLL->cgi $$D (symlink from bindir)" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \
done ; \
) || exit ; \
Expand All @@ -1666,10 +1671,10 @@ install-win-bundle-thirdparty:
if test x"$(libexecdir)" = x"$(driverexecdir)" ; then exit 0 ; fi ; \
if test x"$(libexecdir)" = x"$(cgiexecdir)" ; then exit 0 ; fi ; \
cd '$(DESTDIR)/$(libexecdir)' || exit ; \
GREP=$(GREP)' EGREP='$(EGREP)' \
GREP='$(GREP)' EGREP='$(EGREP)' \
'$(abs_top_srcdir)/scripts/Windows/dllldd.sh' dllldddir . \
| while read D ; do \
echo " DLL->libexec $$D" 2>&1 ; \
echo " DLL->libexec $$D (symlink from bindir)" 2>&1 ; \
ln -f '$(DESTDIR)/$(bindir)'/"`basename \"$$D\"`" ./ ; \
done ; \
) || exit
Expand Down
22 changes: 22 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ https://github.com/networkupstools/nut/milestone/12
* Revised detection of (relative) paths to program and configuration files
near the currently running program in NUT for Windows builds. [issues #3207,
#3063, #3065, #3219]
* Fixed thread-safety of IP address printout in `libupsclient` method
`upscli_tryconnect()` (practical bug seen in `nut-scanner` parallel scans).
[issue #3234]

- `asem`, `bestfortress`, `bestuferrups`, `bicker_ser`, `everups`, `metasys`,
`masterguard`, `mge-utalk`, `oneac`, `phoenixcontact_modbus`, `pijuice`,
Expand All @@ -98,6 +101,10 @@ https://github.com/networkupstools/nut/milestone/12
- Introduced a new NUT driver named `meanwell_ntu` which provides support for
the Mean Well NTU series hybrid inverter and UPS units. [PR #3206]

- Introduced a new NUT driver named `must_ep2000pro` which provides support
for the MUST EP2000Pro compatible, line-interactive UPS models which talk
serial-protocol modbus protocol. [PR #3228]

- `nhs_ser` driver updates:
* Driver source code includes a table to map baud rates (defined by the OS
as C macros) to numbers and strings more useful to the driver program.
Expand Down Expand Up @@ -355,6 +362,21 @@ several `FSD` notifications into one executed action. [PR #3097]
system conforming to FHS-3.0 standard where that location is absent or
is a symlink, while `/run` exists and is a true directory. [#3099]

- Augmented `nut.exe` launcher with `status` and `restart` actions, and
general ability to debug-log the activities during service management
operations. (Re-)registration of the "Network UPS Tools" service should
now populate a nice description of it. The `-U` (uninstall) action should
now also try to stop the service first. [PR #3235]

- Fixed `LISTEN *` handling for `upsd.exe` in NUT for Windows builds. [PR #3237]

- Revised WIN32 `WSAStartup()` and registration of `atexit(WSACleanup)` to
only be done once per program (and cleanups to be always registered); this
impacts the C `libupsclient` and C++ `libnutclient` libraries (and so most
NUT clients and tools which use the former, and `nutconf` which uses the
latter), the `apcupsd` driver, `upsd` data server, and `nut-scanner` tool.
[PR #3237]

- Revised CI and deliverable scripts, and Makefile recipes, to not use
the verbatim `grep -E` (loudly preferred by newer systems, but may be
absent on older ones) after all, nor use `egrep` (loudly disliked by
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ Changes from 2.8.4 to 2.8.5
usually override `--with-pidpath` anyway to provide a dedicated location
for NUT `root`-owned daemon PID files. [#3099]

- The autoconf managed macro for `--with-port` option was renamed from plain
`PORT` to less ambiguous `NUT_PORT` to avoid potential conflicts with any
third-party code. If anyone did use this macro in their custom builds or
integrations, some renaming (or stubbed definitions to the effect of
`PORT=NUT_PORT`) may be needed. [#3238]

- In drivers using the common `main.c` and `main.h` framework, introduced
a `void upsdrv_tweak_prognames(void)` required method (may be no-op) to
optionally tweak `prognames[]` entries now that there is certain support
Expand Down
12 changes: 9 additions & 3 deletions clients/nutclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,14 @@ void Socket::connect(const std::string& host, uint16_t port)
HANDLE event = NULL;
unsigned long argp;

WSADATA WSAdata;
WSAStartup(2,&WSAdata);
/* Required ritual before calling any socket functions */
static WSADATA WSAdata;
static int WSA_Started = 0;
if (!WSA_Started) {
WSAStartup(2, &WSAdata);
atexit((void(*)(void))WSACleanup);
WSA_Started = 1;
}
#endif /* WIN32 */

_sock = INVALID_SOCKET;
Expand Down Expand Up @@ -794,7 +800,7 @@ bool Client::hasFeature(const Feature& feature)
TcpClient::TcpClient():
Client(),
_host("localhost"),
_port(3493),
_port(NUT_PORT),
_timeout(0),
_socket(new internal::Socket)
{
Expand Down
14 changes: 11 additions & 3 deletions clients/nutclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@

/* See include/common.h for details behind this */
#ifndef NUT_UNUSED_VARIABLE
#define NUT_UNUSED_VARIABLE(x) (void)(x)
# define NUT_UNUSED_VARIABLE(x) (void)(x)
#endif

/* Should be defined via autoconf in include/config.h -
* if that is included earlier by the program code.
* If not - got a fallback here:
*/
#ifndef NUT_PORT
# define NUT_PORT 3493
#endif

namespace nut
Expand Down Expand Up @@ -389,15 +397,15 @@ class TcpClient : public Client
* \param host Server host name.
* \param port Server port.
*/
TcpClient(const std::string& host, uint16_t port = 3493);
TcpClient(const std::string& host, uint16_t port = NUT_PORT);
~TcpClient() override;

/**
* Connect it to the specified server.
* \param host Server host name.
* \param port Server port.
*/
void connect(const std::string& host, uint16_t port = 3493);
void connect(const std::string& host, uint16_t port = NUT_PORT);

/**
* Connect to the server.
Expand Down
21 changes: 15 additions & 6 deletions clients/upsclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,9 +1019,16 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags
HANDLE event = NULL;
unsigned long argp;

WSADATA WSAdata;
WSAStartup(2,&WSAdata);
/* Required ritual before calling any socket functions */
static WSADATA WSAdata;
static int WSA_Started = 0;
if (!WSA_Started) {
WSAStartup(2, &WSAdata);
atexit((void(*)(void))WSACleanup);
WSA_Started = 1;
}
#endif /* WIN32 */

if (!ups) {
return -1;
}
Expand Down Expand Up @@ -1164,9 +1171,11 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags
ups->upserror == UPSCLI_ERR_CONNFAILURE &&
ups->syserrno == ETIMEDOUT
) {
const char *addrstr = inet_ntopAI(ai);
const char *addrstr = xinet_ntopAI(ai);
upslogx(LOG_WARNING, "%s: Connection to host timed out: '%s'",
__func__, (addrstr && *addrstr) ? addrstr : NUT_STRARG(host));
if (addrstr)
free((char*)addrstr);
break;
}
continue;
Expand Down Expand Up @@ -1694,7 +1703,7 @@ int upscli_splitname(const char *buf, char **upsname, char **hostname, uint16_t
return -1;
}

*port = PORT;
*port = NUT_PORT;
return 0;
}

Expand Down Expand Up @@ -1750,7 +1759,7 @@ int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port)

/* no port specified, use default */
if (((s = strtok_r(NULL, "\0", &last)) == NULL) || (*s != ':')) {
*port = PORT;
*port = NUT_PORT;
return 0;
}
} else {
Expand All @@ -1763,7 +1772,7 @@ int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port)

/* no port specified, use default */
if (s == NULL) {
*port = PORT;
*port = NUT_PORT;
return 0;
}
}
Expand Down
Loading
Loading