Bug#884249: ring: FTBFS against upnp 1.8

Uwe Kleine-König uwe at kleine-koenig.org
Tue Dec 19 21:52:36 UTC 2017


Control: tag -1 + patch

Hello,

On Tue, Dec 12, 2017 at 10:17:27PM +0100, Sebastian Ramacher wrote:
> Source: ring
> Version: 20171129.2.cf5bbff~ds1-1
> Severity: important
> Tags: sid buster
> 
> ring FTBFS against upnp 1.8 (available in experimental)
> | ../../doltlibtool  --tag=CXX   --mode=compile g++-6 -DHAVE_CONFIG_H -I. -I../..  -I/<<PKGBUILDDIR>>/daemon/src -I/<<PKGBUILDDIR>>/daemon/src/config -I/<<PKGBUILDDIR>>/daemon/src/media -I/<<PKGBUILDDIR>>/daemon/test -I/<<PKGBUILDDIR>>/daemon/src/dring  -DPREFIX=\"/usr\" -DPROGSHAREDIR=\"/usr/share/ring\" -DENABLE_TRACE -DRING_REVISION=\"\" -DRING_DIRTY_REPO=\"dirty\" -DPJSIP_MAX_PKT_LEN=8000 -DPJ_AUTOCONF=1 -DHAVE_SPEEX_CODEC -DHAVE_GSM_CODEC -DHAVE_OPUS -Wdate-time -D_FORTIFY_SOURCE=2 -I/<<PKGBUILDDIR>>/daemon/contrib/x86_64-linux-gnu/include -I./ -I../ -DPREFIX=\"/usr\" -DPROGSHAREDIR=\"/usr/share/ring\" -g -O2 -fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat -Werror=format-security -DMSGPACK_DEFAULT_API_VERSION=1 -DPJ_AUTOCONF=1  -I/<<PKGBUILDDIR>>/daemon/contrib/x86_64-linux-gnu/include -MT libclient_la-videomanager.lo -MD -MP -MF .deps/libclient_la-videomanager.Tpo -c -o libclient_la-videomanager.lo `test -f 'videomanager.cpp' || echo './'`videomanager.cpp
> | In file included from configurationmanager.cpp:43:0:
> | /<<PKGBUILDDIR>>/daemon/src/upnp/upnp_context.h:225:48: error: 'Upnp_Discovery' does not name a type
> |      void parseDevice(IXML_Document* doc, const Upnp_Discovery* d_event);
> |                                                 ^~~~~~~~~~~~~~
> | /<<PKGBUILDDIR>>/daemon/src/upnp/upnp_context.h:227:45: error: 'Upnp_Discovery' does not name a type
> |      void parseIGD(IXML_Document* doc, const Upnp_Discovery* d_event);
> |                                              ^~~~~~~~~~~~~~
> | Makefile:550: recipe for target 'libclient_la-configurationmanager.lo' failed
> | make[5]: *** [libclient_la-configurationmanager.lo] Error 1
> 
> Full log at
> https://people.debian.org/~sramacher/logs/upnp/ring_amd64-2017-12-12T20:48:40Z.log

the patch below makes ring build against both libupnp-dev/unstable (using
libupnp 1.6) and libupnp-dev/experimental (using libupnp 1.8). Note I
didn't do any runtime tests and for libupnp6 it depends on libupnp-dev
1.6.24-3 because on the earlier revisions the used compat code was
broken and incomplete.

Best regards
Uwe

diff --git a/debian/control b/debian/control
index fb3c582bf2ec..8b79b341f8f2 100644
--- a/debian/control
+++ b/debian/control
@@ -29,7 +29,7 @@ Build-Depends: debhelper (>= 9),
 # ring-daemon
                libdbus-1-dev,
                libdbus-c++-dev,
-               libupnp-dev,
+               libupnp-dev (>= 1.6.24-3~),
                libgnutls28-dev (>= 3.4.14),
                libpulse-dev,
                libasound2-dev,
diff --git a/debian/patches/libupnp1.8.patch b/debian/patches/libupnp1.8.patch
new file mode 100644
index 000000000000..2d70866d8627
--- /dev/null
+++ b/debian/patches/libupnp1.8.patch
@@ -0,0 +1,187 @@
+--- a/daemon/src/upnp/upnp_context.cpp
++++ b/daemon/src/upnp/upnp_context.cpp
+@@ -709,7 +709,7 @@
+  * relevant lists
+  */
+ void
+-UPnPContext::parseDevice(IXML_Document* doc, const Upnp_Discovery* d_event)
++UPnPContext::parseDevice(IXML_Document* doc, const UpnpDiscovery* d_event)
+ {
+     if (not doc or not d_event)
+         return;
+@@ -729,7 +729,7 @@
+ }
+ 
+ void
+-UPnPContext::parseIGD(IXML_Document* doc, const Upnp_Discovery* d_event)
++UPnPContext::parseIGD(IXML_Document* doc, const UpnpDiscovery* d_event)
+ {
+     if (not doc or not d_event)
+         return;
+@@ -766,7 +766,7 @@
+     std::string baseURL = get_first_doc_item(doc, "URLBase");
+     if (baseURL.empty()) {
+         /* get it from the discovery event location */
+-        baseURL = std::string(d_event->Location);
++        baseURL = std::string(UpnpDiscovery_get_Location_cstr(d_event));
+     }
+ 
+     /* check if its a valid IGD:
+@@ -925,7 +925,7 @@
+ }
+ 
+ int
+-UPnPContext::cp_callback(Upnp_EventType event_type, void* event, void* user_data)
++UPnPContext::cp_callback(Upnp_EventType event_type, const void* event, void* user_data)
+ {
+     if (auto upnpContext = static_cast<UPnPContext*>(user_data))
+         return upnpContext->handleUPnPEvents(event_type, event);
+@@ -935,7 +935,7 @@
+ }
+ 
+ int
+-UPnPContext::handleUPnPEvents(Upnp_EventType event_type, void* event)
++UPnPContext::handleUPnPEvents(Upnp_EventType event_type, const void* event)
+ {
+     switch( event_type )
+     {
+@@ -943,7 +943,7 @@
+         /* RING_DBG("UPnP: CP received a discovery advertisement"); */
+     case UPNP_DISCOVERY_SEARCH_RESULT:
+     {
+-        struct Upnp_Discovery* d_event = ( struct Upnp_Discovery* )event;
++        const UpnpDiscovery* d_event = ( const UpnpDiscovery* )event;
+         std::unique_ptr<IXML_Document, decltype(ixmlDocument_free)&> desc_doc(nullptr, ixmlDocument_free);
+         int upnp_err;
+ 
+@@ -952,18 +952,18 @@
+ 
+         /* check if we are already in the process of checking this device */
+         std::unique_lock<std::mutex> lock(cpDeviceMutex_);
+-        auto it = cpDevices_.find(std::string(d_event->Location));
++        auto it = cpDevices_.find(std::string(UpnpDiscovery_get_Location_cstr(d_event)));
+ 
+         if (it == cpDevices_.end()) {
+-            cpDevices_.emplace(std::string(d_event->Location));
++            cpDevices_.emplace(std::string(UpnpDiscovery_get_Location_cstr(d_event)));
+             lock.unlock();
+ 
+-            if (d_event->ErrCode != UPNP_E_SUCCESS)
++            if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS)
+                 RING_WARN("UPnP: Error in discovery event received by the CP: %s",
+-                          UpnpGetErrorMessage(d_event->ErrCode));
++                          UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(d_event)));
+ 
+             /* RING_DBG("UPnP: Control Point received discovery event from device:\n\tid: %s\n\ttype: %s\n\tservice: %s\n\tversion: %s\n\tlocation: %s\n\tOS: %s",
+-                     d_event->DeviceId, d_event->DeviceType, d_event->ServiceType, d_event->ServiceVer, d_event->Location, d_event->Os);
++                     d_event->DeviceId, d_event->DeviceType, d_event->ServiceType, d_event->ServiceVer, UpnpDiscovery_get_Location_cstr(d_event), d_event->Os);
+             */
+ 
+             /* note: this thing will block until success for the system socket timeout
+@@ -971,7 +971,7 @@
+              *       in which case it will block for the libupnp specified timeout
+              */
+             IXML_Document* desc_doc_ptr = nullptr;
+-            upnp_err = UpnpDownloadXmlDoc( d_event->Location, &desc_doc_ptr);
++            upnp_err = UpnpDownloadXmlDoc( UpnpDiscovery_get_Location_cstr(d_event), &desc_doc_ptr);
+             desc_doc.reset(desc_doc_ptr);
+             if ( upnp_err != UPNP_E_SUCCESS ) {
+                 /* the download of the xml doc has failed; this probably happened
+@@ -990,7 +990,7 @@
+              * eg: if we switch routers or if a new device with the same IP appears
+              */
+             lock.lock();
+-            cpDevices_.erase(d_event->Location);
++            cpDevices_.erase(UpnpDiscovery_get_Location_cstr(d_event));
+             lock.unlock();
+         } else {
+             lock.unlock();
+@@ -1001,13 +1001,14 @@
+ 
+     case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
+     {
+-        struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)event;
++        const UpnpDiscovery *d_event = (const UpnpDiscovery *)event;
+ 
+-        RING_DBG("UPnP: Control Point received ByeBye for device: %s", d_event->DeviceId);
++        RING_DBG("UPnP: Control Point received ByeBye for device: %s",
++		 UpnpDiscovery_get_DeviceID_cstr(d_event));
+ 
+-        if (d_event->ErrCode != UPNP_E_SUCCESS)
++        if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS)
+             RING_WARN("UPnP: Error in ByeBye received by the CP: %s",
+-                      UpnpGetErrorMessage(d_event->ErrCode));
++                      UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(d_event)));
+ 
+         /* TODO: check if its a device we care about and remove it from the relevant lists */
+     }
+@@ -1053,13 +1054,13 @@
+ 
+     case UPNP_CONTROL_ACTION_COMPLETE:
+     {
+-        struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)event;
++        const UpnpActionComplete *a_event = (const UpnpActionComplete *)event;
+ 
+         /* RING_DBG("UPnP: Control Point async action complete"); */
+ 
+-        if (a_event->ErrCode != UPNP_E_SUCCESS)
++        if (UpnpActionComplete_get_ErrCode(a_event) != UPNP_E_SUCCESS)
+             RING_WARN("UPnP: Error in action complete event: %s",
+-                      UpnpGetErrorMessage(a_event->ErrCode));
++                      UpnpGetErrorMessage(UpnpActionComplete_get_ErrCode(a_event)));
+ 
+         /* TODO: no need for any processing here, just print out results.
+          * Service state table updates are handled by events. */
+@@ -1068,13 +1069,13 @@
+ 
+     case UPNP_CONTROL_GET_VAR_COMPLETE:
+     {
+-        struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)event;
++        const UpnpStateVarComplete *sv_event = (const UpnpStateVarComplete *)event;
+ 
+         /* RING_DBG("UPnP: Control Point async get variable complete"); */
+ 
+-        if (sv_event->ErrCode != UPNP_E_SUCCESS)
++        if (UpnpStateVarComplete_get_ErrCode(sv_event) != UPNP_E_SUCCESS)
+             RING_WARN("UPnP: Error in get variable complete event: %s",
+-                      UpnpGetErrorMessage(sv_event->ErrCode));
++                      UpnpGetErrorMessage(UpnpStateVarComplete_get_ErrCode(sv_event)));
+ 
+         /* TODO: update state variables */
+     }
+--- a/daemon/src/upnp/upnp_context.h
++++ b/daemon/src/upnp/upnp_context.h
+@@ -206,13 +206,19 @@
+      */
+     bool deviceRegistered_ {false};
+ 
+-    static int cp_callback(Upnp_EventType event_type, void* event, void* user_data);
++    static int cp_callback(Upnp_EventType event_type, const void* event, void* user_data);
++
++#if UPNP_VERSION < 10800
++    static inline int cp_callback(Upnp_EventType event_type, void* event, void* user_data) {
++	    return cp_callback(event_type, (const void*)event, user_data);
++    };
++#endif
+ 
+     /**
+      * callback function for the UPnP client (control point)
+      * all UPnP events received by the client are processed here
+      */
+-    int handleUPnPEvents(Upnp_EventType event_type, void* event);
++    int handleUPnPEvents(Upnp_EventType event_type, const void* event);
+ 
+ 
+     /* sends out async search for IGD */
+@@ -222,9 +228,9 @@
+      * Parses the device description and adds desired devices to
+      * relevant lists
+      */
+-    void parseDevice(IXML_Document* doc, const Upnp_Discovery* d_event);
++    void parseDevice(IXML_Document* doc, const UpnpDiscovery* d_event);
+ 
+-    void parseIGD(IXML_Document* doc, const Upnp_Discovery* d_event);
++    void parseIGD(IXML_Document* doc, const UpnpDiscovery* d_event);
+ 
+ 
+     /* these functions directly create UPnP actions
diff --git a/debian/patches/series b/debian/patches/series
index 4a864f7695d1..ea48bdf7b588 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 dont-build-gnutls.patch
 namedirectory-old-restbed.patch
 jsoncpp-rename.patch
+libupnp1.8.patch

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-voip-maintainers/attachments/20171219/58586632/attachment.sig>


More information about the Pkg-voip-maintainers mailing list