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

nut-scanner seems to not really handle IPv6 addresses? #2512

Closed
jimklimov opened this issue Jul 5, 2024 · 2 comments · Fixed by #2518
Closed

nut-scanner seems to not really handle IPv6 addresses? #2512

jimklimov opened this issue Jul 5, 2024 · 2 comments · Fixed by #2518
Labels
bug impacts-release-2.8.2 Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks) nut-scanner portability We want NUT to build and run everywhere possible
Milestone

Comments

@jimklimov
Copy link
Member

During work on PR #2509, nut-scanner console log got filled by these lines:

upscli_splitaddr: no port specified after ':' separator

My first guess is that colon-separated IPv6 addresses are not really recognized by upscli?.. (CC @aquette : I would only get to look at this in detail later in the summer)

@jimklimov jimklimov added bug nut-scanner portability We want NUT to build and run everywhere possible impacts-release-2.8.2 Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks) labels Jul 5, 2024
@jimklimov jimklimov added this to the 2.8.3 milestone Jul 5, 2024
@jimklimov
Copy link
Member Author

jimklimov commented Jul 8, 2024

At least, with upsc the square brackets around the address are needed:

:; ./clients/upsc -l 'xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6'
Error: No such host

:; ./clients/upsc -l '[xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6]'
dummy
eco650

# On another VM with an isolated IPv6 subnet island, the attempt reasonably reports:
#   Error: Connection failure: Network is unreachable

Scanning a single address in a different build than that reported from PR preparation above, no errors were logged but no discovery either:

:; LD_LIBRARY_PATH=`pwd`/clients/.libs ./tools/nut-scanner/nut-scanner -DDDDDD -O -s xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6

...
   0.130177     [D1] nutscan_init: succeeded to load the library for NUT Client library
   0.130557     [D5] add_ip_range: only start address was provided, setting end to same: xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6
   0.130567     [D1] Recorded IP address range #1: [xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6 .. xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6]
...
   0.130635     [D2] Entering run_nut_old for 1 IP address range(s)
   0.130649     [D1] nutscan_scan_nut: Scanning "Old NUT" bus for single IP address: xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6
   0.130988     [D2] nutscan_scan_nut: all planned scans launched, waiting for threads to complete
   0.131007     [D2] Entering list_nut_devices for xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6
   0.133573     [D2] nutscan_scan_nut: all threads freed
...

...and with the square brackets, the address is treated as invalid (so at least got a new inconsistency here):

...
   0.022613     [D1] nutscan_init: succeeded to load the library for NUT Client library
   0.022633     [D5] add_ip_range: only start address was provided, setting end to same: [xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6]
   0.022638     [D1] Recorded IP address range #1: [[xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6] .. [xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6]]
...
   0.022705     [D2] Entering run_nut_old for 1 IP address range(s)
   0.022759     [D1] nutscan_scan_nut: Scanning "Old NUT" bus for single IP address: [xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6]
   0.022754     [D1] NUT bus (old) SCAN: join back the pthread
Invalid address : [xxxx:xxxx:xxxx:xxxx:da5e:d3ff:fe5c:5fd6]
   0.151301     [D2] Finished run_nut_old loop
...

@jimklimov
Copy link
Member Author

jimklimov commented Jul 8, 2024

Also problematic is a query for upsc -L upsname@[IPv6:add:ress]{:port}.

UPDATE: also happens to IPv4, due to handling of ups-listing query if(varlist) { upscli_splitaddr(...) } assuming the argv[0] is hostname[:port]. Oh well, a user's shot in the foot. Normal queries for readings from a device do work, for [IPv6]{:port} also.

jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
…dress cases into one [networkupstools#2512]

This should apply formatting from nutscan_ip_iter_init() to single-IP scans
like it happens for other protocols already.

Also take the chance to rectify indentations through parallel threads code.

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
…dress cases into one [networkupstools#2512]

This should apply formatting from nutscan_ip_iter_init() to single-IP scans
like it happens for other protocols already.

Also take the chance to rectify indentations through parallel threads code.

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
…ostname was expected - use NUT_STRARG() for safety [networkupstools#2512]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
…ostname was expected - use NUT_STRARG() for safety [networkupstools#2512]

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 8, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 22, 2024
jimklimov added a commit to jimklimov/nut that referenced this issue Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug impacts-release-2.8.2 Issues reported against NUT release 2.8.2 (maybe vanilla or with minor packaging tweaks) nut-scanner portability We want NUT to build and run everywhere possible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant