Skip to content

Commit

Permalink
Merge pull request #6 from ColinBS/feature/rtrlib
Browse files Browse the repository at this point in the history
Build Quagga without SSH support of RTRlib
  • Loading branch information
reuteran authored Aug 16, 2016
2 parents 382a886 + 9a7c5a0 commit ec156f4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
2 changes: 2 additions & 0 deletions bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
#include "rtrlib/rtr_mgr.h"
#include "rtrlib/lib/ip.h"
#include "rtrlib/transport/tcp/tcp_transport.h"
#if defined(FOUND_SSH)
#include "rtrlib/transport/ssh/ssh_transport.h"
#endif

/**********************************/
/** Declaration of variables **/
Expand Down
25 changes: 23 additions & 2 deletions bgpd/bgp_rpki_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
#include "rtrlib/rtrlib.h"
#include "rtrlib/lib/ip.h"
#include "rtrlib/transport/tcp/tcp_transport.h"
#if defined(FOUND_SSH)
#include "rtrlib/transport/ssh/ssh_transport.h"
#endif

#include "bgpd/bgpd.h"
#include "bgpd/bgp_table.h"
Expand Down Expand Up @@ -120,13 +122,15 @@ delete_cache(void* value)
}
else
{
#if defined(FOUND_SSH)
XFREE(MTYPE_BGP_RPKI_CACHE, cache_p->tr_config.ssh_config->host);
XFREE(MTYPE_BGP_RPKI_CACHE, cache_p->tr_config.ssh_config->username);
XFREE(MTYPE_BGP_RPKI_CACHE,
cache_p->tr_config.ssh_config->client_privkey_path);
XFREE(MTYPE_BGP_RPKI_CACHE,
cache_p->tr_config.ssh_config->server_hostkey_path);
XFREE(MTYPE_BGP_RPKI_CACHE, cache_p->tr_config.ssh_config);
#endif
}
XFREE(MTYPE_BGP_RPKI_CACHE, cache_p->rtr_socket->tr_socket);
XFREE(MTYPE_BGP_RPKI_CACHE, cache_p->rtr_socket);
Expand Down Expand Up @@ -189,6 +193,7 @@ find_cache(struct list* cache_list, const char* host, const char* port_string,
}
else
{
#if defined(FOUND_SSH)
if (strcmp(cache->tr_config.ssh_config->host, host) == 0)
{
if (port != 0)
Expand All @@ -200,6 +205,8 @@ find_cache(struct list* cache_list, const char* host, const char* port_string,
}
return cache;
}
#endif
break;
}
}
return NULL ;
Expand Down Expand Up @@ -239,7 +246,7 @@ add_ssh_cache(struct list* cache_list, const char* host,
const char* client_privkey_path, const char* client_pubkey_path,
const char* server_pubkey_path)
{

#if defined(FOUND_SSH)
struct tr_ssh_config* ssh_config_p;
struct tr_socket* tr_socket_p;
cache* cache_p;
Expand Down Expand Up @@ -280,6 +287,8 @@ add_ssh_cache(struct list* cache_list, const char* host,
cache_p->type = SSH;
listnode_add(cache_list, cache_p);
return SUCCESS;
#endif
return ERROR;
}

static void
Expand Down Expand Up @@ -403,12 +412,14 @@ rpki_config_write(struct vty * vty)
break;

case SSH:
#if defined(FOUND_SSH)
ssh_config = cache->tr_config.ssh_config;
vty_out(vty, " rpki cache %s %u %s %s %s %s",
ssh_config->host, ssh_config->port, ssh_config->username,
ssh_config->client_privkey_path,
ssh_config->server_hostkey_path != NULL ?
ssh_config->server_hostkey_path : " ", VTY_NEWLINE);
#endif
break;

default:
Expand Down Expand Up @@ -634,20 +645,28 @@ DEFUN (rpki_cache,
}
// use ssh connection
if (argc == 5)
{
{
// return_value is ERROR on default if
// there is no SSH support. Unexpected behavior!!!
return_value = ERROR;
#if defined(FOUND_SSH)
int port;
VTY_GET_INTEGER("rpki cache ssh port", port, argv[1]);
return_value = add_ssh_cache(
currently_selected_cache_group->cache_config_list, argv[0], port,
argv[2], argv[3], argv[4], NULL );
#endif
}
else if (argc == 6)
{
return_value = ERROR;
#if defined(FOUND_SSH)
unsigned int port;
VTY_GET_INTEGER("rpki cache ssh port", port, argv[1]);
return_value = add_ssh_cache(
currently_selected_cache_group->cache_config_list, argv[0], port,
argv[2], argv[3], argv[4], argv[5]);
#endif
}
// use tcp connection
else if (argc == 2)
Expand Down Expand Up @@ -831,9 +850,11 @@ DEFUN (show_rpki_cache_connection,
break;

case SSH:
#if defined(FOUND_SSH)
ssh_config = cache->tr_config.ssh_config;
vty_out(vty, " rpki cache %s %u %s", ssh_config->host,
ssh_config->port, VTY_NEWLINE);
#endif
break;

default:
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,17 @@ if test "${enable_rpki}" = "yes"; then
fi
AM_CONDITIONAL([HAVE_RPKI], test "x$RPKI" = "xtrue")

dnl ------------------------------------------
dnl Check whether rtrlib was build with ssh support
dnl ------------------------------------------
AC_MSG_CHECKING([whether the RTR Library is compiled with SSH])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "rtrlib/rtrlib.h"]],
[[struct tr_ssh_config config;]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(FOUND_SSH,,found_ssh)],
AC_MSG_RESULT(no)
)

dnl ---------------------------
dnl Check htonl works correctly
dnl ---------------------------
Expand Down

0 comments on commit ec156f4

Please sign in to comment.