Repository navigation
Wireless registrations: show client signal and resolve client names via DNS - #145
Merged
Merged
Conversation
RouterOS 7 (WifiWave2) reports only the client signal, not signal-to-noise, so the Wireless Registrations Signal to Noise column was empty. Show the collected signal (dBm) and clear stale SNMP-era SNR values on API-polled rows. Client names came only from DHCP host-names. Use the router's registration-table dhcp-hostname when present and otherwise resolve the client's IP (dhcp-address or any device's DHCP lease) through the collected DNS cache, then reverse DNS, caching the result so access point clients and clients without a host-name are named. Show only the newest name per MAC so multiple cached names do not duplicate rows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
RouterOS 7 never reports SNR and pre-7 SNMP devices also populate Strength, so a single signal column works for every device. SNR is still collected on pre-7 devices for graphs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Hostname resolution can cache another device’s name from cross-router DNS records or stale, inactive leases, while concurrent cache writes can incorrectly prioritize DNS names over DHCP names.
3 open issues
What changed in this PR
Improves wireless registration visibility in the Cacti MikroTik plugin, adding RouterOS 7 signal display and client-name resolution while retaining RouterOS 6 signal-to-noise support.
Changes:
- Displays signal strength and selects one cached client name per MAC.
- Collects registration-provided names, adds DNS fallback, and clears stale API-row signal-to-noise values.
- Adds hostname-normalization tests and updates translations and release notes.
| File | Description |
|---|---|
| tests/Unit/PollerParsingTest.php | Tests DNS-name normalization and rejection of unusable results. |
| poller_mikrotik.php | Adds client-name collection and DNS resolution; clears stale signal-to-noise data. |
| mikrotik.php | Displays signal strength and selects the newest cached name per MAC. |
| locales/po/cacti.pot | Adds the translatable signal-strength column label. |
| CHANGELOG.md | Documents signal display and client-name resolution changes. |
Review effort: Balanced
Address review feedback on the client-name fallback: - Only resolve addresses from a bound, enabled DHCP lease seen in the latest collection, so a stale or reassigned lease cannot attach another client's name to the MAC. - Look up the DNS cache on the device that supplied the address (the polled device for dhcp-address, the lease's device otherwise), so overlapping networks cannot cross-assign names. - Record DNS-derived names with a new mac2hostname source column and prefer DHCP names in the UI regardless of write order (schema 3.5). - Mark the eval-loaded mikrotik_clean_dns_name() helper as coverage ignored, matching the other isolated poller helpers, to satisfy the changed-lines coverage gate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prune wireless registrations not seen for longer than the new 'Wireless Registration Retention' setting (same choices and default as the other retention settings) alongside the DHCP/DNS/Address List pruning, and remove the Graphs and Data Sources created for them. Rename the 'DHCP/DNS/List Settings' section to 'Data Retention' and drop the redundant 'MikroTik' prefix from the settings tab section and option labels. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
checkHost() is not exercised by the unit suite; mark the new call like the neighbouring RouterOS 7 wireless block. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The fifteen drop-down entries differed only in label, description, option list and default; generate them with mikrotik_drop_setting() to remove the duplication flagged by SonarCloud. The resulting settings array is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The settings hook can run before config_arrays has populated the option lists; pass them through unchanged as before. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Generate the repeated section headings and checkbox entries with mikrotik_spacer_setting() and mikrotik_checkbox_setting(), clearing the remaining SonarCloud duplication on the MikroTik settings tab. The resulting settings array is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
bmfmancini
approved these changes
Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Problem
On RouterOS 7 the Wireless Registrations page showed most rows with an empty Signal to Noise column and several blank Client Names, even though
/interface/wifi/registration-table/printon the device shows good data.signal(dBm), which was stored inStrength, but the page only renderedSignalToNoise, which the API path never sets. The few rows with an SNR value were stale SNMP-era rows (lowercase MAC index) that kept their old value.host-nameviaplugin_mikrotik_mac2hostname. Clients that send no host-name, and access-point clients whose router has no lease name, showed blank. The router's registration table exposesdhcp-hostname/dhcp-address, but access points do not, and neither was used. There was no DNS fallback.Changes
Strength), which both RouterOS 7 (API) and pre-7 (SNMP) devices populate, so one column works for every device. SNR is still collected on pre-7 devices for graphs. Joinmac2hostnamethrough a per-MAC "newest name" subquery. That table's primary key is (mac_address,hostname), so a MAC with more than one cached name could otherwise duplicate registration rows.dhcp-hostname(routers) inmac2hostname, and setSignalToNoise = NULLon upsert to clear stale SNMP values.mikrotik_resolve_wireless_client_names(), run after both the API and SNMP collectors. For present registrations with no cached name, it gets the IP fromdhcp-addressor any device's DHCP lease. It then takes the name from the collected DNS cache (plugin_mikrotik_dnsA record), falling back to reverse DNS: Cacti's configured DNS servers viaget_dns_from_ip()(withsettings_dns_timeout), otherwisegethostbyaddr(). Results are cached withsource = 1viaINSERT IGNORE.mikrotik_clean_dns_name()normalizes lookup results and rejects the failure sentinels (ERROR,timed_out, echoed IP) and malformed names.plugin_mikrotik_mac2hostnamegains asourcecolumn (0 = DHCP, 1 = DNS), added on upgrade. The UI prefers DHCP names regardless of write order, and the DNS fallback is skipped until the column exists.cacti.potare updated.Testing
mikrotik_clean_dns_name().ApiTlsTestfailures are environmental: the same 8 fail on unmodifieddevelopin the test environment (openssl cert generation).tests/bin/check-i18n-pot.phppasses.Reviewer notes
/interface/wifi/scan), so the page no longer shows SNR. TheSignalToNoisecolumn and data query field are unchanged for pre-7 graphs.Settings changes (follow-up)
prune_wireless_registrations()). It also removes the Graphs and Data Sources created for them, matched by device, MACsnmp_indexand the wireless registration graph templates.mikrotik_drop_setting(),mikrotik_checkbox_setting()andmikrotik_spacer_setting(), which cleared the SonarCloud duplication gate. The generated$settingsarray was verified identical to before.