Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2236 nut scanner reports non existent driver for nut discovery #2245

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ https://github.com/networkupstools/nut/milestone/10
* Added generation of FreeBSD/pfSense quirks for USB devices supported
by NUT (may get installed to `$datadir` e.g. `/usr/local/share/nut`
and need to be pasted into your `/boot/loader.conf.local`). [#2159]
* nut-scanner now report 'dummy-ups' as driver when scanning NUT with
Old or Avahi method.

- upsd: Fixed conditions for "no listening interface available" diagnosis
to check how many listeners we succeeded with, not whether the first one
Expand Down
2 changes: 2 additions & 0 deletions data/driver.list.in
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,8 @@
"Numeric" "ups" "2" "3000 SW" "" "blazer_ser"
"Numeric" "ups" "2" "Digital 800 plus" "USB" "nutdrv_qx or blazer_usb"

"NUT" "ups" "5" "all supported NUT devices, through remote upsd" "" "dummy-ups"

"Oneac" "ups" "1" "ON400" "advanced interface" "oneac"
"Oneac" "ups" "1" "ON600" "advanced interface" "oneac"
"Oneac" "ups" "1" "ON900" "advanced interface" "oneac"
Expand Down
8 changes: 6 additions & 2 deletions tools/nut-scanner/scan_avahi.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (C) 2011 - 2023 Arnaud Quette (Design and part of implementation)
* Copyright (C) 2011 - EATON
*
* This program is free software; you can redistribute it and/or modify
Expand All @@ -19,6 +20,7 @@
/*! \file scan_avahi.c
\brief detect NUT through Avahi mDNS / DNS-SD services
\author Frederic Bohe <fredericbohe@eaton.com>
\author Arnaud Quette <arnaudquette@free.fr>
*/

#include "common.h"
Expand All @@ -40,6 +42,8 @@

#include <ltdl.h>

#define SCAN_AVAHI_DRIVERNAME "dummy-ups"

/* dynamic link library stuff */
static lt_dlhandle dl_handle = NULL;
static const char *dl_error = NULL;
Expand Down Expand Up @@ -266,7 +270,7 @@ static void update_device(const char * host_name, const char *ip, uint16_t port,
dev->type = TYPE_NUT;
/* NOTE: There is no driver by such name, in practice it could
* be a dummy-ups relay, a clone driver, or part of upsmon config */
dev->driver = strdup("nutclient");
dev->driver = strdup(SCAN_AVAHI_DRIVERNAME);
if (proto == AVAHI_PROTO_INET) {
nutscan_add_option_to_device(dev, "desc", "IPv4");
}
Expand Down Expand Up @@ -322,7 +326,7 @@ static void update_device(const char * host_name, const char *ip, uint16_t port,
else {
dev = nutscan_new_device();
dev->type = TYPE_NUT;
dev->driver = strdup("nutclient");
dev->driver = strdup(SCAN_AVAHI_DRIVERNAME);
if (proto == AVAHI_PROTO_INET) {
nutscan_add_option_to_device(dev, "desc", "IPv4");
}
Expand Down
6 changes: 5 additions & 1 deletion tools/nut-scanner/scan_nut.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (C) 2011 - 2023 Arnaud Quette (Design and part of implementation)
* Copyright (C) 2011 - EATON
* Copyright (C) 2016-2021 - EATON - Various threads-related improvements
*
Expand All @@ -21,6 +22,7 @@
\brief detect remote NUT services
\author Frederic Bohe <fredericbohe@eaton.com>
\author Jim Klimov <EvgenyKlimov@eaton.com>
\author Arnaud Quette <arnaudquette@free.fr>
*/

#include "common.h"
Expand All @@ -29,6 +31,8 @@
#include "nut_stdint.h"
#include <ltdl.h>

#define SCAN_NUT_DRIVERNAME "dummy-ups"

/* dynamic link library stuff */
static lt_dlhandle dl_handle = NULL;
static const char *dl_error = NULL;
Expand Down Expand Up @@ -192,7 +196,7 @@ static void * list_nut_devices(void * arg)
dev->type = TYPE_NUT;
/* NOTE: There is no driver by such name, in practice it could
* be a dummy-ups relay, a clone driver, or part of upsmon config */
dev->driver = strdup("nutclient");
dev->driver = strdup(SCAN_NUT_DRIVERNAME);
/* +1+1 is for '@' character and terminating 0 */
buf_size = strlen(answer[1]) + strlen(hostname) + 1 + 1;
if (port != PORT) {
Expand Down
Loading