catalinii / minisatip

minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
https://minisatip.org
328 stars 81 forks source link

UUID / UDN generation non-deterministic #1166

Closed jellekaufmann closed 1 month ago

jellekaufmann commented 2 months ago

Hi,

I was having a weird problem with TVHeadend losing its SAT-IP tuner configuration from time to time.

This was caused by Minisatip generating a different UUID when it is starts during boot. Probably because the network is not yet fully initialized. <UDN>uuid:11223344-9999-0000-b7ae-f2b605000000</UDN>

After restarting Minisatip the UUID has changed to the MAC address of the network interface: <UDN>uuid:11223344-9999-0000-b7ae-001dec187062</UDN>

Overwriting the MAC address using -m is a workaround.

Hardware: DUO4KSE running a stripped OpenATV (no enigma)

Jalle19 commented 2 months ago

Is "f2b605000000" always the same?

jellekaufmann commented 2 months ago

No

<UDN>uuid:11223344-9999-0000-b7ae-f2b605000000</UDN>
<UDN>uuid:11223344-9999-0000-b7ae-fdb605000000</UDN>
<UDN>uuid:11223344-9999-0000-b7ae-f7b605000000</UDN>
<UDN>uuid:11223344-9999-0000-b7ae-fbb605000000</UDN>
Jalle19 commented 2 months ago

Can you paste the output of ip link from your Enigma box?

Jalle19 commented 2 months ago

It seems like get_mac_address ends up picking the wrong interface the first time around

jellekaufmann commented 2 months ago
# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sys0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:1d:ec:18:70:62 brd ff:ff:ff:ff:ff:ff
3: eth0@sys0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default 
    link/ether 00:1d:ec:18:70:62 brd ff:ff:ff:ff:ff:ff

I have checked the init scripts and the network interface is indeed brought up after minisatip.

This behavior seems a bit odd to me since I'm not binding minisatip to a specific interface.

Jalle19 commented 2 months ago

Strange, I wonder where it's getting the wrong MAC address. Either way you need to make minisatip start a bit later in the boot process.

jellekaufmann commented 2 months ago

Yup. I just thought this was a weird failure mode that took me a while to figure out. And starting services before the network is up is not unheard of, especially on init systems like systemd.

If this works like intended i will close this issue.

Jalle19 commented 2 months ago

IMHO the whole UDN logic should be refactored, we already changed it once so that the UUID is generated statically at startup, the next step should be to make it completely random and stored in the cache directory along with bootid and other files. That would remove the (flaky) dependency on MAC addresses.

@catalinii thoughts on the above?

Jalle19 commented 2 months ago

Basically same idea as I had before: https://github.com/catalinii/minisatip/issues/1078#issuecomment-1468728078

jellekaufmann commented 1 month ago

That looks great. I will give it a try soon.

Thank you!

9000h commented 1 month ago

if you use a Panasonic TV as client it good idea to backup the bootid file as the TV store and use the uuid for the channels scanned, if you have a new uuid you have to do a channel scan again. missing the -m / -mac option

Jalle19 commented 1 month ago

Tvheadend also treats new UUID aa new server. If no disruption is important one can edit the bootid file manually to include the desired UUID.