From 262915b8c45df7ace74002e43ca5671dcfa38469 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Wed, 30 Jul 2014 18:55:35 +0300 Subject: [PATCH] Fix #258: V&V call gets rejected when IPv6 is enabled commit 1556f377ecc7c3d4887f8e9f2805a4e7f7e60660 changed the candidates list to be sorted when it is created and *NOT* sort it when it is converted to the SDP message. Unfortunately that changed the value of msg->ip in sipe_media_to_sdpmsg() [through backend_stream_to_sdpmedia() and backend_candidates_to_sdpcandidate()] in the case when an IPv6 address was assigned to the host. As the media code does not support IPv6 addresses yet, we now reject IP address strings with ":" in get_stream_ip_and_ports(). (cherry picked from commit 396613000a879625c5a836a3b5f71b8f3e20fd0a) --- src/core/sdpmsg.h | 7 ++++--- src/core/sipe-media.c | 7 +++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core/sdpmsg.h b/src/core/sdpmsg.h index 5b017d95..9732447e 100644 --- a/src/core/sdpmsg.h +++ b/src/core/sdpmsg.h @@ -3,6 +3,7 @@ * * pidgin-sipe * + * Copyright (C) 2014 SIPE Project * Copyright (C) 2010 Jakub Adam * * This program is free software; you can redistribute it and/or modify @@ -21,14 +22,14 @@ */ struct sdpmsg { - gchar *ip; + gchar *ip; /* currently this has to be an IPv4 address */ GSList *media; SipeIceVersion ice_version; }; struct sdpmedia { gchar *name; - gchar *ip; + gchar *ip; /* currently this has to be an IPv4 address */ guint port; GSList *attributes; @@ -43,7 +44,7 @@ struct sdpcandidate { SipeCandidateType type; SipeNetworkProtocol protocol; guint32 priority; - gchar *ip; + gchar *ip; /* this can be an IPv4 or IPv6 address */ guint port; gchar *base_ip; guint base_port; diff --git a/src/core/sipe-media.c b/src/core/sipe-media.c index 4f4d5fc6..7bb8bc89 100644 --- a/src/core/sipe-media.c +++ b/src/core/sipe-media.c @@ -155,9 +155,12 @@ get_stream_ip_and_ports(GSList *candidates, struct sdpcandidate *candidate = candidates->data; if (type == SIPE_CANDIDATE_TYPE_ANY || candidate->type == type) { - if (!*ip) { + if (!(*ip || + is_empty(candidate->ip) || + /* reject IPv6 addresses */ + strchr(candidate->ip, ':'))) { *ip = g_strdup(candidate->ip); - } else if (!sipe_strequal(*ip, candidate->ip)) { + } else if (!(*ip && sipe_strequal(*ip, candidate->ip))) { continue; } -- 2.11.4.GIT