* the previous (now invalid) one
* @param addr either the previous or the new public IP address
* @param addrlen actual lenght of @a addr
- * @param emsg NULL on success, otherwise an error message
+ * @param ret GNUNET_NAT_ERROR_SUCCESS on success, otherwise an error code
*/
static void
upnp_add (void *cls,
int add_remove,
const struct sockaddr *addr,
socklen_t addrlen,
- const char *emsg)
+ enum GNUNET_NAT_FailureCode ret)
{
struct GNUNET_NAT_Handle *h = cls;
struct LocalAddressList *pos;
struct LocalAddressList *next;
+ if (GNUNET_NAT_ERROR_SUCCESS != ret)
+ {
+ /* Error while running upnp client */
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ _("Error while running upnp client:\n"));
+
+ //FIXME: convert error code to string
+
+ return;
+ }
+
if (GNUNET_YES == add_remove)
{
add_to_address_list (h, LAL_UPNP, addr, addrlen);
GNUNET_a2s(addr, addrlen));
GNUNET_break (0);
}
- else if (GNUNET_SYSERR == add_remove)
- {
- /* Error while running upnp client */
- if (NULL != emsg)
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Error while running upnp client: `%s'\n"), emsg);
- else
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _("Error while running upnp client \n"));
- return;
- }
else
{
h->enable_nat_server = GNUNET_NO;
/* Check for UPnP client, disable immediately if not available */
- if (GNUNET_SYSERR ==
- GNUNET_OS_check_helper_binary ("upnpc", GNUNET_NO, NULL))
+ if ( (GNUNET_YES == h->enable_upnp) &&
+ (GNUNET_SYSERR ==
+ GNUNET_OS_check_helper_binary ("upnpc", GNUNET_NO, NULL)) )
{
LOG (GNUNET_ERROR_TYPE_ERROR,
_("UPnP enabled in configuration, but UPnP client `upnpc` command not found, disabling UPnP \n"));