Skip to content

Commit

Permalink
add config option for tcpKeepalive (client and server)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Mauchle committed May 16, 2017
1 parent 5f70899 commit b539e01
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions radsecproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2716,6 +2716,7 @@ int confclient_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
#endif
"DuplicateInterval", CONF_LINT, &dupinterval,
"addTTL", CONF_LINT, &addttl,
"tcpKeepalive", CONF_BLN, &conf->keepalive,
"rewrite", CONF_STR, &rewriteinalias,
"rewriteIn", CONF_STR, &conf->confrewritein,
"rewriteOut", CONF_STR, &conf->confrewriteout,
Expand Down Expand Up @@ -2899,6 +2900,7 @@ int confserver_cb(struct gconffile **cf, void *arg, char *block, char *opt, char
"CertificateNameCheck", CONF_BLN, &conf->certnamecheck,
#endif
"addTTL", CONF_LINT, &addttl,
"tcpKeepalive", CONF_BLN, &conf->keepalive,
"rewrite", CONF_STR, &rewriteinalias,
"rewriteIn", CONF_STR, &conf->confrewritein,
"rewriteOut", CONF_STR, &conf->confrewriteout,
Expand Down
1 change: 1 addition & 0 deletions radsecproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ struct clsrvconf {
uint8_t dupinterval;
uint8_t certnamecheck;
uint8_t addttl;
uint8_t keepalive;
uint8_t loopprevention;
struct rewrite *rewritein;
struct rewrite *rewriteout;
Expand Down
5 changes: 4 additions & 1 deletion tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ int tcpconnect(struct server *server, struct timeval *when, int timeout, char *t
if (server->sock >= 0)
close(server->sock);
if ((server->sock = connecttcphostlist(server->conf->hostports, srcres)) >= 0) {
enable_keepalive(server->sock);
if (server->conf->keepalive)
enable_keepalive(server->sock);
break;
}
}
Expand Down Expand Up @@ -335,6 +336,8 @@ void *tcpservernew(void *arg) {
if (conf) {
client = addclient(conf, 1);
if (client) {
if(conf->keepalive)
enable_keepalive(s);
client->sock = s;
client->addr = addr_copy((struct sockaddr *)&from);
tcpserverrd(client);
Expand Down
7 changes: 5 additions & 2 deletions tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ int tlsconnect(struct server *server, struct timeval *when, int timeout, char *t
if ((server->sock = connecttcphostlist(server->conf->hostports, srcres)) < 0)
continue;

enable_keepalive(server->sock);
if (server->conf->keepalive)
enable_keepalive(server->sock);

SSL_free(server->ssl);
server->ssl = NULL;
Expand Down Expand Up @@ -424,14 +425,16 @@ void *tlsservernew(void *arg) {
cert = verifytlscert(ssl);
if (!cert)
goto exit;
accepted_tls = conf->tlsconf;
accepted_tls = conf->tlsconf;
}

while (conf) {
if (accepted_tls == conf->tlsconf && verifyconfcert(cert, conf)) {
X509_free(cert);
client = addclient(conf, 1);
if (client) {
if (conf->keepalive)
enable_keepalive(s);
client->ssl = ssl;
client->addr = addr_copy((struct sockaddr *)&from);
tlsserverrd(client);
Expand Down

0 comments on commit b539e01

Please sign in to comment.