Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
dc7dd8bf
Commit
dc7dd8bf
authored
Feb 10, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Use OS default TTL when not overriden
- Clean up (refs #404)
parent
51c0881c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
38 deletions
+24
-38
modules/misc/network/ipv4.c
modules/misc/network/ipv4.c
+22
-28
modules/misc/network/ipv6.c
modules/misc/network/ipv6.c
+2
-10
No files found.
modules/misc/network/ipv4.c
View file @
dc7dd8bf
/*****************************************************************************
* ipv4.c: IPv4 network abstraction layer
*****************************************************************************
* Copyright (C) 2001-200
5
the VideoLAN team
* Copyright (C) 2001-200
6
the VideoLAN team
* $Id$
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
...
...
@@ -437,7 +437,6 @@ static int OpenUDP( vlc_object_t * p_this )
{
/* set the time-to-live */
int
i_ttl
=
p_socket
->
i_ttl
;
unsigned
char
ttl
;
/* set the multicast interface */
char
*
psz_mif_addr
=
config_GetPsz
(
p_this
,
"miface-addr"
);
...
...
@@ -456,35 +455,30 @@ static int OpenUDP( vlc_object_t * p_this )
}
}
if
(
i_ttl
<
1
)
{
if
(
var_Get
(
p_this
,
"ttl"
,
&
val
)
!=
VLC_SUCCESS
)
{
var_Create
(
p_this
,
"ttl"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_this
,
"ttl"
,
&
val
);
}
i_ttl
=
val
.
i_int
;
}
if
(
i_ttl
<
1
)
i_ttl
=
1
;
ttl
=
(
unsigned
char
)
i_ttl
;
/* There is some confusion in the world whether IP_MULTICAST_TTL
* takes a byte or an int as an argument.
* BSD seems to indicate byte so we are going with that and use
* int as a fallback to be safe */
if
(
setsockopt
(
i_handle
,
IPPROTO_IP
,
IP_MULTICAST_TTL
,
&
ttl
,
sizeof
(
ttl
)
)
<
0
)
if
(
i_ttl
<=
0
)
i_ttl
=
config_GetInt
(
p_this
,
"ttl"
);
if
(
i_ttl
>
0
)
{
msg_Dbg
(
p_this
,
"failed to set ttl (%s). Let's try it "
"the integer way."
,
strerror
(
errno
)
);
unsigned
char
ttl
=
(
unsigned
char
)
i_ttl
;
/* There is some confusion in the world whether IP_MULTICAST_TTL
* takes a byte or an int as an argument.
* BSD seems to indicate byte so we are going with that and use
* int as a fallback to be safe */
if
(
setsockopt
(
i_handle
,
IPPROTO_IP
,
IP_MULTICAST_TTL
,
&
i_ttl
,
sizeof
(
i_ttl
)
)
<
0
)
&
ttl
,
sizeof
(
ttl
)
)
<
0
)
{
msg_Err
(
p_this
,
"failed to set ttl (%s)"
,
strerror
(
errno
)
);
close
(
i_handle
);
return
0
;
msg_Dbg
(
p_this
,
"failed to set ttl (%s). Let's try it "
"the integer way."
,
strerror
(
errno
)
);
if
(
setsockopt
(
i_handle
,
IPPROTO_IP
,
IP_MULTICAST_TTL
,
&
i_ttl
,
sizeof
(
i_ttl
)
)
<
0
)
{
msg_Err
(
p_this
,
"failed to set ttl (%s)"
,
strerror
(
errno
)
);
close
(
i_handle
);
return
0
;
}
}
}
}
...
...
modules/misc/network/ipv6.c
View file @
dc7dd8bf
...
...
@@ -255,7 +255,6 @@ static int OpenUDP( vlc_object_t * p_this )
}
/* Join the multicast group if the socket is a multicast address */
#if defined( WIN32 ) || defined( HAVE_IF_NAMETOINDEX )
if
(
IN6_IS_ADDR_MULTICAST
(
&
sock
.
sin6_addr
)
)
{
if
(
*
psz_server_addr
)
...
...
@@ -310,19 +309,12 @@ static int OpenUDP( vlc_object_t * p_this )
}
}
}
#else
msg_Warn
(
p_this
,
"Multicast IPv6 is not supported on your OS"
);
#endif
if
(
*
psz_server_addr
)
{
int
ttl
=
p_socket
->
i_ttl
;
if
(
ttl
<
1
)
{
if
(
ttl
<=
0
)
ttl
=
config_GetInt
(
p_this
,
"ttl"
);
}
if
(
ttl
<
1
)
ttl
=
1
;
/* Build socket for remote connection */
if
(
BuildAddr
(
p_this
,
&
sock
,
psz_server_addr
,
i_server_port
)
==
-
1
)
...
...
@@ -342,7 +334,7 @@ static int OpenUDP( vlc_object_t * p_this )
}
/* Set the time-to-live */
if
(
ttl
>
1
)
if
(
ttl
>
0
)
{
#if defined( WIN32 ) || defined( HAVE_IF_NAMETOINDEX )
if
(
IN6_IS_ADDR_MULTICAST
(
&
sock
.
sin6_addr
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment