Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP server: bind only to IPv4 (IPv6 support is not defined in SAT>…
…IP spec), fixes #3350
  • Loading branch information
perexg committed Nov 27, 2015
1 parent 96be488 commit e2d813f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/satip/server.c
Expand Up @@ -719,7 +719,7 @@ void satip_server_init(int rtsp_port)
satip_server_bootid = time(NULL);
satip_server_conf.satip_deviceid = 1;

if (tcp_server_bound(http_server, &http) < 0) {
if (tcp_server_bound(http_server, &http, PF_INET) < 0) {
tvherror("satips", "Unable to determine the HTTP/RTSP address");
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/tcp.c
Expand Up @@ -929,15 +929,15 @@ tcp_server_delete(void *server)
*
*/
int
tcp_default_ip_addr ( struct sockaddr_storage *deflt )
tcp_default_ip_addr ( struct sockaddr_storage *deflt, int family )
{

struct sockaddr_storage ss;
socklen_t ss_len;
int sock;

memset(&ss, 0, sizeof(ss));
ss.ss_family = tcp_preferred_address_family;
ss.ss_family = family == PF_UNSPEC ? tcp_preferred_address_family : family;
if (inet_pton(ss.ss_family,
ss.ss_family == AF_INET ?
/* Google name servers */
Expand Down Expand Up @@ -978,7 +978,7 @@ tcp_default_ip_addr ( struct sockaddr_storage *deflt )
*
*/
int
tcp_server_bound ( void *server, struct sockaddr_storage *bound )
tcp_server_bound ( void *server, struct sockaddr_storage *bound, int family )
{
tcp_server_t *ts = server;
int i, len, port;
Expand All @@ -1001,7 +1001,7 @@ tcp_server_bound ( void *server, struct sockaddr_storage *bound )
port = IP_PORT(ts->bound);

/* no bind address was set, try to find one */
if (tcp_default_ip_addr(bound) < 0)
if (tcp_default_ip_addr(bound, family) < 0)
return -1;
if (bound->ss_family == AF_INET)
IP_AS_V4(*bound, port) = port;
Expand Down
4 changes: 2 additions & 2 deletions src/tcp.h
Expand Up @@ -72,9 +72,9 @@ void tcp_server_register(void *server);

void tcp_server_delete(void *server);

int tcp_default_ip_addr(struct sockaddr_storage *deflt);
int tcp_default_ip_addr(struct sockaddr_storage *deflt, int family);

int tcp_server_bound(void *server, struct sockaddr_storage *bound);
int tcp_server_bound(void *server, struct sockaddr_storage *bound, int family);

int tcp_read(int fd, void *buf, size_t len);

Expand Down

2 comments on commit e2d813f

@Jalle19
Copy link
Contributor

Choose a reason for hiding this comment

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

Any chance you could cherry-pick this to 4.0? Thanks for the quick fix, I'll try it out tomorroe.

@perexg
Copy link
Contributor Author

@perexg perexg commented on e2d813f Nov 27, 2015

Choose a reason for hiding this comment

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

Done.

Please sign in to comment.