Skip to content

Commit 67b11d4

Browse files
committed
Don't digipeat packets when the source is my call.
1 parent 58c2707 commit 67b11d4

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

digipeater.c

+42-7
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ static char *dest_ssid_path[16] = {
283283
static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, char *mycall_xmit,
284284
regex_t *alias, regex_t *wide, int to_chan, enum preempt_e preempt, char *filter_str)
285285
{
286+
char source[AX25_MAX_ADDR_LEN];
286287
int ssid;
287288
int r;
288289
char repeater[AX25_MAX_ADDR_LEN];
@@ -292,8 +293,6 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
292293
/*
293294
* First check if filtering has been configured.
294295
*/
295-
296-
297296
if (filter_str != NULL) {
298297

299298
if (pfilter(from_chan, to_chan, filter_str, pp, 1) != 1) {
@@ -351,10 +350,13 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
351350

352351

353352
/*
354-
* First check for explicit use of my call.
353+
* First check for explicit use of my call, including SSID.
354+
* Someone might explicitly specify a particular path for testing purposes.
355+
* This will bypass the usual checks for duplicates and my call in the source.
356+
*
355357
* In this case, we don't check the history so it would be possible
356358
* to have a loop (of limited size) if someone constructed the digipeater paths
357-
* correctly.
359+
* correctly. I would expect it only for testing purposes.
358360
*/
359361

360362
if (strcmp(repeater, mycall_rec) == 0) {
@@ -370,13 +372,24 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
370372
return (result);
371373
}
372374

375+
/*
376+
* Don't digipeat my own. Fixed in 1.4 dev H.
377+
* Alternatively we might feed everything transmitted into
378+
* dedupe_remember rather than only frames out of digipeater.
379+
*/
380+
ax25_get_addr_with_ssid(pp, AX25_SOURCE, source);
381+
if (strcmp(source, mycall_rec) == 0) {
382+
return (NULL);
383+
}
384+
385+
373386
/*
374387
* Next try to avoid retransmitting redundant information.
375388
* Duplicates are detected by comparing only:
376389
* - source
377390
* - destination
378391
* - info part
379-
* - but none of the digipeaters
392+
* - but not the via path. (digipeater addresses)
380393
* A history is kept for some amount of time, typically 30 seconds.
381394
* For efficiency, only a checksum, rather than the complete fields
382395
* might be kept but the result is the same.
@@ -385,7 +398,6 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
385398
*
386399
*/
387400

388-
389401
if (dedupe_check(pp, to_chan)) {
390402
//#if DEBUG
391403
/* Might be useful if people are wondering why */
@@ -399,7 +411,10 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
399411

400412
/*
401413
* For the alias pattern, we unconditionally digipeat it once.
402-
* i.e. Just replace it with MYCALL don't even look at the ssid.
414+
* i.e. Just replace it with MYCALL.
415+
*
416+
* My call should be an implied member of this set.
417+
* In this implementation, we already caught it further up.
403418
*/
404419
err = regexec(alias,repeater,0,NULL,0);
405420
if (err == 0) {
@@ -812,6 +827,7 @@ int main (int argc, char *argv[])
812827
/*
813828
* Drop duplicates within specified time interval.
814829
* Only the first 1 of 3 should be retransmitted.
830+
* The 4th case might be controversial.
815831
*/
816832

817833
test ( "W1XYZ>TEST,R1*,WIDE3-2:info1",
@@ -823,6 +839,10 @@ int main (int argc, char *argv[])
823839
test ( "W1XYZ>TEST,R3*,WIDE3-2:info1",
824840
"");
825841

842+
test ( "W1XYZ>TEST,R1*,WB2OSZ-9:has explicit routing",
843+
"W1XYZ>TEST,R1,WB2OSZ-9*:has explicit routing");
844+
845+
826846
/*
827847
* Allow same thing after adequate time.
828848
*/
@@ -882,8 +902,23 @@ int main (int argc, char *argv[])
882902

883903
/*
884904
* Did I miss any cases?
905+
* Yes. Don't retransmit my own. 1.4H
885906
*/
886907

908+
test ( "WB2OSZ-7>TEST14,WIDE1-1,WIDE1-1:stuff",
909+
"WB2OSZ-7>TEST14,WB2OSZ-9*,WIDE1-1:stuff");
910+
911+
test ( "WB2OSZ-9>TEST14,WIDE1-1,WIDE1-1:from myself",
912+
"");
913+
914+
test ( "WB2OSZ-9>TEST14,WIDE1-1*,WB2OSZ-9:from myself but explicit routing",
915+
"WB2OSZ-9>TEST14,WIDE1-1,WB2OSZ-9*:from myself but explicit routing");
916+
917+
test ( "WB2OSZ-15>TEST14,WIDE1-1,WIDE1-1:stuff",
918+
"WB2OSZ-15>TEST14,WB2OSZ-9*,WIDE1-1:stuff");
919+
920+
921+
887922
if (failed == 0) {
888923
dw_printf ("SUCCESS -- All digipeater tests passed.\n");
889924
}

0 commit comments

Comments
 (0)