Commit be2e70ad authored by venaas's avatar venaas Committed by venaas

allowing build with only specific transports

git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@444 e88ac4ed-0b26-0410-9574-a7f39faa03bf
parent fb4af51e
CFLAGS = -g -Wall -pedantic -pthread
CFLAGS = -g -Wall -pedantic -pthread -DRADPROT_UDP -DRADPROT_TCP -DRADPROT_TLS -DRADPROT_DTLS
LDFLAGS = -lssl
OBJ = util.o debug.o list.o hash.o gconfig.o tlv11.o radmsg.o udp.o tcp.o tls.o dtls.o radsecproxy.o
......
......@@ -6,6 +6,7 @@
* copyright notice and this permission notice appear in all copies.
*/
#ifdef RADPROT_DTLS
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
......@@ -700,3 +701,8 @@ void initextradtls() {
if (pthread_create(&cl6th, NULL, udpdtlsclientrd, (void *)&client6_sock))
debugx(1, DBG_ERR, "pthread_create failed");
}
#else
const struct protodefs *dtlsinit(uint8_t h) {
return NULL;
}
#endif
......@@ -2482,12 +2482,15 @@ SSL_CTX *tlscreatectx(uint8_t type, struct tls *conf) {
sslinit();
switch (type) {
#ifdef RADPROT_TLS
case RAD_TLS:
ctx = SSL_CTX_new(TLSv1_method());
#ifdef DEBUG
SSL_CTX_set_info_callback(ctx, ssl_info_callback);
#endif
break;
#endif
#ifdef RADPROT_DTLS
case RAD_DTLS:
ctx = SSL_CTX_new(DTLSv1_method());
#ifdef DEBUG
......@@ -2495,6 +2498,7 @@ SSL_CTX *tlscreatectx(uint8_t type, struct tls *conf) {
#endif
SSL_CTX_set_read_ahead(ctx, 1);
break;
#endif
}
if (!ctx) {
debug(DBG_ERR, "tlscreatectx: Error initialising SSL/TLS in TLS context %s", conf->name);
......@@ -2556,6 +2560,7 @@ SSL_CTX *tlsgetctx(uint8_t type, struct tls *t) {
gettimeofday(&now, NULL);
switch (type) {
#ifdef RADPROT_TLS
case RAD_TLS:
if (t->tlsexpiry && t->tlsctx) {
if (t->tlsexpiry < now.tv_sec) {
......@@ -2569,6 +2574,8 @@ SSL_CTX *tlsgetctx(uint8_t type, struct tls *t) {
t->tlsexpiry = now.tv_sec + t->cacheexpiry;
}
return t->tlsctx;
#endif
#ifdef RADPROT_DTLS
case RAD_DTLS:
if (t->dtlsexpiry && t->dtlsctx) {
if (t->dtlsexpiry < now.tv_sec) {
......@@ -2582,6 +2589,7 @@ SSL_CTX *tlsgetctx(uint8_t type, struct tls *t) {
t->dtlsexpiry = now.tv_sec + t->cacheexpiry;
}
return t->dtlsctx;
#endif
}
return NULL;
}
......@@ -3636,14 +3644,30 @@ void getmainconfig(const char *configfile) {
debugx(1, DBG_ERR, "malloc failed");
if (!getgenericconfig(&cfs, NULL,
#ifdef RADPROT_UDP
"ListenUDP", CONF_MSTR, &listenargs[RAD_UDP],
#endif
#ifdef RADPROT_TCP
"ListenTCP", CONF_MSTR, &listenargs[RAD_TCP],
#endif
#ifdef RADPROT_TLS
"ListenTLS", CONF_MSTR, &listenargs[RAD_TLS],
#endif
#ifdef RADPROT_DTLS
"ListenDTLS", CONF_MSTR, &listenargs[RAD_DTLS],
#endif
#ifdef RADPROT_UDP
"SourceUDP", CONF_STR, &sourcearg[RAD_UDP],
#endif
#ifdef RADPROT_TCP
"SourceTCP", CONF_STR, &sourcearg[RAD_TCP],
#endif
#ifdef RADPROT_TLS
"SourceTLS", CONF_STR, &sourcearg[RAD_TLS],
#endif
#ifdef RADPROT_DTLS
"SourceDTLS", CONF_STR, &sourcearg[RAD_DTLS],
#endif
"TTLAttribute", CONF_STR, &options.ttlattr,
"addTTL", CONF_LINT, &addttl,
"LogLevel", CONF_LINT, &loglevel,
......@@ -3806,6 +3830,8 @@ int main(int argc, char **argv) {
}
for (i = 0; i < RAD_PROTOCOUNT; i++) {
if (!protodefs[i])
continue;
if (protodefs[i]->initextra)
protodefs[i]->initextra();
if (find_clconf_type(i, NULL))
......
......@@ -6,6 +6,7 @@
* copyright notice and this permission notice appear in all copies.
*/
#ifdef RADPROT_TCP
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
......@@ -368,3 +369,8 @@ void *tcplistener(void *arg) {
free(sp);
return NULL;
}
#else
const struct protodefs *tcpinit(uint8_t h) {
return NULL;
}
#endif
......@@ -6,6 +6,7 @@
* copyright notice and this permission notice appear in all copies.
*/
#ifdef RADPROT_TLS
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
......@@ -468,3 +469,8 @@ void *tlslistener(void *arg) {
free(sp);
return NULL;
}
#else
const struct protodefs *tlsinit(uint8_t h) {
return NULL;
}
#endif
......@@ -6,6 +6,7 @@
* copyright notice and this permission notice appear in all copies.
*/
#ifdef RADPROT_UDP
#include <signal.h>
#include <sys/socket.h>
#include <netinet/in.h>
......@@ -336,3 +337,8 @@ void initextraudp() {
debugx(1, DBG_ERR, "pthread_create failed");
}
}
#else
const struct protodefs *udpinit(uint8_t h) {
return NULL;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment