Martin Willi
e49b299867
stream: Make sure no watcher callback is active while changing stream callbacks
...
When changing async callbacks on streams, we have to make sure the watcher
callback is not currently active and has temporarily disabled callbacks. This
could have been the case, as we didn't explicitly removed any pending
watcher registration if both callbacks are NULL.
By enforcing the watcher unregistration, we are sure the watcher callback is
not active and currently is not mangling the callback hooks. This should make
sure we avoid any races for the callback variables.
2014-01-22 15:34:53 +01:00
Tobias Brunner
bfa2201537
tun-device: Include system headers before our own
...
On CentOS 6.5 the sys/capability.h header file defines _LINUX_TYPES_H
without actually including that header, preventing its later inclusion
here.
As library.h (via which the capabilities headers are included) is not
actually required in tun_device.[ch], moving the inclusion of tun_device.h
would not strictly be necessary. But it's probably a good idea to
include our own headers after system headers anyway, for if one of the
recursively included files at a later point includes library.h we'd have
the same problem again.
2013-12-20 11:33:16 +01:00
Martin Willi
1cbe4e6ce4
tun-device: Include <linux/types.h> before <linux/if_tun.h>
...
Fixes a build error on CentOS 6.4.
2013-11-22 09:09:06 +01:00
Tobias Brunner
60ddf6284f
Use exact mask when calling umask(2)
...
Due to the previous negation the high bits of the mask were set, which
at least some versions of the Android build system prevent with a compile-time
check.
2013-10-29 16:01:55 +01:00
Tobias Brunner
bf32cdfbf6
tun_device: Add warning if TUN devices are not supported by platform
2013-09-12 01:44:49 +02:00
Tobias Brunner
ed0efaef4c
host: Properly initialize struct sockaddr_in[6] when parsing strings
...
Otherwise struct members like sin6_flowinfo or sin6_scope_id might be
set to bogus values.
2013-07-31 22:16:58 +02:00
Tobias Brunner
d7dc4fedd1
stream: Ensure UNIX socket path is null terminated
2013-07-24 16:17:23 +02:00
Tobias Brunner
6e2ec33f9d
host: Prevent overflow in host_create_netmask() if mask is 0 or 32/128
2013-07-24 16:17:03 +02:00
Tobias Brunner
0ceb288815
Fix various API doc issues and typos
...
Partially based on an old patch by Adrian-Ken Rueegsegger.
2013-07-18 18:30:36 +02:00
Martin Willi
b4b3959b22
stream-service: move CAP_CHOWN check from plugins to service constructor
...
A plugin service can be a TCP socket now, so it does not make much sense
to strictly check for CAP_CHOWN.
2013-07-18 16:00:31 +02:00
Martin Willi
4701929266
stream: allow async read/write callback to destroy the stream explicitly
2013-07-18 16:00:29 +02:00
Martin Willi
c9d1742b5d
stream: don't close underlying socket when creating a stream from it
2013-07-18 16:00:29 +02:00
Martin Willi
e6e8a2b2e0
stream: support keeping the service alive outside of service callback
2013-07-18 16:00:28 +02:00
Martin Willi
d57b9e7c82
stream: add read/write_all() methods to stream
2013-07-18 16:00:28 +02:00
Martin Willi
1d1ef9e7ca
stream: support cancellation of stream service callback
2013-07-18 16:00:28 +02:00
Martin Willi
047a190600
stream: use a service constructor to create services
...
It does not make much sense to reference running services in the manager,
especially as unregistration would need the URI (which a user would have to
store instead of the service reference).
2013-07-18 16:00:28 +02:00
Martin Willi
fbdc65debb
stream: replace print/vprint() convenience functions by a FILE* getter
...
While this will complicate the implementation of streams not based on a fd,
it allows us to unleash the full power of FILE based convenience functions.
2013-07-18 16:00:28 +02:00
Martin Willi
70d1ccec96
stream: add a concurrency option to services, limiting parallel callbacks
2013-07-18 16:00:28 +02:00
Martin Willi
db0e160ba2
stream: add a job priority option to stream services
2013-07-18 16:00:28 +02:00
Martin Willi
441bb9e7b7
stream: add backlog option to stream services, forward to listen()
2013-07-18 16:00:28 +02:00
Martin Willi
c5597a4b56
stream: add support for TCP stream services
2013-07-18 16:00:28 +02:00
Martin Willi
db1c8aa460
stream: add support for TCP streams
2013-07-18 16:00:28 +02:00
Martin Willi
f04746d9b4
stream: add support for UNIX stream services
2013-07-18 16:00:28 +02:00
Martin Willi
b785cfe05b
stream: add support for UNIX streams
2013-07-18 16:00:28 +02:00
Martin Willi
c1fd8c22ce
stream: support async operation using watcher
2013-07-18 16:00:28 +02:00
Martin Willi
7a23588195
stream: add printf()-style covenience functions
2013-07-18 16:00:28 +02:00
Martin Willi
2ba276017d
stream: create library instance of stream-manager
2013-07-18 16:00:28 +02:00
Martin Willi
d6ff53940f
stream: add a manager to dynamically register streams and services
2013-07-18 16:00:28 +02:00
Martin Willi
daf1880b39
stream: add a stream service class abstracting services using BSD sockets
2013-07-18 16:00:27 +02:00
Martin Willi
b6b940001a
stream: add a stream class abstracting BSD sockets
...
Currently only synchronous operation is supported, but this will be extended
with asynchronous methods using the new watcher.
2013-07-18 16:00:27 +02:00
Tobias Brunner
66aaabf342
tun-device: Packets sent over utun devices on Mac OS X have the protocol family prepended
2013-06-21 17:03:21 +02:00
Tobias Brunner
c8a56512a6
tun-device: Avoid opening /dev/tunX multiple times (e.g. on FreeBSD)
2013-06-21 17:03:21 +02:00
Volker Rümelin
f8298b9f98
host-resolver: don't try to resolve a plain v4 address to an IPv6 address
...
Suppress 'Address family for hostname not supported' errors if a IPv6
client connects in a mixed IPv4/IPv6 environment.
2013-05-16 11:03:37 +02:00
Martin Willi
2af65b26d9
tun_device: add a getter for the address previously passed to set_address()
2013-05-06 16:10:11 +02:00
Martin Willi
60babe0236
tun_device: add a getter for the underlying file descriptor
2013-05-06 16:10:11 +02:00
Martin Willi
d947d0d61a
tun-device: use host_create_netmask() to calculate interface netmask
2013-05-06 16:10:11 +02:00
Martin Willi
2d8a01d1c6
host: add a netmask constructor taking the number of network bits
2013-05-06 16:10:11 +02:00
Martin Willi
4dc83e9fac
host: remove unused host_t.get_differences() method
2013-05-06 16:10:11 +02:00
Martin Willi
7749eb0d2a
host: print %#H format specifiers not as %any, but with the port
2013-05-06 16:10:11 +02:00
Martin Willi
344a4e54be
host: initialize sockaddr->sa_len if it is available
2013-05-06 16:10:11 +02:00
Martin Willi
1116689944
Add a DSCP value with getter/setter on packet_t
2013-02-06 15:20:32 +01:00
Martin Willi
82c884c015
Set sockaddr family on ifreq instead of casted familiy specific sockaddr
...
Fixes a strict-aliasing rule compiler warning with older gcc.
2013-02-06 15:20:32 +01:00
Tobias Brunner
58fd1f3eef
Don't use pointer to a union member in host_create_from_string_and_family()
2013-01-25 13:18:50 +01:00
Martin Willi
426f34baf9
Respect given address family when resolving "%any"
2013-01-14 10:26:12 +01:00
Martin Willi
7277e4719e
Consolidated %any(6) host_t parsing
2012-11-29 10:22:52 +01:00
Martin Willi
98d0fd25a8
Remove numeric conversion from resolver, it is done directly in host_t
2012-11-29 10:22:52 +01:00
Martin Willi
47f35b46a1
host_create_from_dns() tries a numeric conversion before asking resolver
2012-11-29 10:22:51 +01:00
Martin Willi
f5fe52bf9a
Add a host_t constructor from string, but with a specific family
2012-11-29 10:22:51 +01:00
Tobias Brunner
f05b427265
Moved debug.[ch] to utils folder
2012-10-24 16:00:51 +02:00
Tobias Brunner
125b37af6d
Moved chunk_t to utils folder
2012-10-24 16:00:50 +02:00