]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
RPKI: Allow build without libSSH
authorMaria Matejka <mq@ucw.cz>
Tue, 4 Feb 2020 09:15:35 +0000 (10:15 +0100)
committerMaria Matejka <mq@ucw.cz>
Tue, 4 Feb 2020 09:15:35 +0000 (10:15 +0100)
configure.ac
proto/rpki/config.Y
proto/rpki/rpki.c
proto/rpki/ssh_transport.c
proto/rpki/transport.h

index 40f021a16d1ff49e9da18a5bab7218d329c25139..da8546a6934133d1a6f774c22bbe0e268c18a45d 100644 (file)
@@ -37,7 +37,7 @@ AC_ARG_ENABLE([pthreads],
 )
 
 AC_ARG_ENABLE([libssh],
-  [AS_HELP_STRING([--enable-libssh], [enable LibSSH support together with RPKI @<:@try@:>@])],
+  [AS_HELP_STRING([--enable-libssh], [enable LibSSH support in RPKI @<:@try@:>@])],
   [],
   [enable_libssh=try]
 )
@@ -271,7 +271,6 @@ if test "$enable_libssh" != no ; then
   if test "$fail" != yes ; then
     AC_DEFINE([HAVE_LIBSSH], [1], [Define to 1 if you have the `ssh' library (-lssh).])
     DAEMON_LIBS="-lssh $DAEMON_LIBS"
-    proto_rpki=rpki
     enable_libssh=yes
   else
     if test "$enable_libssh" = yes ; then
@@ -296,7 +295,7 @@ if test "$enable_mpls_kernel" != no ; then
   fi
 fi
 
-all_protocols="$proto_bfd babel bgp mrt ospf perf pipe radv rip $proto_rpki static"
+all_protocols="$proto_bfd babel bgp mrt ospf perf pipe radv rip rpki static"
 
 all_protocols=`echo $all_protocols | sed 's/ /,/g'`
 
@@ -453,6 +452,7 @@ AC_MSG_RESULT([        System configuration:        $sysdesc])
 AC_MSG_RESULT([        Debugging:              $enable_debug])
 AC_MSG_RESULT([        POSIX threads:          $enable_pthreads])
 AC_MSG_RESULT([        Routing protocols:      $protocols])
+AC_MSG_RESULT([        LibSSH support in RPKI: $enable_libssh])
 AC_MSG_RESULT([        Kernel MPLS support:    $enable_mpls_kernel])
 AC_MSG_RESULT([        Client:                 $enable_client])
 
index 63c7105cd073462e6171c7b2bdaa29239b377e51..924066f8e03967f4b0d0a11a1b85ff0a830e7e38 100644 (file)
@@ -117,9 +117,13 @@ rpki_transport_tcp_init:
 
 rpki_transport_ssh_init:
 {
+#if HAVE_LIBSSH
   rpki_check_unused_transport();
   RPKI_CFG->tr_config.spec = cfg_allocz(sizeof(struct rpki_tr_ssh_config));
   RPKI_CFG->tr_config.type = RPKI_TR_SSH;
+#else
+  cf_error("This build doesn't support SSH");
+#endif
 };
 
 rpki_transport_ssh_opts:
index 70cd0cdd1060bec03851466abc9e213a36022661..aa07f7d9d323208da2361e487f217980d2f0dcd9 100644 (file)
@@ -579,7 +579,9 @@ rpki_init_cache(struct rpki_proto *p, struct rpki_config *cf)
   switch (cf->tr_config.type)
   {
   case RPKI_TR_TCP: rpki_tr_tcp_init(cache->tr_sock); break;
+#if HAVE_LIBSSH
   case RPKI_TR_SSH: rpki_tr_ssh_init(cache->tr_sock); break;
+#endif
   };
 
   CACHE_DBG(cache, "Connection object created");
@@ -683,6 +685,7 @@ rpki_reconfigure_cache(struct rpki_proto *p UNUSED, struct rpki_cache *cache, st
     CACHE_TRACE(D_EVENTS, cache, "Transport type changed");
     return NEED_RESTART;
   }
+#if HAVE_LIBSSH
   else if (new->tr_config.type == RPKI_TR_SSH)
   {
     struct rpki_tr_ssh_config *ssh_old = (void *) old->tr_config.spec;
@@ -695,6 +698,7 @@ rpki_reconfigure_cache(struct rpki_proto *p UNUSED, struct rpki_cache *cache, st
       try_fast_reconnect = 1;
     }
   }
+#endif
 
 #define TEST_INTERVAL(name, Name)                                              \
     if (cache->name##_interval != new->name##_interval ||                      \
@@ -813,7 +817,9 @@ rpki_show_proto_info(struct proto *P)
 
     switch (cf->tr_config.type)
     {
+#if HAVE_LIBSSH
     case RPKI_TR_SSH: transport_name = "SSHv2"; break;
+#endif
     case RPKI_TR_TCP: transport_name = "Unprotected over TCP"; break;
     };
 
@@ -887,9 +893,11 @@ rpki_check_config(struct rpki_config *cf)
     /* Set default port numbers */
     switch (cf->tr_config.type)
     {
+#if HAVE_LIBSSH
     case RPKI_TR_SSH:
       cf->port = RPKI_SSH_PORT;
       break;
+#endif
     default:
       cf->port = RPKI_TCP_PORT;
     }
index 13e061fc73dd21731a988f43e8d23fcc6f376f9e..469eb199addbe157469f6f14bc857622350a404a 100644 (file)
@@ -17,6 +17,8 @@
 
 #include "rpki.h"
 
+#if HAVE_LIBSSH
+
 static int
 rpki_tr_ssh_open(struct rpki_tr_sock *tr)
 {
@@ -71,3 +73,5 @@ rpki_tr_ssh_init(struct rpki_tr_sock *tr)
   tr->open_fp = &rpki_tr_ssh_open;
   tr->ident_fp = &rpki_tr_ssh_ident;
 }
+
+#endif
index f90b7e4278b42cffd5dd8e485ca5fdbda32389b0..bb8d41eb2da1c022b361a2be10525814faf7adf5 100644 (file)
@@ -51,7 +51,9 @@ const char *rpki_tr_ident(struct rpki_tr_sock *tr);
 /* Types of supported transports */
 enum rpki_tr_type {
   RPKI_TR_TCP,                         /* Unprotected transport over TCP */
+#if HAVE_LIBSSH
   RPKI_TR_SSH,                         /* Protected transport by SSHv2 connection */
+#endif
 };
 
 /* Common configure structure for transports */