Re: [systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables

2014-08-14 Thread Susant Sahani

On 08/14/2014 06:13 AM, Lennart Poettering wrote:

On Tue, 29.07.14 23:10, Susant Sahani (sus...@redhat.com) wrote:




tcp_keepalive_time: The number of seconds a connection needs to be
idle before TCP begins sending out keep-alive probes.


Looks pretty OK.


---




  varlistentry
+  termvarnameKeepAliveTime=/varname/term
+  listitemparaTakes time (in seconds) as
argument . The connection needs to remain


 ^ there's a spurious space too much here...


Removed .




+  idle before TCP starts sending keepalive probes. 
This controls the TCP_KEEPIDLE
+  socket option (see



+/varlistentry


Could you indent this like the rest of the settings, please?


Ok




+SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, 
offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, 
offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveProbes, i, bus_property_get_int,
offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST),


This should really be an u and use bus_property_get_unsigned(), no? I
mean, there is no negative count possible, is there?


Yes :)




+if(s-keep_alive_time)
+fprintf(f,
+%sKeepAliveTime: %lo\n,
+prefix, s-keep_alive_time / USEC_PER_SEC);


Please format this with format_timespan()!


made the changes



Otherwise looks good!

Lennart



Re-sending Both the patches . Thanks for reviewing.

Susant
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables

2014-08-14 Thread Susant Sahani
The tcp keep alive variables now can be configured via conf
parameter. Follwing variables are now supported by this patch.

tcp_keepalive_intvl: The number of seconds between TCP keep-alive probes

tcp_keepalive_probes: The maximum number of TCP keep-alive probes to
send before giving up and killing the connection if no response is
obtained from the other end.

tcp_keepalive_time: The number of seconds a connection needs to be
idle before TCP begins sending out keep-alive probes.
---
 man/systemd.socket.xml| 36 +++
 src/core/dbus-socket.c|  3 +++
 src/core/load-fragment-gperf.gperf.m4 |  3 +++
 src/core/socket.c | 36 +++
 src/core/socket.h |  3 +++
 5 files changed, 81 insertions(+)

diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 352825f..5efb398 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -488,6 +488,42 @@
 /varlistentry
 
 varlistentry
+termvarnameKeepAliveTime=/varname/term
+listitemparaTakes time (in seconds) as 
argument . The connection needs to remain
+idle before TCP starts sending keepalive 
probes. This controls the TCP_KEEPIDLE
+socket option (see
+
citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry
+and the ulink
+
url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP
+Keepalive HOWTO/ulink for details.)
+Defaults value is 7200 seconds (2 
hours)./para/listitem
+/varlistentry
+
+varlistentry
+
termvarnameKeepAliveInterval=/varname/term
+listitemparaTakes time (in seconds) as 
argument between individual keepalive probes,
+if the socket option SO_KEEPALIVE has  been 
set on this socket seconds as argument.
+This controls the TCP_KEEPINTVL socket option 
(see
+
citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry
+and the ulink
+
url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP
+Keepalive HOWTO/ulink for details.)
+Defaults value is 75 seconds./para/listitem
+/varlistentry
+
+varlistentry
+
termvarnameKeepAliveProbes=/varname/term
+listitemparaTakes interger as argument. 
It's the number of unacknowledged probes to
+send before considering the connection dead 
and notifying the application layer.
+This controls the TCP_KEEPCNT socket option 
(see
+
citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry
+and the ulink
+
url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP
+Keepalive HOWTO/ulink for details.)
+Defaults value is 9./para/listitem
+/varlistentry
+
+varlistentry
 termvarnameNoDelay=/varname/term
 listitemparaTakes a boolean
 argument. TCP Nagle's algorithm works by 
combining a number of
diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
index ad135a1..bdf111c 100644
--- a/src/core/dbus-socket.c
+++ b/src/core/dbus-socket.c
@@ -97,6 +97,9 @@ const sd_bus_vtable bus_socket_vtable[] = {
 SD_BUS_PROPERTY(DirectoryMode, u, bus_property_get_mode, 
offsetof(Socket, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(Accept, b, bus_property_get_bool, offsetof(Socket, 
accept), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(KeepAlive, b, bus_property_get_bool, 
offsetof(Socket, keep_alive), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, 
offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, 
offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveProbes, u, bus_property_get_unsigned, 
offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(Priority, i, bus_property_get_int, 
offsetof(Socket, priority), 

Re: [systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables

2014-08-14 Thread Zbigniew Jędrzejewski-Szmek
Pushed all three, with my typo pointed out by sztapnet fixed.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables

2014-08-13 Thread Lennart Poettering
On Tue, 29.07.14 23:10, Susant Sahani (sus...@redhat.com) wrote:

 The tcp keep alive variables now can be configured via conf
 parameter. Follwing variables are now supported by this patch.
 
 tcp_keepalive_intvl: The number of seconds between TCP keep-alive probes
 
 tcp_keepalive_probes: The maximum number of TCP keep-alive probes to
 send before giving up and killing the connection if no response is
 obtained from the other end.
 
 tcp_keepalive_time: The number of seconds a connection needs to be
 idle before TCP begins sending out keep-alive probes.

Looks pretty OK.

 ---
  man/systemd.socket.xml| 36 
 +++
  src/core/dbus-socket.c|  3 +++
  src/core/load-fragment-gperf.gperf.m4 |  3 +++
  src/core/socket.c | 33 
  src/core/socket.h |  3 +++
  5 files changed, 78 insertions(+)
 
 diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
 index 09a7311..6dbcc81 100644
 --- a/man/systemd.socket.xml
 +++ b/man/systemd.socket.xml
 @@ -488,6 +488,42 @@
  /varlistentry
  
  varlistentry
 +  termvarnameKeepAliveTime=/varname/term
 +  listitemparaTakes time (in seconds) as
 argument . The connection needs to remain
   
^ there's a spurious space too much here...


 +  idle before TCP starts sending keepalive probes. 
 This controls the TCP_KEEPIDLE
 +  socket option (see
 +  
 citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry
 +  and the ulink
 +  
 url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP
 +  Keepalive HOWTO/ulink for details.)
 +  Defaults  value is 7200 seconds (2 
 hours)./para/listitem
 +/varlistentry

Could you indent this like the rest of the settings, please?

 +SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, 
 offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST),
 +SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, 
 offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST),
 +SD_BUS_PROPERTY(KeepAliveProbes, i, bus_property_get_int,
 offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST),

This should really be an u and use bus_property_get_unsigned(), no? I
mean, there is no negative count possible, is there?

 +if(s-keep_alive_time)
 +fprintf(f,
 +%sKeepAliveTime: %lo\n,
 +prefix, s-keep_alive_time / USEC_PER_SEC);

Please format this with format_timespan()!

Otherwise looks good!

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 1/3] socket: Add Support for TCP keep alive variables

2014-07-29 Thread Susant Sahani
The tcp keep alive variables now can be configured via conf
parameter. Follwing variables are now supported by this patch.

tcp_keepalive_intvl: The number of seconds between TCP keep-alive probes

tcp_keepalive_probes: The maximum number of TCP keep-alive probes to
send before giving up and killing the connection if no response is
obtained from the other end.

tcp_keepalive_time: The number of seconds a connection needs to be
idle before TCP begins sending out keep-alive probes.
---
 man/systemd.socket.xml| 36 +++
 src/core/dbus-socket.c|  3 +++
 src/core/load-fragment-gperf.gperf.m4 |  3 +++
 src/core/socket.c | 33 
 src/core/socket.h |  3 +++
 5 files changed, 78 insertions(+)

diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 09a7311..6dbcc81 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -488,6 +488,42 @@
 /varlistentry
 
 varlistentry
+  termvarnameKeepAliveTime=/varname/term
+  listitemparaTakes time (in seconds) as argument 
. The connection needs to remain
+  idle before TCP starts sending keepalive probes. 
This controls the TCP_KEEPIDLE
+  socket option (see
+  
citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry
+  and the ulink
+  
url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP
+  Keepalive HOWTO/ulink for details.)
+  Defaults  value is 7200 seconds (2 
hours)./para/listitem
+/varlistentry
+
+varlistentry
+  termvarnameKeepAliveInterval=/varname/term
+  listitemparaTakes time (in seconds) as argument 
between individual keepalive probes,
+  if the socket option SO_KEEPALIVE has  been set on 
this socket seconds as argument.
+  This controls the TCP_KEEPINTVL socket option (see
+  
citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry
+  and the ulink
+  
url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP
+  Keepalive HOWTO/ulink for details.)
+  Defaults  value is 75 seconds./para/listitem
+/varlistentry
+
+varlistentry
+  termvarnameKeepAliveProbes=/varname/term
+  listitemparaTakes interger as argument. It's the 
number of unacknowledged probes to
+  send before considering the connection dead and 
notifying the application layer.
+  This controls the TCP_KEEPCNT socket option (see
+  
citerefentryrefentrytitlesocket/refentrytitlemanvolnum7/manvolnum/citerefentry
+  and the ulink
+  
url=http://www.tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/;TCP
+  Keepalive HOWTO/ulink for details.)
+  Defaults  value is 9./para/listitem
+/varlistentry
+
+varlistentry
 termvarnamePriority=/varname/term
 listitemparaTakes an integer
 argument controlling the priority for
diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
index ad135a1..348afbd 100644
--- a/src/core/dbus-socket.c
+++ b/src/core/dbus-socket.c
@@ -97,6 +97,9 @@ const sd_bus_vtable bus_socket_vtable[] = {
 SD_BUS_PROPERTY(DirectoryMode, u, bus_property_get_mode, 
offsetof(Socket, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(Accept, b, bus_property_get_bool, offsetof(Socket, 
accept), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(KeepAlive, b, bus_property_get_bool, 
offsetof(Socket, keep_alive), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveTime, t, bus_property_get_usec, 
offsetof(Socket, keep_alive_time), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveInterval, t, bus_property_get_usec, 
offsetof(Socket, keep_alive_interval), SD_BUS_VTABLE_PROPERTY_CONST),
+SD_BUS_PROPERTY(KeepAliveProbes, i, bus_property_get_int, 
offsetof(Socket, keep_alive_cnt), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(Priority, i, bus_property_get_int, 
offsetof(Socket, priority), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(ReceiveBuffer, t, bus_property_get_size, 
offsetof(Socket, receive_buffer), SD_BUS_VTABLE_PROPERTY_CONST),
 SD_BUS_PROPERTY(SendBuffer,