Commit Graph

476 Commits

Author SHA1 Message Date
Fabrice Fontaine
537581d8ad Bug fix for IPv4-mapped IPv6 addresses.
Setting IPv6 sockets with IPV6_V6ONLY flag to avoid getting IP packets
with IPv4-mapped IPv6 addresses on IPv6 sockets.
2012-02-18 11:22:53 -02:00
Marcelo Roberto Jimenez
66ea2ab11d Homekeeping for the next release. 2012-01-25 10:40:26 -02:00
Marcelo Roberto Jimenez
4ca0b382ea Adjust the library numbers for release. 2012-01-25 10:34:43 -02:00
Fabrice Fontaine
c155d3c68f Bug fix on M-SEARCH for IPv6 CPs.
Small bug fix on IPv6 Control Point: now CP will also send M-SEARCH on
site-scope address (FF05::C) instead of only sending M-SEARCH on
link-scope (FF02::C).
2012-01-25 09:56:02 -02:00
Fabrice Fontaine
03bd7759cd Retrieve IPv6 addresses in Upnp_Discovery.
Changing sockaddr_in into sockaddr_storage in Upnp_Discovery to be able
to retrieve IPv6 addresses of devices in Control Points using pupnp.
2012-01-25 09:54:14 -02:00
Fabrice Fontaine
80a65e5f61 Bug fix for IPv4-mapped IPv6 addresses.
Setting IPv6 sockets with IPV6_V6ONLY flag to avoid getting IP packets
with IPv4-mapped IPv6 addresses on IPv6 sockets.
2012-01-25 09:41:59 -02:00
Marcelo Roberto Jimenez
3b33626e2f Fix for return value of UpnpResolveURL and UpnpResolveURL2
SF Bug tracker, ID: 3469344
	Submitted: dimmman ( dimmman ) - 2012-01-04 01:44:29 PST
	Details: Looking at the code (v1.6.14, upnptools.c) for UpnpResolveURL
	and UpnpResolveURL2 it shows that the ExitFunction: always returns
	UPNP_E_SUCCESS.

	I'm farily sure it's a simple mistake that should have been "return ret;"
	in both cases.

	Br,
	Jonny
2012-01-09 08:58:03 -02:00
Marcelo Roberto Jimenez
b35761e893 Homekeeping for the next release. 2011-11-14 12:54:21 -02:00
Marcelo Roberto Jimenez
631259dcfc Adjust the library numbers for release. 2011-11-14 12:20:20 -02:00
Fabrice Fontaine
98e4f938d6 UPnP Low Power support
Adding two new functions (UpnpSendAdvertisementLowPower and
UpnpUnRegisterRootDeviceLowPower) which can be used to specify values
for the three SSDP headers defined by UPnP Low Power. Those headers are
Powerstate, SleepPeriod and RegistrationState.
2011-11-04 20:21:58 -02:00
Fabrice Fontaine
92c93a8010 Bug fix in IN6_IS_ADDR_GLOBAL.
Changing IN6_IS_ADDR_GLOBAL to accept all IPv6 addresses which have a
2000::/3 prefix.
2011-11-01 18:59:49 -02:00
Nick Leverton
e40e6b49d4 Summary: upnptools.h should #include upnpconfig.h - ID: 3426326
(cherry picked from commit ef7bbc4866)
2011-10-20 12:30:05 +01:00
Marcelo Roberto Jimenez
cec07d641a autoconfig.h for windows builds. 2011-07-20 06:21:32 -03:00
Fabrice Fontaine
6c6fb3707f Bug Fix on M-SEARCH.
Do not answer to M-SEARCH using HTTP version 1.0 as specified by the
UPnP Device Architecture.
2011-07-20 06:10:07 -03:00
Iain Denniston
92ea719804 Fixes for compilation under Windows (specifically MSVC). Also added MSVC supported "_inline", and fixed some WIN32 specific warnings. 2011-04-02 23:47:00 -03:00
Iain Denniston
fed316ff3e Several fixes to correctly use SOCKET (and related) types instead of non-portable variations. 2011-04-02 23:38:53 -03:00
Marcelo Roberto Jimenez
8eb7d1c1a5 Homekeeping for the next release. 2011-03-17 09:27:55 -03:00
Marcelo Roberto Jimenez
2b263b6574 Adjust the library numbers for release. 2011-03-17 09:15:19 -03:00
Marcelo Roberto Jimenez
e16cb4b225 Silence compiler warning message.
warning: unused parameter ‘listen_port6’
2011-03-15 18:27:17 -03:00
Fabrice Fontaine
0996d23318 Putting ssdpReqSocks under compilation flag.
Putting all access to ssdpReqSock4 and ssdpReqSock6 under
INCLUDE_CLIENT_APIS compilation flag to be able to compile when
client part of library is disable.
2011-03-15 18:22:30 -03:00
Fabrice Fontaine
11f9a2bafe New UpnpRegisterRootDevice4 for legacy CPs.
Add a new UpnpRegisterRootDevice4 which allow user to specify a
description URL to be returned for legacy CPs (for example, CPs
searching for a v1 when the device is v2). Most of those CPs does not
work if they found a v2 in the XML description, so this new function is
only used to solve interoperability issues.
2011-03-15 18:17:05 -03:00
Iain Denniston
8aca337de7 Fix for memory leak 2011-03-11 18:33:43 -03:00
Iain Denniston
a78a048577 Fix and Update of MSVC9 solution and project files 2011-03-11 18:07:49 -03:00
Iain Denniston
7338411c08 Partial fix for UpnpGetIfInfo with MSVC 2011-03-11 17:52:07 -03:00
Marcelo Roberto Jimenez
3a9ae348bc Created the macros PRIzd and PRIzx to deal with MSVC lack of C99.
Thanks to Iain Denniston for pointing it out.
2011-03-11 17:20:17 -03:00
Iain Denniston
840669b253 Fixes for headers when compiled under C++ 2011-03-11 16:07:51 -03:00
Marcelo Roberto Jimenez
e30e7bd586 Fix for uuid_unpack incorrect shift precedence. 2011-03-10 16:21:25 -03:00
Marcelo Roberto Jimenez
0d3412bb24 Homekeeping for the next release. 2011-02-08 21:48:46 -02:00
Marcelo Roberto Jimenez
e52dafda3b Adjust the library numbers for release. 2011-02-08 21:44:31 -02:00
Marcelo Roberto Jimenez
bab22c694b Undo the "incorrectly exported include files".
Legacy applications like linux-igd and igd2-for-linux are using those
API to create a thread pool for managing their GENA events.

Leave it to be reworked in 1.8.x.
2011-02-08 21:37:13 -02:00
Marcelo Roberto Jimenez
74665acd57 Homekeeping for the next release. 2011-02-07 22:41:08 -02:00
Marcelo Roberto Jimenez
b1629b8ac8 Adjust the library numbers for release. 2011-02-07 22:35:57 -02:00
Marcelo Roberto Jimenez
32e510b45a Remove PrintThreadPoolStats() from the public API.
This function uses a ThreadPool object as an argument, which is not
supposed to be exported. Also, debug compilation was broken.
2011-02-07 22:33:42 -02:00
Fabrice Fontaine
063d472f80 Major bug fix in IPv6 code.
Major bug fix in miniserver.c for IPv6, bug was introduced when
changing implementation of get_port in November 20th 2010 ("gena:fix
several compiler warnings" commit).
2011-02-07 21:27:41 -02:00
Marcelo Roberto Jimenez
0bbe9f62df Fix for incorrectly exported include files.
The files FreeList.h, LinkedList.h, ThreadPool.h and TimerThread.h
from the threautil library were being installed in the include
directory of the library, incorrectly exposing internal data structure
of the library.
2011-02-06 11:52:47 -02:00
Marcelo Roberto Jimenez
fdb8b9ef2f White spaces and indentation. 2011-01-30 09:40:48 -02:00
Chandra Penke
6c125feea0 Fix for compilation errors
Fix for compilation warnings of unused variables in upnpdebug.c in
release builds.
2011-01-30 09:36:05 -02:00
Chandra Penke
c4e9757bcf Fix for Race condition can hang miniserver thread.
Add 'requiredThreads' field to the ThreadPool structure, to avoid
a race condition when waiting for a new thread to be created. The
race condition occurs when a thread is destroyed while the master
thread is waiting for a new thread to be created.

Thanks to Chuck Thomason for pointing the problem.

Summary: Race condition can hang miniserver thread - ID: 3158591

Details:
Hello,

I have found a race condition in the thread pool handling of
libupnp-1.6.6 that periodically results in the miniserver thread
getting blocked infinitely.

In my setup, I have the miniserver thread pool configured with 1
job per thread, 2 threads minimum, and 50 threads maximum.

Just before the lockup occurs, the miniserver thread pool contains
2 threads: one worker thread hanging around from a previous HTTP
request job (let's call that thread "old_worker") and the
miniserver thread itself.

A new HTTP request comes in. Accordingly, the miniserver enters
schedule_request_job() and then ThreadPoolAdd(). In
ThreadPoolAdd(), the job gets added to the medium-priority queue,
and AddWorker() is called. In AddWorker(), jobs = 1 and threads =
1, so CreateWorker gets called.

When we enter CreateWorker(), tp->totalThreads is 2, so
currentThreads is 3. The function creates a new thread and then
blocks on tp->start_and_shutdown. The miniserver thread expects
the newly created thread to increment tp->totalThreads and then
signal the condition variable to wake up the miniserver thread and
let it proceed.

The newly created thread starts in the WorkerThread() function. It
increments tp->totalThreads to 3, does a broadcast on the
start_and_shutdown condition, and starts running its job. However,
before the miniserver thread wakes up, "old_worker" times out. It
sees that there are no jobs in any queue and that the total number
of threads (3) is more than the minimum (2). As a result, it
reduces tp->totalThreads to 2 and dies.

Now the miniserver thread finally wakes up. It checks
tp->totalThreads and sees that its value is 2, so it blocks on
tp->start_and_shutdown again. It has now "missed" seeing
tp->totalThreads get incremented to 3 and will never be unblocked
again.

When this issue does occur for a server device, the miniserver
port remains open, but becomes unresponsive since the miniserver
thread is stuck. SSDP alive messages keep getting sent out, as
they are handled by a separate thread. Reproducing the issue is
difficult due to the timing coincidence involved, but in my
environment I am presently seeing it at least once a day. I
figured out the sequence described above through addition of my
own debug logs.

The relevant code involved in this bug has not changed
substantially in libupnp-1.6.10, though I am planning to test
against 1.6.10 as well in the near future.

Do you have any input for an elegant fix for this issue?

Thanks,

Chuck Thomason
2011-01-20 04:45:27 -02:00
Marcelo Roberto Jimenez
639d3a5a03 Update the documentation about samples in README.
Thanks to Tom (tomdev2).
2011-01-17 11:36:52 -02:00
Chandra Penke
f46683fd0e Fix for typo in strndup() function definition. 2011-01-17 09:03:34 -02:00
Marcelo Roberto Jimenez
abfa841318 Define _FILE_OFFSET_BITS, _LARGEFILE_SOURCE and _LARGE_FILE_SOURCE in upnpconfig.h.
Make these definitions available to programs using the library.
Thanks to Chandra Penke for pointing the problem.
2011-01-16 22:38:18 -02:00
Chandra Penke
3c4ff99cdb Allow virtual callbacks to use chunked encoding by setting the file length of a UpnpFileInfo object to be UPNP_USING_CHUNKED. 2011-01-16 21:28:13 -02:00
Marcelo Roberto Jimenez
541679d651 Use config.h to test for the availability of strndup() and strnlen(). 2011-01-16 21:05:07 -02:00
Chandra Penke
cb1188d2bc Fixes chunked transfer encoding in HTTP client API 2011-01-15 21:11:24 -02:00
Marcelo Roberto Jimenez
189ce59dbe Null termination of strndup() implementation on systems missing it.
Also, implementation of strnlen() on systems missing it.
2011-01-14 22:05:22 -02:00
Marcelo Roberto Jimenez
4815e52586 Doxygen on membuffer. 2011-01-14 10:26:45 -02:00
Marcelo Roberto Jimenez
9051731a93 Minor change in membuffer.c to include "membuffer.h"
...without looking in the standard header path. This allows pupnp
to build in xcode.
2011-01-14 09:54:59 -02:00
Marcelo Roberto Jimenez
39fd869db8 Leave just one call to gmtime() in http_MakeMessage(). 2011-01-02 22:36:13 -02:00
Marcelo Roberto Jimenez
8997e7fff6 Make sure va_end() is called in http_MakeMessage(). 2011-01-02 22:31:10 -02:00
Marcelo Roberto Jimenez
7e8d1787c9 Fixes many problems in sample code.
In particular, undoes 25c908c558:
SF Patch Tracker [ 2836704 ] Search for nested serviceList (not
stopping at the first lis
Submitted By: zephyrus ( zephyrus00jp )

The original zephyrus' code is still #ifdef'd in the file, if someone
wishes to fix it, check for "#ifdef OLD_FIND_SERVICE_CODE".
2010-12-23 22:22:32 -02:00