Fix: send_counters(), port-argument have to be physical port number.

Not the physical port index!
This commit is contained in:
René van Dorst
2026-08-25 07:55:17 +02:00
parent 74013bb14f
commit ee05cd4000
3 changed files with 25 additions and 24 deletions
+1 -1
View File
@@ -180,7 +180,7 @@ function fillStats() {
td = tr.insertCell(); td.appendChild(document.createTextNode(`${txB[i]}` + t('common_pkts'))); td = tr.insertCell(); td.appendChild(document.createTextNode(`${txB[i]}` + t('common_pkts')));
td = tr.insertCell(); td.appendChild(document.createTextNode(`${rxG[i]}` + t('common_pkts'))); td = tr.insertCell(); td.appendChild(document.createTextNode(`${rxG[i]}` + t('common_pkts')));
td = tr.insertCell(); td.appendChild(document.createTextNode(`${rxB[i]}` + t('common_pkts'))); td = tr.insertCell(); td.appendChild(document.createTextNode(`${rxB[i]}` + t('common_pkts')));
var button = '<button type="button" style="margin: 0 0 0 24px" onclick="getCounters(' + i + ');">' + t('stat_show') + '</button>'; var button = '<button type="button" style="margin: 0 0 0 24px" onclick="getCounters(' + (i + 1) + ');">' + t('stat_show') + '</button>';
td = tr.insertCell(); td.innerHTML = button; td = tr.insertCell(); td.innerHTML = button;
} }
} }
+3 -2
View File
@@ -290,11 +290,12 @@ void send_vlan(uint16_t vlan)
} }
/* Send counters /* Send counters
* Only accepts physical port idx to 0-8. * Only accepts physical port 1..9.
* Returns an error if the port physical don't exists. * Returns an error if the port physical don't exists.
*/ */
bool send_counters(uint8_t phys_port_idx) bool send_counters(uint8_t phys_port)
{ {
uint8_t phys_port_idx = phys_port - 1;
if (phys_port_idx > 8) if (phys_port_idx > 8)
goto err; goto err;
uint8_t log_port = machine.phys_to_log_port[phys_port_idx]; uint8_t log_port = machine.phys_to_log_port[phys_port_idx];
+1 -1
View File
@@ -3,7 +3,7 @@
#include <stdbool.h> #include <stdbool.h>
bool send_counters(uint8_t phys_port_idx); bool send_counters(uint8_t phys_port);
void send_status(void); void send_status(void);
void send_vlan(uint16_t vlan); void send_vlan(uint16_t vlan);
void send_basic_info(void); void send_basic_info(void);