Skip to content

Commit

Permalink
Fix UPnP IGD search and port mapping deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming committed Oct 2, 2024
1 parent 906f816 commit 656d24c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pjnath/src/pjnath/upnp.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
/* UPnP device descriptions. */
static const char* UPNP_ROOT_DEVICE = "upnp:rootdevice";
static const char* UPNP_IGD_DEVICE =
"urn:schemas-upnp-org:device:InternetGatewayDevice:1";
"urn:schemas-upnp-org:device:InternetGatewayDevice";
static const char* UPNP_WANIP_SERVICE =
"urn:schemas-upnp-org:service:WANIPConnection:1";
static const char* UPNP_WANPPP_SERVICE =
Expand Down Expand Up @@ -215,7 +215,9 @@ static void download_igd_xml(unsigned dev_idx)
/* Check device type. */
dev_type = doc_get_elmt_value(doc, "deviceType");
if (!dev_type) return;
if (pj_ansi_strcmp(dev_type, UPNP_IGD_DEVICE) != 0) {
if (pj_ansi_strncmp(dev_type, UPNP_IGD_DEVICE,
pj_ansi_strlen(UPNP_IGD_DEVICE)) != 0)
{
/* Device type is not IGD. */
goto on_error;
}
Expand Down Expand Up @@ -515,7 +517,8 @@ static int client_cb(Upnp_EventType event_type, const void *event,
if (!check_error_response(response)) {
PJ_LOG(4, (THIS_FILE, "Successfully deleted port mapping"));
}
ixmlDocument_free(response);
/* According to the sample, we don't need to free this. */
// ixmlDocument_free(response);
}

break;
Expand Down

0 comments on commit 656d24c

Please sign in to comment.