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

YSF Network on dashboard shows "Not Linked" for some reflectors #171

Closed
DrlSm opened this issue Oct 27, 2022 · 5 comments · Fixed by #172
Closed

YSF Network on dashboard shows "Not Linked" for some reflectors #171

DrlSm opened this issue Oct 27, 2022 · 5 comments · Fixed by #172

Comments

@DrlSm
Copy link

DrlSm commented Oct 27, 2022

I just installed and was experimenting with Pi-Star (version 4.1.6 / Dashboard 20221011), and noticed an issue. Specifically, I noticed that many times the YSF Network field on the Dashboard reported "Not Linked", even though the link was successful and active. It happened whether the link was initiated from the radio, or from the YSF Link Manager on the Dashboard.

I did some investigation and realized that the problem happened when I linked with nodes ending with "-Link", for example, "US-America-Link" or "US-Skyhub-Link". I found the source and dug around a bit, and it seems that the issue is in the function getYSFGatewayLog in mmdvmhost/functions.php.

Basically, the code that searches the logfile to figure out the most recent link status is getting fooled by the presence of the string "-Link" in the hexdump following the CONNECT Reply in the logfile. The grep command matches on, among other things, the string "ink" which is triggered by the hexdump, perhaps a better choice would be "inked" which matches the "Linked to -Link" and isn't spoofed by the hexdump.

The following shows the results of manually executing the command invoked by the function with the current and changed string:

before) "ink" matches hexdump string:

pi-star@pi-star(ro):pi-star$ grep -E "onnection to|onnect to|ink|isconnect|Opening YSF network" YSFGateway-2022-10-26.log | sed '/Linked to MMDVM/d' | sed '/Link successful to MMDVM/d' | sed '/*Link/d' | tail -1
D: 2022-10-26 22:07:26.255 0030: 75 62 2D 4C 69 6E 6B 20 20 30 34 34 20 20 20 20 *ub-Link 044 *

after) "inked" skips hexdump and finds desired command:

pi-star@pi-star(ro):pi-star$ grep -E "onnection to|onnect to|inked|isconnect|Opening YSF network" YSFGateway-2022-10-26.
log | sed '/Linked to MMDVM/d' | sed '/Link successful to MMDVM/d' | sed '/*Link/d' | tail -1
M: 2022-10-26 22:07:25.330 Linked to US-Skyhub-Link

I patched the functions.php file in my environment with the above change and it seems to work ok now. I am not really familiar with this code base so there may be side effects I am not aware of, but perhaps this will point someone in the right direction.

@W0CHP
Copy link

W0CHP commented Oct 27, 2022

Seems as though you have debug logging enabled. So any line in the log(s) with the prefix D: will be (unnecessarily) parsed by functions.php.

The following snippet will only parse meaningful Message (M:) lines:

$logLines1 = preg_split('/\r\n|\r|\n/', `egrep -h "^M.*(onnection to|onnect to|inked|isconnect|Opening YSF network)" $logPath1 | sed '/Linked to MMDVM/d' | sed '/Link successful to MMDVM/d' | sed '/*Link/d' | tail -1`);

...or simply try to disable debug logging :-)

@DrlSm
Copy link
Author

DrlSm commented Oct 27, 2022 via email

@W0CHP
Copy link

W0CHP commented Oct 27, 2022

@DrlSm in your /etc/ysfgateway, and in the [Log] Section/Stanza:

DisplayLevel=0
FileLevel=2

...Should hopefully squelch debug messages. (Same goes for MMDMhost ini file, etc.)

@kn2tod
Copy link
Contributor

kn2tod commented Oct 27, 2022

Perhaps stating the obvious but ... how do you debug something when the debug messages interfere with the results/behavor? Best to include the additional selection criteria just in case, regardless of these settings.

@DrlSm
Copy link
Author

DrlSm commented Oct 27, 2022

Setting FileLevel=2 in the [Log] section of /etc/ysfgateway took care of this particular problem, but I tend to agree that a more robust solution would be to tighten up the search criteria to ignore any non "^M.*" lines in the logfile so that it wouldn't matter whether or not debug was enabled.

And it is also worth reiterating that a clean install doesn't currently work quite right, the dashboard indicates that the YSF reflector is Not Linked (for some reflectors) when it really is (unless the link comes from the YSF Startup Host value on the Configuration page.) Sort of makes for a head scratcher, or at the very least unexpected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants