Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-08-08 Thread Omid Ghaffarinia
I made it into two patches, the first one only moves
udp_set_multicast_ttl and second one does the fix.

On Fri, Aug 5, 2016 at 3:19 AM, Michael Niedermayer
 wrote:
> On Fri, Aug 05, 2016 at 01:20:12AM +0430, Omid Ghaffarinia wrote:
>> Thanks for your comment, actually 'code move' is necessary to make the
>> code compile because it is needed to use udp_set_url in
>> udp_set_multicast_ttl and the code is moved to make it possible.
>> I can make it in two separate patches if needed, first to move
>> udp_set_multicast_ttl without any further changes and then do the
>> rest, but first patch would be redundant and does not actually fix
>> anything.
>
> yes, it results in more readable commits, also gives any interrested
> developer a last chance to comment on this patch
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Republics decline into democracies and democracies degenerate into
> despotisms. -- Aristotle
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From de804bfdc336c598c91e1e687b6590e1011da7d9 Mon Sep 17 00:00:00 2001
From: Omid Ghaffarinia 
Date: Mon, 8 Aug 2016 10:23:28 +0430
Subject: [PATCH 1/2] move udp_set_multicast_ttl after udp_set_url

Signed-off-by: Omid Ghaffarinia 
---
 libavformat/udp.c |   44 ++--
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 8699c1c..48f6a6e 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -157,28 +157,6 @@ static void log_net_error(void *ctx, int level, const char* prefix)
 av_log(ctx, level, "%s: %s\n", prefix, errbuf);
 }
 
-static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
- struct sockaddr *addr)
-{
-#ifdef IP_MULTICAST_TTL
-if (addr->sa_family == AF_INET) {
-if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , sizeof(mcastTTL)) < 0) {
-log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL)");
-return -1;
-}
-}
-#endif
-#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS)
-if (addr->sa_family == AF_INET6) {
-if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, , sizeof(mcastTTL)) < 0) {
-log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS)");
-return -1;
-}
-}
-#endif
-return 0;
-}
-
 static int udp_join_multicast_group(int sockfd, struct sockaddr *addr,struct sockaddr *local_addr)
 {
 #ifdef IP_ADD_MEMBERSHIP
@@ -363,6 +341,28 @@ static int udp_set_url(URLContext *h,
 return addr_len;
 }
 
+static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
+ struct sockaddr *addr)
+{
+#ifdef IP_MULTICAST_TTL
+if (addr->sa_family == AF_INET) {
+if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, , sizeof(mcastTTL)) < 0) {
+log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_TTL)");
+return -1;
+}
+}
+#endif
+#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_HOPS)
+if (addr->sa_family == AF_INET6) {
+if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, , sizeof(mcastTTL)) < 0) {
+log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_HOPS)");
+return -1;
+}
+}
+#endif
+return 0;
+}
+
 static int udp_socket_create(URLContext *h, struct sockaddr_storage *addr,
  socklen_t *addr_len, const char *localaddr)
 {
-- 
1.7.9.5

From 7900ed3665a4c7760554c84767a05fc2c6cb074a Mon Sep 17 00:00:00 2001
From: Omid Ghaffarinia 
Date: Mon, 8 Aug 2016 10:24:42 +0430
Subject: [PATCH 2/2] Avoid sending packets to network when multicast ttl is 0
 in udp

Signed-off-by: Omid Ghaffarinia 
---
 libavformat/sdp.c |2 +-
 libavformat/udp.c |   24 
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 4e37f65..881127d 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -61,7 +61,7 @@ static void sdp_write_address(char *buff, int size, const char *dest_addr,
 if (dest_addr) {
 if (!dest_type)
 dest_type = "IP4";
-if (ttl > 0 && !strcmp(dest_type, "IP4")) {
+if (ttl >= 0 && !strcmp(dest_type, "IP4")) {
 /* The TTL should only be specified for IPv4 multicast addresses,
  * not for IPv6. */
 av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, dest_addr, ttl);
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 48f6a6e..6f79487 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -360,6 +360,27 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
 }
 }

Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-08-04 Thread Michael Niedermayer
On Fri, Aug 05, 2016 at 01:20:12AM +0430, Omid Ghaffarinia wrote:
> Thanks for your comment, actually 'code move' is necessary to make the
> code compile because it is needed to use udp_set_url in
> udp_set_multicast_ttl and the code is moved to make it possible.
> I can make it in two separate patches if needed, first to move
> udp_set_multicast_ttl without any further changes and then do the
> rest, but first patch would be redundant and does not actually fix
> anything.

yes, it results in more readable commits, also gives any interrested
developer a last chance to comment on this patch

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-08-04 Thread Omid Ghaffarinia
Thanks for your comment, actually 'code move' is necessary to make the
code compile because it is needed to use udp_set_url in
udp_set_multicast_ttl and the code is moved to make it possible.
I can make it in two separate patches if needed, first to move
udp_set_multicast_ttl without any further changes and then do the
rest, but first patch would be redundant and does not actually fix
anything.

On Wed, Aug 3, 2016 at 10:04 PM, Michael Niedermayer
 wrote:
> On Wed, Aug 03, 2016 at 12:29:17PM +0430, Omid Ghaffarinia wrote:
>> Does it still fail?
>
> no failure
>
> i would prefer if the code move would be in a seperate
> patch though. Its harder to review for developers as is
>
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-08-03 Thread Michael Niedermayer
On Wed, Aug 03, 2016 at 12:29:17PM +0430, Omid Ghaffarinia wrote:
> Does it still fail?

no failure

i would prefer if the code move would be in a seperate
patch though. Its harder to review for developers as is

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-08-03 Thread Omid Ghaffarinia
Does it still fail?

Thanks in advance.

On Sat, Jul 23, 2016 at 10:36 AM, Omid Ghaffarinia
 wrote:
> I'm sorry for that, it failed because it was prepared for release/2.8,
> this one should work on master.
>
>
> On Thu, Jul 21, 2016 at 3:48 AM, Michael Niedermayer
>  wrote:
>> On Wed, Jul 20, 2016 at 05:38:10PM +0430, Omid Ghaffarinia wrote:
>>> Thanks for testing in mingw
>>> New patch attached, which should work now.
>>
>> still fails, even on ubuntu:
>> libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
>> libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ from 
>> incompatible pointer type [enabled by default]
>> libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
>> is of type ‘struct sockaddr_storage *’
>> libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ from 
>> incompatible pointer type [enabled by default]
>> libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
>> argument is of type ‘const char *’
>> libavformat/udp.c:367:13: error: too few arguments to function ‘udp_set_url’
>> libavformat/udp.c:328:12: note: declared here
>> libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ from 
>> incompatible pointer type [enabled by default]
>> libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
>> is of type ‘struct sockaddr_storage *’
>> libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ from 
>> incompatible pointer type [enabled by default]
>> libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
>> argument is of type ‘const char *’
>> libavformat/udp.c:376:13: error: too few arguments to function ‘udp_set_url’
>> libavformat/udp.c:328:12: note: declared here
>> libavformat/udp.c: In function ‘udp_open’:
>> libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ from 
>> incompatible pointer type [enabled by default]
>> libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
>> is of type ‘struct sockaddr_storage *’
>> libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ from 
>> incompatible pointer type [enabled by default]
>> libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
>> argument is of type ‘const char *’
>> libavformat/udp.c:907:17: error: too few arguments to function ‘udp_set_url’
>> libavformat/udp.c:328:12: note: declared here
>>
>>
>> on mingw64:
>> CC  libavformat/udp.o
>> src/libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
>> src/libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ 
>> from incompatible pointer type [enabled by default]
>> src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but 
>> argument is of type ‘struct sockaddr_storage *’
>> src/libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ 
>> from incompatible pointer type [enabled by default]
>> src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
>> argument is of type ‘const char *’
>> src/libavformat/udp.c:367:13: error: too few arguments to function 
>> ‘udp_set_url’
>> src/libavformat/udp.c:328:12: note: declared here
>> src/libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ 
>> from incompatible pointer type [enabled by default]
>> src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but 
>> argument is of type ‘struct sockaddr_storage *’
>> src/libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ 
>> from incompatible pointer type [enabled by default]
>> src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
>> argument is of type ‘const char *’
>> src/libavformat/udp.c:376:13: error: too few arguments to function 
>> ‘udp_set_url’
>> src/libavformat/udp.c:328:12: note: declared here
>> src/libavformat/udp.c: In function ‘udp_open’:
>> src/libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ 
>> from incompatible pointer type [enabled by default]
>> src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but 
>> argument is of type ‘struct sockaddr_storage *’
>> src/libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ 
>> from incompatible pointer type [enabled by default]
>> src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
>> argument is of type ‘const char *’
>> src/libavformat/udp.c:907:17: error: too few arguments to function 
>> ‘udp_set_url’
>> src/libavformat/udp.c:328:12: note: declared here
>> make: *** [libavformat/udp.o] Error 1
>> make: Target `all' not remade because of errors.
>>
>> [...]
>> --
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>>
>> When the tyrant has disposed of foreign enemies by conquest or treaty, and
>> there is nothing more to fear from them, then he is always stirring up
>> some war or other, in order that 

Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-23 Thread Omid Ghaffarinia
I'm sorry for that, it failed because it was prepared for release/2.8,
this one should work on master.


On Thu, Jul 21, 2016 at 3:48 AM, Michael Niedermayer
 wrote:
> On Wed, Jul 20, 2016 at 05:38:10PM +0430, Omid Ghaffarinia wrote:
>> Thanks for testing in mingw
>> New patch attached, which should work now.
>
> still fails, even on ubuntu:
> libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
> libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ from 
> incompatible pointer type [enabled by default]
> libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
> is of type ‘struct sockaddr_storage *’
> libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ from 
> incompatible pointer type [enabled by default]
> libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
> argument is of type ‘const char *’
> libavformat/udp.c:367:13: error: too few arguments to function ‘udp_set_url’
> libavformat/udp.c:328:12: note: declared here
> libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ from 
> incompatible pointer type [enabled by default]
> libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
> is of type ‘struct sockaddr_storage *’
> libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ from 
> incompatible pointer type [enabled by default]
> libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
> argument is of type ‘const char *’
> libavformat/udp.c:376:13: error: too few arguments to function ‘udp_set_url’
> libavformat/udp.c:328:12: note: declared here
> libavformat/udp.c: In function ‘udp_open’:
> libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ from 
> incompatible pointer type [enabled by default]
> libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
> is of type ‘struct sockaddr_storage *’
> libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ from 
> incompatible pointer type [enabled by default]
> libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
> argument is of type ‘const char *’
> libavformat/udp.c:907:17: error: too few arguments to function ‘udp_set_url’
> libavformat/udp.c:328:12: note: declared here
>
>
> on mingw64:
> CC  libavformat/udp.o
> src/libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
> src/libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ 
> from incompatible pointer type [enabled by default]
> src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but 
> argument is of type ‘struct sockaddr_storage *’
> src/libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ 
> from incompatible pointer type [enabled by default]
> src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
> argument is of type ‘const char *’
> src/libavformat/udp.c:367:13: error: too few arguments to function 
> ‘udp_set_url’
> src/libavformat/udp.c:328:12: note: declared here
> src/libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ 
> from incompatible pointer type [enabled by default]
> src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but 
> argument is of type ‘struct sockaddr_storage *’
> src/libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ 
> from incompatible pointer type [enabled by default]
> src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
> argument is of type ‘const char *’
> src/libavformat/udp.c:376:13: error: too few arguments to function 
> ‘udp_set_url’
> src/libavformat/udp.c:328:12: note: declared here
> src/libavformat/udp.c: In function ‘udp_open’:
> src/libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ 
> from incompatible pointer type [enabled by default]
> src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but 
> argument is of type ‘struct sockaddr_storage *’
> src/libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ 
> from incompatible pointer type [enabled by default]
> src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
> argument is of type ‘const char *’
> src/libavformat/udp.c:907:17: error: too few arguments to function 
> ‘udp_set_url’
> src/libavformat/udp.c:328:12: note: declared here
> make: *** [libavformat/udp.o] Error 1
> make: Target `all' not remade because of errors.
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> When the tyrant has disposed of foreign enemies by conquest or treaty, and
> there is nothing more to fear from them, then he is always stirring up
> some war or other, in order that the people may require a leader. -- Plato
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
From 

Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 20, 2016 at 05:38:10PM +0430, Omid Ghaffarinia wrote:
> Thanks for testing in mingw
> New patch attached, which should work now.

still fails, even on ubuntu:
libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument is 
of type ‘struct sockaddr_storage *’
libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
libavformat/udp.c:367:13: error: too few arguments to function ‘udp_set_url’
libavformat/udp.c:328:12: note: declared here
libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument is 
of type ‘struct sockaddr_storage *’
libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
libavformat/udp.c:376:13: error: too few arguments to function ‘udp_set_url’
libavformat/udp.c:328:12: note: declared here
libavformat/udp.c: In function ‘udp_open’:
libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument is 
of type ‘struct sockaddr_storage *’
libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
libavformat/udp.c:907:17: error: too few arguments to function ‘udp_set_url’
libavformat/udp.c:328:12: note: declared here


on mingw64:
CC  libavformat/udp.o
src/libavformat/udp.c: In function ‘udp_set_multicast_ttl’:
src/libavformat/udp.c:367:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
is of type ‘struct sockaddr_storage *’
src/libavformat/udp.c:367:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
src/libavformat/udp.c:367:13: error: too few arguments to function ‘udp_set_url’
src/libavformat/udp.c:328:12: note: declared here
src/libavformat/udp.c:376:13: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
is of type ‘struct sockaddr_storage *’
src/libavformat/udp.c:376:13: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
src/libavformat/udp.c:376:13: error: too few arguments to function ‘udp_set_url’
src/libavformat/udp.c:328:12: note: declared here
src/libavformat/udp.c: In function ‘udp_open’:
src/libavformat/udp.c:907:17: warning: passing argument 1 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct URLContext *’ but argument 
is of type ‘struct sockaddr_storage *’
src/libavformat/udp.c:907:17: warning: passing argument 2 of ‘udp_set_url’ from 
incompatible pointer type [enabled by default]
src/libavformat/udp.c:328:12: note: expected ‘struct sockaddr_storage *’ but 
argument is of type ‘const char *’
src/libavformat/udp.c:907:17: error: too few arguments to function ‘udp_set_url’
src/libavformat/udp.c:328:12: note: declared here
make: *** [libavformat/udp.o] Error 1
make: Target `all' not remade because of errors.

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-20 Thread Omid Ghaffarinia
Thanks for testing in mingw
New patch attached, which should work now.


On Wed, Jul 20, 2016 at 1:25 PM, Michael Niedermayer
 wrote:
> On Wed, Jul 13, 2016 at 03:09:28PM +0430, Omid Ghaffarinia wrote:
>> I attached the patch.
>>
>> The actual bug is, when creating a local multicast stream (i.e. giving
>> "rtp://224.1.1.1:1?ttl=0" to avio_open), then you can see the
>> packets on the network and not just on local machine (despite setting
>> multicast ttl to 0) which was a security bug in my purpose of usage
>> (it also made a lot of unused traffic on network)
>>
>> The user does not choose to enable/disable the kernel hack, that is
>> how it is designed.
>>
>> This behavior does NOT happen in Windows machines, but the patch given
>> does no harm at all (it does nothing in Windows)
>>
>> On Wed, Jul 13, 2016 at 3:12 AM, Moritz Barsnick  wrote:
>> > On Tue, Jul 12, 2016 at 18:31:36 +0430, Omid Ghaffarinia wrote:
>> >
>> > Your mailer has broken the patch by inserting line breaks. You should
>> > try attaching the patch as a file, or directly using "git send-email".
>> >
>> >> Bug is due to kernel handling multicast ttl 0 differently (as noted in
>> >> kernel code net/ipv4/route.c:2191 see:
>> >
>> > ffmpeg is not a Linux-only tool/library, so comments should point out
>> > which "kernel" more precisely (and possibly which versions this applies
>> > to). Admitted, the link to github contains the string "linux". ;-)
>> >
>> > Furthermore: Please explain what the actual bug (i.e. misbehavior) is,
>> > and what this fix changes (or how it fixes it).
>> >
>> > Are you allowing ffmpeg to work when the user is making use of the
>> > kernel hack?
>> >
>> > What does this patch achieve on non-Linux operating systems?
>> >
>> > (Sorry for the stupid questions, all this isn't obvious to me, and I do
>> > have at least some understanding of network stuff.)
>> >
>> > Moritz
>> > ___
>> > ffmpeg-devel mailing list
>> > ffmpeg-devel@ffmpeg.org
>> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>>  sdp.c |2 +-
>>  udp.c |   28 
>>  2 files changed, 29 insertions(+), 1 deletion(-)
>> 697cb044e811d35b10a74ad9ca9181b372affc40  
>> 0001-Avoid-sending-packets-to-network-when-multicast-ttl-.patch
>> From aab1658d011f5b3eabd22ddc30f40107c6311c92 Mon Sep 17 00:00:00 2001
>> From: Omid Ghaffarinia 
>> Date: Tue, 12 Jul 2016 18:23:57 +0430
>> Subject: [PATCH] Avoid sending packets to network when multicast ttl is 0 in
>>  udp
>>
>> Signed-off-by: Omid Ghaffarinia 
>> ---
>>  libavformat/sdp.c |2 +-
>>  libavformat/udp.c |   28 
>>  2 files changed, 29 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/sdp.c b/libavformat/sdp.c
>> index 01b564b..0401f7a 100644
>> --- a/libavformat/sdp.c
>> +++ b/libavformat/sdp.c
>> @@ -61,7 +61,7 @@ static void sdp_write_address(char *buff, int size, const 
>> char *dest_addr,
>>  if (dest_addr) {
>>  if (!dest_type)
>>  dest_type = "IP4";
>> -if (ttl > 0 && !strcmp(dest_type, "IP4")) {
>> +if (ttl >= 0 && !strcmp(dest_type, "IP4")) {
>>  /* The TTL should only be specified for IPv4 multicast 
>> addresses,
>>   * not for IPv6. */
>>  av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, 
>> dest_addr, ttl);
>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>> index 8699c1c..fe46ba5 100644
>> --- a/libavformat/udp.c
>> +++ b/libavformat/udp.c
>> @@ -176,6 +176,28 @@ static int udp_set_multicast_ttl(int sockfd, int 
>> mcastTTL,
>>  }
>>  }
>>  #endif
>> +if (mcastTTL == 0) {
>> +#ifdef IP_MULTICAST_IF
>> +if (addr->sa_family == AF_INET) {
>> +struct in_addr localhost_addr;
>> +inet_pton(AF_INET, "127.0.0.1", _addr);
>> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, 
>> _addr, sizeof(localhost_addr)) < 0) {
>> +log_net_error(NULL, AV_LOG_ERROR, 
>> "setsockopt(IP_MULTICAST_IF)");
>> +return -1;
>> +}
>> +}
>> +#endif
>> +#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_IF)
>> +if (addr->sa_family == AF_INET6) {
>> +struct in6_addr localhost_addr;
>> +inet_pton(AF_INET6, "::1", _addr);
>> +if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF, 
>> _addr, sizeof(localhost_addr)) < 0) {
>> +log_net_error(NULL, AV_LOG_ERROR, 
>> "setsockopt(IPV6_MULTICAST_IF)");
>> +return -1;
>> +}
>> +}
>> +#endif
>
> breaks build with mingw64
> libavformat/udp.c:183:13: error: implicit declaration of function ‘inet_pton’ 
> [-Werror=implicit-function-declaration]
>
>
>> +}
>>  return 0;
>>  }
>>
>> @@ -882,6 +904,12 @@ static int udp_open(URLContext *h, const char *uri, int 
>> flags)
>>  

Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-20 Thread Michael Niedermayer
On Wed, Jul 13, 2016 at 03:09:28PM +0430, Omid Ghaffarinia wrote:
> I attached the patch.
> 
> The actual bug is, when creating a local multicast stream (i.e. giving
> "rtp://224.1.1.1:1?ttl=0" to avio_open), then you can see the
> packets on the network and not just on local machine (despite setting
> multicast ttl to 0) which was a security bug in my purpose of usage
> (it also made a lot of unused traffic on network)
> 
> The user does not choose to enable/disable the kernel hack, that is
> how it is designed.
> 
> This behavior does NOT happen in Windows machines, but the patch given
> does no harm at all (it does nothing in Windows)
> 
> On Wed, Jul 13, 2016 at 3:12 AM, Moritz Barsnick  wrote:
> > On Tue, Jul 12, 2016 at 18:31:36 +0430, Omid Ghaffarinia wrote:
> >
> > Your mailer has broken the patch by inserting line breaks. You should
> > try attaching the patch as a file, or directly using "git send-email".
> >
> >> Bug is due to kernel handling multicast ttl 0 differently (as noted in
> >> kernel code net/ipv4/route.c:2191 see:
> >
> > ffmpeg is not a Linux-only tool/library, so comments should point out
> > which "kernel" more precisely (and possibly which versions this applies
> > to). Admitted, the link to github contains the string "linux". ;-)
> >
> > Furthermore: Please explain what the actual bug (i.e. misbehavior) is,
> > and what this fix changes (or how it fixes it).
> >
> > Are you allowing ffmpeg to work when the user is making use of the
> > kernel hack?
> >
> > What does this patch achieve on non-Linux operating systems?
> >
> > (Sorry for the stupid questions, all this isn't obvious to me, and I do
> > have at least some understanding of network stuff.)
> >
> > Moritz
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

>  sdp.c |2 +-
>  udp.c |   28 
>  2 files changed, 29 insertions(+), 1 deletion(-)
> 697cb044e811d35b10a74ad9ca9181b372affc40  
> 0001-Avoid-sending-packets-to-network-when-multicast-ttl-.patch
> From aab1658d011f5b3eabd22ddc30f40107c6311c92 Mon Sep 17 00:00:00 2001
> From: Omid Ghaffarinia 
> Date: Tue, 12 Jul 2016 18:23:57 +0430
> Subject: [PATCH] Avoid sending packets to network when multicast ttl is 0 in
>  udp
> 
> Signed-off-by: Omid Ghaffarinia 
> ---
>  libavformat/sdp.c |2 +-
>  libavformat/udp.c |   28 
>  2 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/sdp.c b/libavformat/sdp.c
> index 01b564b..0401f7a 100644
> --- a/libavformat/sdp.c
> +++ b/libavformat/sdp.c
> @@ -61,7 +61,7 @@ static void sdp_write_address(char *buff, int size, const 
> char *dest_addr,
>  if (dest_addr) {
>  if (!dest_type)
>  dest_type = "IP4";
> -if (ttl > 0 && !strcmp(dest_type, "IP4")) {
> +if (ttl >= 0 && !strcmp(dest_type, "IP4")) {
>  /* The TTL should only be specified for IPv4 multicast addresses,
>   * not for IPv6. */
>  av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, 
> dest_addr, ttl);
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 8699c1c..fe46ba5 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -176,6 +176,28 @@ static int udp_set_multicast_ttl(int sockfd, int 
> mcastTTL,
>  }
>  }
>  #endif
> +if (mcastTTL == 0) {
> +#ifdef IP_MULTICAST_IF
> +if (addr->sa_family == AF_INET) {
> +struct in_addr localhost_addr;
> +inet_pton(AF_INET, "127.0.0.1", _addr);
> +if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, 
> _addr, sizeof(localhost_addr)) < 0) {
> +log_net_error(NULL, AV_LOG_ERROR, 
> "setsockopt(IP_MULTICAST_IF)");
> +return -1;
> +}
> +}
> +#endif
> +#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_IF)
> +if (addr->sa_family == AF_INET6) {
> +struct in6_addr localhost_addr;
> +inet_pton(AF_INET6, "::1", _addr);
> +if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF, 
> _addr, sizeof(localhost_addr)) < 0) {
> +log_net_error(NULL, AV_LOG_ERROR, 
> "setsockopt(IPV6_MULTICAST_IF)");
> +return -1;
> +}
> +}
> +#endif

breaks build with mingw64
libavformat/udp.c:183:13: error: implicit declaration of function ‘inet_pton’ 
[-Werror=implicit-function-declaration]


> +}
>  return 0;
>  }
>  
> @@ -882,6 +904,12 @@ static int udp_open(URLContext *h, const char *uri, int 
> flags)
>  }
>  if (h->flags & AVIO_FLAG_READ) {
>  /* input */
> + if (s->ttl == 0) {
> + if (s->dest_addr.ss_family == AF_INET)
> + inet_pton(AF_INET, "127.0.0.1", &((struct sockaddr_in 
> *)>local_addr_storage)->sin_addr);
> + 

Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-19 Thread Omid Ghaffarinia
Is the patch approved or does it need more explanation?

On Wed, Jul 13, 2016 at 3:09 PM, Omid Ghaffarinia
 wrote:
> I attached the patch.
>
> The actual bug is, when creating a local multicast stream (i.e. giving
> "rtp://224.1.1.1:1?ttl=0" to avio_open), then you can see the
> packets on the network and not just on local machine (despite setting
> multicast ttl to 0) which was a security bug in my purpose of usage
> (it also made a lot of unused traffic on network)
>
> The user does not choose to enable/disable the kernel hack, that is
> how it is designed.
>
> This behavior does NOT happen in Windows machines, but the patch given
> does no harm at all (it does nothing in Windows)
>
> On Wed, Jul 13, 2016 at 3:12 AM, Moritz Barsnick  wrote:
>> On Tue, Jul 12, 2016 at 18:31:36 +0430, Omid Ghaffarinia wrote:
>>
>> Your mailer has broken the patch by inserting line breaks. You should
>> try attaching the patch as a file, or directly using "git send-email".
>>
>>> Bug is due to kernel handling multicast ttl 0 differently (as noted in
>>> kernel code net/ipv4/route.c:2191 see:
>>
>> ffmpeg is not a Linux-only tool/library, so comments should point out
>> which "kernel" more precisely (and possibly which versions this applies
>> to). Admitted, the link to github contains the string "linux". ;-)
>>
>> Furthermore: Please explain what the actual bug (i.e. misbehavior) is,
>> and what this fix changes (or how it fixes it).
>>
>> Are you allowing ffmpeg to work when the user is making use of the
>> kernel hack?
>>
>> What does this patch achieve on non-Linux operating systems?
>>
>> (Sorry for the stupid questions, all this isn't obvious to me, and I do
>> have at least some understanding of network stuff.)
>>
>> Moritz
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-13 Thread Omid Ghaffarinia
I attached the patch.

The actual bug is, when creating a local multicast stream (i.e. giving
"rtp://224.1.1.1:1?ttl=0" to avio_open), then you can see the
packets on the network and not just on local machine (despite setting
multicast ttl to 0) which was a security bug in my purpose of usage
(it also made a lot of unused traffic on network)

The user does not choose to enable/disable the kernel hack, that is
how it is designed.

This behavior does NOT happen in Windows machines, but the patch given
does no harm at all (it does nothing in Windows)

On Wed, Jul 13, 2016 at 3:12 AM, Moritz Barsnick  wrote:
> On Tue, Jul 12, 2016 at 18:31:36 +0430, Omid Ghaffarinia wrote:
>
> Your mailer has broken the patch by inserting line breaks. You should
> try attaching the patch as a file, or directly using "git send-email".
>
>> Bug is due to kernel handling multicast ttl 0 differently (as noted in
>> kernel code net/ipv4/route.c:2191 see:
>
> ffmpeg is not a Linux-only tool/library, so comments should point out
> which "kernel" more precisely (and possibly which versions this applies
> to). Admitted, the link to github contains the string "linux". ;-)
>
> Furthermore: Please explain what the actual bug (i.e. misbehavior) is,
> and what this fix changes (or how it fixes it).
>
> Are you allowing ffmpeg to work when the user is making use of the
> kernel hack?
>
> What does this patch achieve on non-Linux operating systems?
>
> (Sorry for the stupid questions, all this isn't obvious to me, and I do
> have at least some understanding of network stuff.)
>
> Moritz
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From aab1658d011f5b3eabd22ddc30f40107c6311c92 Mon Sep 17 00:00:00 2001
From: Omid Ghaffarinia 
Date: Tue, 12 Jul 2016 18:23:57 +0430
Subject: [PATCH] Avoid sending packets to network when multicast ttl is 0 in
 udp

Signed-off-by: Omid Ghaffarinia 
---
 libavformat/sdp.c |2 +-
 libavformat/udp.c |   28 
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 01b564b..0401f7a 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -61,7 +61,7 @@ static void sdp_write_address(char *buff, int size, const char *dest_addr,
 if (dest_addr) {
 if (!dest_type)
 dest_type = "IP4";
-if (ttl > 0 && !strcmp(dest_type, "IP4")) {
+if (ttl >= 0 && !strcmp(dest_type, "IP4")) {
 /* The TTL should only be specified for IPv4 multicast addresses,
  * not for IPv6. */
 av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type, dest_addr, ttl);
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 8699c1c..fe46ba5 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -176,6 +176,28 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
 }
 }
 #endif
+if (mcastTTL == 0) {
+#ifdef IP_MULTICAST_IF
+if (addr->sa_family == AF_INET) {
+struct in_addr localhost_addr;
+inet_pton(AF_INET, "127.0.0.1", _addr);
+if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, _addr, sizeof(localhost_addr)) < 0) {
+log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_MULTICAST_IF)");
+return -1;
+}
+}
+#endif
+#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_IF)
+if (addr->sa_family == AF_INET6) {
+struct in6_addr localhost_addr;
+inet_pton(AF_INET6, "::1", _addr);
+if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF, _addr, sizeof(localhost_addr)) < 0) {
+log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IPV6_MULTICAST_IF)");
+return -1;
+}
+}
+#endif
+}
 return 0;
 }
 
@@ -882,6 +904,12 @@ static int udp_open(URLContext *h, const char *uri, int flags)
 }
 if (h->flags & AVIO_FLAG_READ) {
 /* input */
+	if (s->ttl == 0) {
+	if (s->dest_addr.ss_family == AF_INET)
+		inet_pton(AF_INET, "127.0.0.1", &((struct sockaddr_in *)>local_addr_storage)->sin_addr);
+	else
+		inet_pton(AF_INET6, "::1", &((struct sockaddr_in6 *)>local_addr_storage)->sin6_addr);
+	}
 if (num_include_sources && num_exclude_sources) {
 av_log(h, AV_LOG_ERROR, "Simultaneously including and excluding multicast sources is not supported\n");
 goto fail;
-- 
1.7.9.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-12 Thread Moritz Barsnick
On Tue, Jul 12, 2016 at 18:31:36 +0430, Omid Ghaffarinia wrote:

Your mailer has broken the patch by inserting line breaks. You should
try attaching the patch as a file, or directly using "git send-email".

> Bug is due to kernel handling multicast ttl 0 differently (as noted in
> kernel code net/ipv4/route.c:2191 see:

ffmpeg is not a Linux-only tool/library, so comments should point out
which "kernel" more precisely (and possibly which versions this applies
to). Admitted, the link to github contains the string "linux". ;-)

Furthermore: Please explain what the actual bug (i.e. misbehavior) is,
and what this fix changes (or how it fixes it). 

Are you allowing ffmpeg to work when the user is making use of the
kernel hack?

What does this patch achieve on non-Linux operating systems?

(Sorry for the stupid questions, all this isn't obvious to me, and I do
have at least some understanding of network stuff.)

Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Avoid sending packets to network when multicast ttl is 0 in udp

2016-07-12 Thread Omid Ghaffarinia
When using ffmpeg to start a local-only server (i.e. setting ttl=0)
using multicast ip (i.e. 224.1.1.1) you can see packets going to
network.
Bug is due to kernel handling multicast ttl 0 differently (as noted in
kernel code net/ipv4/route.c:2191 see:
https://github.com/torvalds/linux/blob/master/net/ipv4/route.c )
/* Special hack: user can direct multicasts
   and limited broadcast via necessary interface
   without fiddling with IP_MULTICAST_IF or IP_PKTINFO.
   This hack is not just for fun, it allows
   vic,vat and friends to work.
   They bind socket to loopback, set ttl to zero
   and expect that it will work.
   From the viewpoint of routing cache they are broken,
   because we are not allowed to build multicast path
   with loopback source addr (look, routing cache
   cannot know, that ttl is zero, so that packet
   will not leave this host and route is valid).
   Luckily, this hack is good workaround.
 */


Signed-off-by: Omid Ghaffarinia 
---
 libavformat/sdp.c |2 +-
 libavformat/udp.c |   28 
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 01b564b..0401f7a 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -61,7 +61,7 @@ static void sdp_write_address(char *buff, int size,
const char *dest_addr,
 if (dest_addr) {
 if (!dest_type)
 dest_type = "IP4";
-if (ttl > 0 && !strcmp(dest_type, "IP4")) {
+if (ttl >= 0 && !strcmp(dest_type, "IP4")) {
 /* The TTL should only be specified for IPv4 multicast addresses,
  * not for IPv6. */
 av_strlcatf(buff, size, "c=IN %s %s/%d\r\n", dest_type,
dest_addr, ttl);
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 8699c1c..fe46ba5 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -176,6 +176,28 @@ static int udp_set_multicast_ttl(int sockfd, int mcastTTL,
 }
 }
 #endif
+if (mcastTTL == 0) {
+#ifdef IP_MULTICAST_IF
+if (addr->sa_family == AF_INET) {
+struct in_addr localhost_addr;
+inet_pton(AF_INET, "127.0.0.1", _addr);
+if (setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF,
_addr, sizeof(localhost_addr)) < 0) {
+log_net_error(NULL, AV_LOG_ERROR,
"setsockopt(IP_MULTICAST_IF)");
+return -1;
+}
+}
+#endif
+#if defined(IPPROTO_IPV6) && defined(IPV6_MULTICAST_IF)
+if (addr->sa_family == AF_INET6) {
+struct in6_addr localhost_addr;
+inet_pton(AF_INET6, "::1", _addr);
+if (setsockopt(sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF,
_addr, sizeof(localhost_addr)) < 0) {
+log_net_error(NULL, AV_LOG_ERROR,
"setsockopt(IPV6_MULTICAST_IF)");
+return -1;
+}
+}
+#endif
+}
 return 0;
 }

@@ -882,6 +904,12 @@ static int udp_open(URLContext *h, const char
*uri, int flags)
 }
 if (h->flags & AVIO_FLAG_READ) {
 /* input */
+if (s->ttl == 0) {
+if (s->dest_addr.ss_family == AF_INET)
+inet_pton(AF_INET, "127.0.0.1", &((struct
sockaddr_in *)>local_addr_storage)->sin_addr);
+else
+inet_pton(AF_INET6, "::1", &((struct sockaddr_in6
*)>local_addr_storage)->sin6_addr);
+}
 if (num_include_sources && num_exclude_sources) {
 av_log(h, AV_LOG_ERROR, "Simultaneously including and
excluding multicast sources is not supported\n");
 goto fail;
-- 
1.7.9.5
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel