History log of /haiku/src/servers/net/Services.cpp
Revision Date Author Comments
# 89dae40a 01-Feb-2021 Jérôme Duval <jerome.duval@gmail.com>

net_server: handle EINTR on select()

Change-Id: I90af101cef72b33ecb6decec911d03f592c1ec7c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3729
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>


# 40ee778c 12-Feb-2019 Rob Gill <rrobgill@protonmail.com>

Fix memory leaks

* Delete/free as appropriate

Most cases involve not freeing memory after encountering error or
unexpected situation (identified via cppcheck static analysis)

Change-Id: I90ba2fca518b00d2dfa9ec1ddbcebe1920a34b7c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1038
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 9d06690e 11-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

userland: Pass more sizes with ioctls where we can.

No "functional" change intended.


# d8e8078b 22-Nov-2015 Jérôme Duval <jerome.duval@gmail.com>

net_server: warning on delete of address of a reference.

* fixes #12244.


# 55820aed 12-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

net_server: Print message on fork() error.

* Also removed an extra check for the name in _Update(); _ToService()
will already return an error in that case.


# c3ef9391 11-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

net_server: Clients can now check if a service is running.

* Using the new kMsgIsServiceRunning command.


# 7ca40f60 10-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkSettings: made service stuff writable.

* And added the ability to disable a service without losing its
configuration.


# e4f4658a 04-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkSettings: made interface settings writable.

* It also makes use of the new driver settings converter mechanism.


# f16f9ee4 25-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Moved more functionality from net_server to NetworkSettings.

* Added (still incomplete) helper classes for the settings messages.
* The net_server now uses these classes for its interfaces, and services.
* Renamed service_address to service_connection, as that better matches
what it is used for.


# fd55fb66 18-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Moved net_server's settings to libbnetapi.

* As experimental API class BNetworkSettings.
* Added add/remove methods for interfaces, and services, too.
* Moved the conversion of the wireless networks into the settings class,
too, so that it only gives out converted ones (but accepts both
variants).


# 77206143 05-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Revert "Move getifaddrs to libnetwork again."

This reverts commit 31ea76548a64b232ed10cb444bf84ca1f7e40b0f.

Adrien, please try again without clobbering the otherwise nice
BNetworkInterface API!

Conflicts:
src/kits/network/getifaddrs.cpp


# 31ea7654 20-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Move getifaddrs to libnetwork again.

* BNetworkInterfaceAddress is moved to libnetwork. It is modified to not
use BNetworkAddress (which is in libbnetapi) and instead use sockaddr
and sockaddr_storage directly. All callers are adjusted to this.
* Some support code is shared between BNetworkInterface and
BNetworkInterfaceAddress, move it to libnetwork but in the BPrivate
namespace.


# 3aeed660 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# 6d796a84 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 26119abd 17-Jan-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Port value in servent struct is in network byte order.
This was making net_server listening wrong service port. Telnet & FTP
works again in non stand-alone mode.
This close #7108.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40241 a95241bf-73f2-0310-859d-f6bbb57e9c96


# af074561 23-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Now uses the new network API instead of directly using socket ioctls.
This makes the code much cleaner and simpler.
* Completely untested, though (will do that next).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39595 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 399d6902 13-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed warnings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32320 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5544f69d 13-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added "stand_alone" setting to the services - this way you can use the
net_server to launch services that work like a daemon theirselves (like sshd).
A service like this is also killed (via SIGTERM) when the netserver stops the
service (with sshd, you have to pass the '-D' option to make this work).
* If a boolean is given without value, it now defaults to true.
* The "launch" argument now gets its arguments properly parsed, and added, too.
* Services::_Update() did accidently set fUpdate on the wrong service, causing
services that were not changed to be stopped.
* More helpful output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32319 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9c7d49a 01-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30940 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb3e35fc 22-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

Fixing all headers/namespaces/name lookup problems that hinder a GCC 4.3.2
build. I sure hope that this doesn't break the build for anyone else.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28992 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5e42a6bd 17-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish+axeld:
* the net_server leaked file descriptors for every opened session.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f6ad6dd6 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Now a service is quit when it is removed from the settings file.
* When deleting the Services handler, it will now also stop all running services,
and close the command pipe (since it's only quit when the net_server quits, that
wasn't much of a problem, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21566 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 43d946d6 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Now uses BPathMonitor instead of the node monitor; this fixes several issues with
changes to settings files that were ignored (for example, watching "services" did
only work if "interfaces" existed).
* On services update, Services::_Update() accidently compared the pointers of the
service objects, instead of the objects themselves.
* Implemented comparison of address changes in service objects; IOW when you change
the addresses a service should bind itself to, but leave the rest of the service
unchanged, this will now be detected as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21555 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 470ca87e 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* _Update() was called too early in the constructor of class Service; that caused
incorrect values in fSet, and fMinSocket which also resulted in select() never
to return (in would only work for settings you changed after the net_server
was run).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21551 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 16aceec1 31-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Put the new server into its own session.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c30e35eb 31-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Actually launching services should work now:
* ServiceSocketMap now maps directly to service_address objects which now have
gotten a pointer to their owner.
* now uses listen(), and accept() for SOCK_STREAM sockets
* fMinSocket could be wrong.
* use FD_CLOEXEC on all sockets, and the communication pipe.
* removed unused service::type and service::protocol.
* if no family is specified, we now default to AF_INET.
* uses fork()/exec() to actually spawn the servers to not clobber the net_server's
input/output streams.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19663 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c42ca726 28-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Work-in-progress on the "services" implementation: it now reads the configuration
message, parses it, and stops/starts the services as needed - it doesn't launch
any actual servers yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19645 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dde7916d 26-Dec-2006 Jérôme Duval <korli@users.berlios.de>

gcc4 build fix


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19632 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc398fa2 22-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Added "services" to the network settings, and refactored the settings class a bit
to be easier extendable with more classes.
* Fixed a bug in the settings that caused updated settings to be appended to the
existing ones (missing BMessage::MakeEmpty()).
* Started services system, doesn't do anything useful yet (inetd replacement).
* Fixed the bug that caused the loopback default netmask to be incorrectly chosen;
removed the temporary fix Bruno introduced before. The same bug has been in
ifconfig where I copied the code from (but wrote it there, too) :-).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19609 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 55820aedc17929b349d5168a96604ed6208f28bd 12-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

net_server: Print message on fork() error.

* Also removed an extra check for the name in _Update(); _ToService()
will already return an error in that case.


# c3ef93915b13214d3ee26c7224c0f109df58897f 11-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

net_server: Clients can now check if a service is running.

* Using the new kMsgIsServiceRunning command.


# 7ca40f60bc4c730763a3a50f5d5526b04f25e4a8 10-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkSettings: made service stuff writable.

* And added the ability to disable a service without losing its
configuration.


# e4f4658a1bbe63aaf118a960cda25c63653ba5e4 04-Mar-2015 Axel Dörfler <axeld@pinc-software.de>

BNetworkSettings: made interface settings writable.

* It also makes use of the new driver settings converter mechanism.


# f16f9ee4ee34b2378804c7272897182226976fca 25-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Moved more functionality from net_server to NetworkSettings.

* Added (still incomplete) helper classes for the settings messages.
* The net_server now uses these classes for its interfaces, and services.
* Renamed service_address to service_connection, as that better matches
what it is used for.


# fd55fb661591f2b63d5d961a6cf1f475be21ad9d 18-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Moved net_server's settings to libbnetapi.

* As experimental API class BNetworkSettings.
* Added add/remove methods for interfaces, and services, too.
* Moved the conversion of the wireless networks into the settings class,
too, so that it only gives out converted ones (but accepts both
variants).


# 7720614300ff86e823735adcb96690c822dd60f8 05-Feb-2015 Axel Dörfler <axeld@pinc-software.de>

Revert "Move getifaddrs to libnetwork again."

This reverts commit 31ea76548a64b232ed10cb444bf84ca1f7e40b0f.

Adrien, please try again without clobbering the otherwise nice
BNetworkInterface API!

Conflicts:
src/kits/network/getifaddrs.cpp


# 31ea76548a64b232ed10cb444bf84ca1f7e40b0f 20-Jan-2015 Adrien Destugues <pulkomandy@gmail.com>

Move getifaddrs to libnetwork again.

* BNetworkInterfaceAddress is moved to libnetwork. It is modified to not
use BNetworkAddress (which is in libbnetapi) and instead use sockaddr
and sockaddr_storage directly. All callers are adjusted to this.
* Some support code is shared between BNetworkInterface and
BNetworkInterfaceAddress, move it to libnetwork but in the BPrivate
namespace.


# 3aeed6607cd07762c0e709633c012b3a632dbad9 07-Aug-2014 Jérôme Duval <jerome.duval@gmail.com>

include strings.h where appriopriate...

instead or additionally to string.h, in preparation for functions move.
* moves str[n]casecmp() functions and others to strings.h.
* strings.h doesn't include string.h anymore.
* this solves #10949


# 6d796a84bd484ccc4fb072a29c663b660180ae51 10-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed up network stack and drivers for x86_64.

* Various compilation fixes.
* Fixes to the FreeBSD compatibility layer (from comparing the x86-
specific bits with the equivalent amd64 sources in FreeBSD).
* Compile all the Ethernet drivers except for sis900 and wb840, these
require a bit more work to fix (will file a ticket soon). Tested
ipro1000 and rtl81xx, no issues.


# 26119abd201ceb77e16d165821b43e5a802baab9 17-Jan-2011 Philippe Houdoin <philippe.houdoin@gmail.com>

Port value in servent struct is in network byte order.
This was making net_server listening wrong service port. Telnet & FTP
works again in non stand-alone mode.
This close #7108.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40241 a95241bf-73f2-0310-859d-f6bbb57e9c96


# af0745618fc4fca86016d858e5ba9dc64dab16ea 23-Nov-2010 Axel Dörfler <axeld@pinc-software.de>

* Now uses the new network API instead of directly using socket ioctls.
This makes the code much cleaner and simpler.
* Completely untested, though (will do that next).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39595 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 399d690252a8daa41ecd909fca779d3aab13fc4d 13-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Fixed warnings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32320 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5544f69de6075ba11f1d879831b5d4b43d43e538 13-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added "stand_alone" setting to the services - this way you can use the
net_server to launch services that work like a daemon theirselves (like sshd).
A service like this is also killed (via SIGTERM) when the netserver stops the
service (with sshd, you have to pass the '-D' option to make this work).
* If a boolean is given without value, it now defaults to true.
* The "launch" argument now gets its arguments properly parsed, and added, too.
* Services::_Update() did accidently set fUpdate on the wrong service, causing
services that were not changed to be stopped.
* More helpful output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32319 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e9c7d49aa0864017e0dc678c109618713dd88bc1 01-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30940 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fb3e35fcec1ef41b413b3b121764509f436dee4d 22-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

Fixing all headers/namespaces/name lookup problems that hinder a GCC 4.3.2
build. I sure hope that this doesn't break the build for anyone else.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28992 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5e42a6bdd7e94e1be6da552be0cbec51e8d0c0c5 17-Feb-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish+axeld:
* the net_server leaked file descriptors for every opened session.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23987 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f6ad6dd6a6a8a6cc6a2ef24f46dbf1fb4a84000c 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Now a service is quit when it is removed from the settings file.
* When deleting the Services handler, it will now also stop all running services,
and close the command pipe (since it's only quit when the net_server quits, that
wasn't much of a problem, though).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21566 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 43d946d6d66e9127ebf044a395da82dfd41e868d 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Now uses BPathMonitor instead of the node monitor; this fixes several issues with
changes to settings files that were ignored (for example, watching "services" did
only work if "interfaces" existed).
* On services update, Services::_Update() accidently compared the pointers of the
service objects, instead of the objects themselves.
* Implemented comparison of address changes in service objects; IOW when you change
the addresses a service should bind itself to, but leave the rest of the service
unchanged, this will now be detected as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21555 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 470ca87e4d121c297edc9bdf2e66d04cd42b46a1 04-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* _Update() was called too early in the constructor of class Service; that caused
incorrect values in fSet, and fMinSocket which also resulted in select() never
to return (in would only work for settings you changed after the net_server
was run).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21551 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 16aceec16efe1682bd4ad761ba390492c8369a81 31-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Put the new server into its own session.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19664 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c30e35eb9bfa78292163de0a766a3b028cfd9cf2 31-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Actually launching services should work now:
* ServiceSocketMap now maps directly to service_address objects which now have
gotten a pointer to their owner.
* now uses listen(), and accept() for SOCK_STREAM sockets
* fMinSocket could be wrong.
* use FD_CLOEXEC on all sockets, and the communication pipe.
* removed unused service::type and service::protocol.
* if no family is specified, we now default to AF_INET.
* uses fork()/exec() to actually spawn the servers to not clobber the net_server's
input/output streams.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19663 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c42ca72638425e7b8745426654a7f6d0de054464 28-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Work-in-progress on the "services" implementation: it now reads the configuration
message, parses it, and stops/starts the services as needed - it doesn't launch
any actual servers yet, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19645 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dde7916d62ec4f221bf69be80824c29d454845c1 26-Dec-2006 Jérôme Duval <korli@users.berlios.de>

gcc4 build fix


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19632 a95241bf-73f2-0310-859d-f6bbb57e9c96


# fc398fa2ab1532b0fdc002f8ef8d99a9b723da69 22-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

* Added "services" to the network settings, and refactored the settings class a bit
to be easier extendable with more classes.
* Fixed a bug in the settings that caused updated settings to be appended to the
existing ones (missing BMessage::MakeEmpty()).
* Started services system, doesn't do anything useful yet (inetd replacement).
* Fixed the bug that caused the loopback default netmask to be incorrectly chosen;
removed the temporary fix Bruno introduced before. The same bug has been in
ifconfig where I copied the code from (but wrote it there, too) :-).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19609 a95241bf-73f2-0310-859d-f6bbb57e9c96