-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Fix UUID generation with SSDP disabled #1119
Conversation
* Handle CWs out of cycle * Change CW time after calculate expire time
… and only CAIDs accepted by the CAM
Eventually all parameter parsing should be factored out to separate functions like this so they can be tested in isolation
- specifying "~" made the hostname contain "~" if an offset was specified - specifying an offset truncated the hostname
Fixes: stream.c:611:5: warning: implicit conversion from 'int' to 'char' changes value from 128 to -128 [-Wconstant-conversion] copy16(rtp_buf, len + 0, (uint16_t)0x8021); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/minisatip.h:34:27: note: expanded from macro 'copy16' a[i] = ((v) >> 8) & 0xFF; \ ~ ~~~~~~~~~~~^~~~~~ 1 warning generated.
Some SAT>IP clients send the parameter "bw" (DVB-T/C) in a incorrect range. The specifications indicate that acceptable values are: "5”, ”6”, “7”, “8", “10”, “1.712”. Therefore values like "bw=8000" or "bw=8000000" are incorrect. But we can handle them. In fact previously these requests will generate an overflow internaly in the value but the request will be served. This patch fixes this recalculating incorrect values.
Hi @Jalle19 , Check it and merge. |
@@ -1939,7 +1948,8 @@ int main(int argc, char *argv[]) { | |||
(socket_action)ssdp_discovery); | |||
if (si < 0 || si1 < 0) | |||
FAIL("sockets_add failed for ssdp"); | |||
} | |||
} else | |||
generate_uuid(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Would it be possible to call generate_uuid()
just in one place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's necessary because the global var uuidi
that controls the UUID generation. So we need to be sure that in all cases the UUID is created. So for reason and in order to not generate side effects errors if the code changes in the future, then it's preferable to call to the new generate_uuid()
function every time a SSDP call is done and overcomed by the opts.disable_ssdp
option. Therefore it's more safe to add this line here.
Please check it and merge! 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think it would be preferable to call generate_uuid()
just once sometime during startup. Then we could even get rid of uuidi
completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Jalle19 ,
That's my original idea. However, I'm not the one that has introduced the uuidi
var. This var has specifically the objective of caching the creation of the UUID. I feel this was introduced (by @catalinii) to overcome potential errors of different edge cases or to permit to recalculate it. Anyway the fix is clean, simple and it works, so I suggest to merge it.
Regards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the UUID is static for the duration of the program I think it's best to refactor this while we're at it so that the UUID is generated only once during startup. The uuidi
variable was perhaps added to protect against the UUID suddenly changing if the MAC address changes (not very common but could theoretically happen).
You can generate the UUID somewhere in the startup logic, before the SSDP and HTTP sockets etc. are open.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Jalle19 ,
I undertand you suggestion. And I agree with the idea of some refactor. However, now I don't have much time. So because the code is clean and it fixes the bug, why not merge it now and in the future someone will refactor it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see if I can find the time to do the necessary changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @catalinii ,
Can you comment please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of things have been done historically for reasons probably they are no longer valid.
Cleaning the code is the best way forward IMHO, so I think that stripping the code out from there and putting it in the initialization part would make the code more clean and it would be called just once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @catalinii ,
Thank you for the response. I agree with you and @Jalle19 . I prefer it the code will be cleaned. However, I don't have time now to do it. So I hope @Jalle19 could enhance the PR. In fact it's sufficient to check all calls to generate_uuid()
. The problem in my case it's the time necessary to do an extensible check of all edge cases. And for this reason I've suggested to merge the PR and after refactor the code. Perhaps the most simple way is to encapsulate all initialization tasks inside a new function and execute the call to generate_uuid()
inside it.
Regards.
Replaced by #1140 |
This fixes the empty UUID when the SSDP is disabled with the command line parameter
-G
, as described in #1078.