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

input: tvhdhomerun: Handle the device changing IP addresses #850

Closed
wants to merge 1 commit into from
Closed

input: tvhdhomerun: Handle the device changing IP addresses #850

wants to merge 1 commit into from

Conversation

mamarley
Copy link
Contributor

Previously the device detection loop would always ignore HDHomeRuns
with the same UID as devices that had already been detected. This
would not detect if an HDHomeRun changed IPs for any reason (e.g.
APIPA, misconfigured DHCP server) while TVHeadend was running,
requiring a restart to resume functionality. Instead, if
a newly detected device has the same UID as an previously-detected
one but a different IP address, destroy the old device and recreate
it with the new IP address.

@@ -86,7 +86,7 @@ tvhdhomerun_device_class_get_title( idnode_t *in, const char *lang )
static char buf[256];
tvhdhomerun_device_t *hd = (tvhdhomerun_device_t *)in;
snprintf(buf, sizeof(buf),
"%s - %s", hd->hd_info.friendlyname, hd->hd_info.ip_address);
"%s - %s", hd->hd_info.friendlyname, inet_ntoa(hd->hd_info.ip_address));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls, use tvh's tcp_get_str_from_ip() function here... inet_ntoa might not allow recursive calls (static return buffer).

@perexg
Copy link
Contributor

perexg commented Apr 11, 2016

Re to IRC: See - http://stackoverflow.com/questions/16010622/reasoning-behind-c-sockets-sockaddr-and-sockaddr-storage . You may retype between struct sockaddr_storage , sockaddr , struct sockaddr_in and struct sockaddr_in6 (according family value).

If you like to compare IPv4 - use sin_addr member from sockaddr_in .

I also suggest to fill sockaddr_storage with zeroes before first use.

Previously the device detection loop would always ignore HDHomeRuns
with the same UID as devices that had already been detected.  This
would not detect if an HDHomeRun changed IPs for any reason (e.g.
APIPA, misconfigured DHCP server) while TVHeadend was running,
requiring a restart to resume functionality.  Instead, if
a newly detected device has the same UID as an previously-detected
one but a different IP address, destroy the old device and recreate
it with the new IP address.
@perexg
Copy link
Contributor

perexg commented Apr 11, 2016

Merged. Thanks for this contribution.

@perexg perexg closed this Apr 11, 2016
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 this pull request may close these issues.

None yet

2 participants