[Feature request] Let a repeater ask its neighbors which packets they have

Abierto
#4,007 0 comentarios 1 reacción 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
c, python

Línea de trabajo

Read the linked gist’s C++ header, host test, and simple_repeater hook sketch, then trace wasSeen in SimpleMeshTables and how discovery control packet sub-types are handled. The issue describes a report format and replay results, but firmware behavior has not been built or tested. Done means agreeing on whether and how to add the feature, implementing it in firmware, and validating packet handling and neighbor counts.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

In #3991 I compared the packet logs of two of my repeaters, A and B, and found that A can't tell from overheard echoes whether B is receiving it. B's receiver was half deaf for a day and A's view of it barely changed. #3315 asks for the neighbor list to show only links that work both ways, and #3937 has repeaters going slowly deaf while still transmitting, with the question "Is there a way for me to tell if receive is reducing?" I think a repeater's neighbors can answer that with one small packet, and I'd like to know if you'd take it before I write a PR.

A repeater already keeps the hashes of the last 160 packets it received or sent, to drop duplicates. On request it would send its neighbors the first two bytes of the newest 16 of those, as a zero-hop control packet. The neighbor that asked checks the list against the flood packets it forwarded in the last few minutes and counts how many are in it. neighbors could then show that count beside the SNR. Nothing acts on it. It's a number for whoever is looking after the repeater.

It uses the control packet that discovery uses, with the next free sub-type. Current repeaters, sensors, and room servers ignore a sub-type they don't know.

Field Bytes
flags 1 0xA in the upper 4 bits. Bit 0 set means the list is everything since start.
sequence 1 0 for the first report since start, then 1 to 255 and around
reporter 4 first 4 bytes of the reporter's public key
entries 2 each first 2 bytes of each packet hash, oldest first

Sixteen entries make a 38-byte payload, about 0.2 s on the air at the US preset. There are no timestamps in it because repeater clocks can't be trusted. The asking side dates the list with its own clock, from the oldest entries in it that it also saw, and judges only packets it first heard after that.

#3630 adds sequence numbers so a destination can count lost direct packets. This is for flood traffic between neighboring repeaters, and it doesn't change any existing packet.

What I tested first is the logic, in Python and in C++, by replaying my repeaters' logs with a report every 15 minutes. On the four days from #3991 the count followed what B's own log shows it had, block by block. In the worst six hours B had 45.6% of what A forwarded and the count said 45.6%. That agreement is less impressive than it looks, since both numbers come from B's log. What it does show is that A picks the right packets to judge without a shared clock, including through a real fault.

The count is of packets B ended up with, from anyone. That is the number that matters for flooding, and it is a different thing from the quality of the link from A to B. When I made a healthy receiver lose 30% of the copies it heard, it still ended up with 93% of the packets, because it hears several repeaters, and the count said 93%. A receiver that hears almost nothing but A dropped to 72%. With everything removed the count goes to zero at the next report.

Since then it has been on the air for 39 hours between four of my own repeaters, sent and judged by a script beside openHop on each Pi. It has not run in firmware. They sent 590 reports. The repeater on my roof received 432 of the 441 sent by the other three, one of which is 2.4 miles away, and the slowest took 1.5 s from being built to being received. Of 5,729 packets it forwarded and then judged, 5,721 were in the next report from the neighbor it was judging. I looked up the other 8 in the neighbors' own logs. Five really were missing. The other three are a single packet that all three neighbors had received. Each had also logged the same hash 87 minutes before, and my script leaves a repeated hash at its old place in the list, so it was no longer among the newest 16. The firmware's table looks like it does the same, since wasSeen in SimpleMeshTables returns on a match without adding the hash again, but I haven't traced every caller. All four repeaters are healthy and hear each other well, so this only shows the packet gets through and the bookkeeping holds up on a real channel.

Then I gave one of the two repeaters I keep indoors a receive fault by tuning its receiver 15.75 kHz off the channel for half an hour. The roof repeater forwarded 17 packets in that time. The faulted one received 4 of them and the one beside it received all 17. From the faulted one's reports the roof repeater counted 4 of 15, and from the other's 12 of 12, and all 15 answers match the faulted repeater's own log. The count was still 14 of 15 on the report that went out a minute after the fault began and showed the drop on the next one, 16 minutes in. That is one fault on one unit and a small number of packets.

The report isn't signed, and a companion app can already send any control packet, so the count shouldn't drive anything automatic. Companions pass control packets up to the app, so apps would start seeing a sub-type they don't know. My phone showed each one as a line in the MeshCore app's RX log and nowhere else. On a busy channel 16 entries cover very little. In the replays, at about 45 forwards an hour, they covered 82% of what A sent. On the air, at about 97 an hour, they covered half. In a synthetic run at 400 an hour they covered 13% (the count stayed right, on fewer packets). The timing margins are set for the US preset and would need to scale for slower ones. The C++ is about 3.3 KB of RAM for 8 neighbors with no floating point. I haven't measured flash.

Code is at https://gist.github.com/captinjack99/d64fedfab723562f6e6cc8e200e5925b: the reference in Python, a C++ header with a host test that checks it against the Python on about 7,500 reports, and a sketch of the hooks in simple_repeater, read against dev and not built.

In that test each unit sends a report every 15 minutes without being asked, which is about 0.02% airtime each. That would also catch a repeater nobody is watching. In firmware I'd leave it off by default, or out, whichever you prefer.

Lenguaje dominante
C
Estrellas
3.9k
Forks
1.5k
Merge medio
2 d 19 h
PR fusionados (30 d)
61

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de meshcore-dev/MeshCore

Todos los issues de meshcore-dev/MeshCore

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.