[vlc-devel] commit: Do not refuse to open odd port number with RTP input access. ( Laurent Aimar )

git version control git at videolan.org
Sat Nov 22 14:20:56 CET 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Nov 22 14:16:54 2008 +0100| [dadedd20e5e841d6d71c71ba4b2056726517c70a] | committer: Laurent Aimar 

Do not refuse to open odd port number with RTP input access.

It is a common pratice to allows it for at least TS over RTP.
I have added an error message when using a odd port.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dadedd20e5e841d6d71c71ba4b2056726517c70a
---

 modules/access/rtp/rtp.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index 5028aa1..0fb398f 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -179,12 +179,15 @@ static int Open (vlc_object_t *obj)
     {
         case IPPROTO_UDP:
         case IPPROTO_UDPLITE:
-            fd = net_OpenDgram (obj, dhost, (dport + 1) & ~1,
-                                shost, (sport + 1) & ~1, AF_UNSPEC, tp);
+            if ((dport & 1) != 0 || (sport & 1) != 0)
+                msg_Err (obj, "Using odd port number is higly discouraged");
+
+            fd = net_OpenDgram (obj, dhost, dport,
+                                shost, sport, AF_UNSPEC, tp);
             if (fd == -1)
                 break;
-            rtcp_fd = net_OpenDgram (obj, dhost, dport | 1, shost,
-                                     sport ? (sport | 1) : 0, AF_UNSPEC, tp);
+            rtcp_fd = net_OpenDgram (obj, dhost, dport + 1, shost,
+                                     sport ? (sport + 1) : 0, AF_UNSPEC, tp);
             break;
 
          case IPPROTO_DCCP:




More information about the vlc-devel mailing list