Commit graph

19 commits

Author SHA1 Message Date
Tor Lillqvist
a97c8c3455 Fis our use of inet_ntop() etc
We had:
    auto ipv4 = (struct sockaddr_in *)&clientInfo.sin_addr
even if the clientInfo variable itself was a struct sockaddr_in.

And then we also had:
    auto ipv6 = (struct sockaddr_in6 *)&clientInfo.sin_addr
which makes even less sense.

Instead, make clientInfo into a struct sockaddr_in6, which is big
enough to also to be interpreted as a sockaddr_in. Pass the address of
the correct field, either sin_addr or sin6_addr, to inet_ntop(). (Note
that sin_addr in sockaddr_in has a different offset than sin6_addr in
sockaddr_in6.)

At least on my Fedora 28, when I connect using IPv4, accept4() still
returns the client address as an IPv4 mapped IPv6 address, that is
::ffff:192.168.1.113 for 192.168.1.113. So the sample
net.post_allow.host value in loolwsd.xml.in should probably be changed
to have that ::ffff: prefix, too.

Change-Id: I0ad774616b210d94b904982e2f7dc928adc879ed
2018-07-10 23:14:51 +03:00
Michael Meeks
adb3112820 Use inet_ntop for ipv6 address names.
Change-Id: Ic52b69eb2dc86b6532a78d770531b2fac928fb28
2018-05-14 12:03:17 +01:00
YiiChang Yen
910ae806ef wsd: to filter clientAddress before POST action.
Change-Id: I293580f041bc46b36c57f63fe4a2c0131763b3c1
Reviewed-on: https://gerrit.libreoffice.org/50977
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2018-04-30 18:50:06 +02:00
Michael Meeks
a1ee97c222 Add IPv6 support, and configuration option.
Default to listening on both IPv44 and IPv6 for public interfaces.

Change-Id: Ib04e3bf65e7dcf2a798d381297b15ee9c56e9259
2018-01-09 22:03:17 +00:00
Michael Meeks
9e45fb30d7 SocketDisposition: push it down the stack, and cleanup around that.
Dung out overlapping return enumerations. Move more work into 'move'
callbacks at a safer time, etc.

Change-Id: I62ba5a35f12073b7b9c8de4674be9dae519a8aca
2017-05-05 18:37:26 +01:00
Michael Meeks
913c469aa8 Cleanup whitespace, return is not a function. 2017-03-30 17:34:52 +01:00
Michael Meeks
9381d4134f Unify and simplify timeout and poll events setup.
Both happen at the same time, and need support from the
SocketHandlerInterface.

Rename hasQueuedWrites to getPollEvents and merge updateTimeout.
2017-03-17 22:00:28 +00:00
Michael Meeks
3a5ca4b03f Switch to std::chrono from Poco::Time and simplify lots. 2017-03-17 21:13:11 +00:00
Michael Meeks
e7ebe0fdaa remove obsolete Poco headers, and Poco SSL pieces. 2017-03-16 18:03:23 +00:00
Ashod Nakashian
04bbb75200 wsd: dump state to generic ostream for flexiblity and to log
Change-Id: I4670ee2e90b7809ebc66a2b324a44334b3dbba2b
Reviewed-on: https://gerrit.libreoffice.org/35119
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:19:58 +00:00
Michael Meeks
0eaef6c896 config.h - get includes right: must always be the first include. 2017-03-10 10:47:43 +01:00
Ashod Nakashian
c6dbce9767 nb: transfer client sockets to respective DocumentBroker
Change-Id: I6af656ec6cbb09d4dd80b7b583a009a763de6eb9
2017-03-10 10:47:43 +01:00
Michael Meeks
20f15d4001 Switch Prisoner socket handling to use the SocketPoll.
Kills the Poco ThreadPool usage, and significantly improves debuggability.
2017-03-10 10:47:43 +01:00
Michael Meeks
1655e5d062 Improve socket state dumping on USR1. 2017-03-10 10:47:42 +01:00
Ashod Nakashian
9c0d8cc5b2 nb: log more socket activity
Change-Id: Ibcdf5abc3054691c93382c00bb8a9ecc4b882652
2017-03-10 10:47:42 +01:00
Ashod Nakashian
0c19d81fee nb: read the socket on accept
It's necessary to do the SSL handshake
and to get the request (if we get there)
on accepting so by the time we poll we know
what SSL needs to do next. No reason to
read on first poll when we should be
expecting a request upon connection anyway.

Change-Id: I8eecaad5f8450075d45e487702972418cad125bc
2017-03-10 10:47:41 +01:00
Ashod Nakashian
2e651f4199 nb: cout -> logger
Change-Id: I44c6d83efc7aef50cb793fc6e88da32e73797c74
2017-03-10 10:47:39 +01:00
Michael Meeks
2a5823557e Add initial support for socket timeouts. 2017-03-10 10:47:39 +01:00
Ashod Nakashian
69e4123173 nb: de-templatize ServerSocket
Change-Id: I5680bbf24ade807e34f67f7fce4698ffe5364cb2
2017-03-10 10:47:39 +01:00