summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-12-07 15:30:46 +0100
committerJan Moskyto Matejka <mq@ucw.cz>2016-12-07 15:30:46 +0100
commitad88b94bca78e010357a6c7806e1d5e01701d4a7 (patch)
tree9c06e9c1b0c87f372dcf27cc832d5692db112e80 /lib
parentd15b0b0a1b494c14b139d2d28706d82cd6e2f139 (diff)
parentaf62c0f9f1f6382fe88c8ae5e514f70c0b5b6d05 (diff)
Merge branch 'int-new-rpki-squashed' (early part) into int-new
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile4
-rw-r--r--lib/net.h3
-rw-r--r--lib/resource.c4
-rw-r--r--lib/resource.h2
-rw-r--r--lib/socket.h29
5 files changed, 38 insertions, 4 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 26d8bf65..a7da9802 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,3 +1,7 @@
+src := bitops.c checksum.c ip.c lists.c md5.c net.c patmatch.c printf.c sha1.c sha256.c sha512.c slists.c xmalloc.c
+obj := $(src-o-files)
+$(all-client)
+
src := bitops.c checksum.c event.c idm.c ip.c lists.c mac.c md5.c mempool.c net.c patmatch.c printf.c resource.c sha1.c sha256.c sha512.c slab.c slists.c tbf.c xmalloc.c
obj := $(src-o-files)
$(all-daemon)
diff --git a/lib/net.h b/lib/net.h
index 9b22c6be..e8310894 100644
--- a/lib/net.h
+++ b/lib/net.h
@@ -171,6 +171,9 @@ static inline int net_type_match(const net_addr *a, u32 mask)
static inline int net_is_ip(const net_addr *a)
{ return (a->type == NET_IP4) || (a->type == NET_IP6); }
+static inline int net_is_roa(const net_addr *a)
+{ return (a->type == NET_ROA4) || (a->type == NET_ROA6); }
+
static inline ip4_addr net4_prefix(const net_addr *a)
{ return ((net_addr_ip4 *) a)->prefix; }
diff --git a/lib/resource.c b/lib/resource.c
index 68718dfb..ab8c800f 100644
--- a/lib/resource.c
+++ b/lib/resource.c
@@ -31,7 +31,7 @@
struct pool {
resource r;
list inside;
- char *name;
+ const char *name;
};
static void pool_dump(resource *);
@@ -61,7 +61,7 @@ static int indent;
* parent pool.
*/
pool *
-rp_new(pool *p, char *name)
+rp_new(pool *p, const char *name)
{
pool *z = ralloc(p, &pool_class);
z->name = name;
diff --git a/lib/resource.h b/lib/resource.h
index 1a62d389..1a0568b4 100644
--- a/lib/resource.h
+++ b/lib/resource.h
@@ -37,7 +37,7 @@ struct resclass {
typedef struct pool pool;
void resource_init(void);
-pool *rp_new(pool *, char *); /* Create new pool */
+pool *rp_new(pool *, const char *); /* Create new pool */
void rfree(void *); /* Free single resource */
void rdump(void *); /* Dump to debug output */
size_t rmemsize(void *res); /* Return size of memory used by the resource */
diff --git a/lib/socket.h b/lib/socket.h
index 43db3cab..d5281b83 100644
--- a/lib/socket.h
+++ b/lib/socket.h
@@ -12,6 +12,29 @@
#include <errno.h>
#include "lib/resource.h"
+#ifdef HAVE_LIBSSH
+#define LIBSSH_LEGACY_0_4
+#include <libssh/libssh.h>
+#endif
+
+#ifdef HAVE_LIBSSH
+struct ssh_sock {
+ const char *username; /* (Required) SSH user name */
+ const char *server_hostkey_path; /* (Optional) Filepath to the SSH public key of remote side, can be knownhost file */
+ const char *client_privkey_path; /* (Optional) Filepath to the SSH private key of BIRD */
+ const char *subsystem; /* (Optional) Name of SSH subsytem */
+ ssh_session session; /* Internal */
+ ssh_channel channel; /* Internal */
+ int state; /* Internal */
+#define SK_SSH_CONNECT 0 /* Start state */
+#define SK_SSH_SERVER_KNOWN 1 /* Internal */
+#define SK_SSH_USERAUTH 2 /* Internal */
+#define SK_SSH_CHANNEL 3 /* Internal */
+#define SK_SSH_SESSION 4 /* Internal */
+#define SK_SSH_SUBSYSTEM 5 /* Internal */
+#define SK_SSH_ESTABLISHED 6 /* Final state */
+};
+#endif
typedef struct birdsock {
resource r;
@@ -20,6 +43,7 @@ typedef struct birdsock {
int subtype; /* Socket subtype */
void *data; /* User data */
ip_addr saddr, daddr; /* IPA_NONE = unspecified */
+ const char *host; /* Alternative to daddr, NULL = unspecified */
uint sport, dport; /* 0 = unspecified (for IP: protocol type) */
int tos; /* TOS / traffic class, -1 = default */
int priority; /* Local socket priority, -1 = default */
@@ -52,7 +76,8 @@ typedef struct birdsock {
node n;
void *rbuf_alloc, *tbuf_alloc;
char *password; /* Password for MD5 authentication */
- char *err; /* Error message */
+ const char *err; /* Error message */
+ struct ssh_sock *ssh; /* Used in SK_SSH */
} sock;
sock *sock_new(pool *); /* Allocate new socket */
@@ -115,6 +140,8 @@ extern int sk_priority_control; /* Suggested priority for control traffic, shou
#define SK_MAGIC 7 /* Internal use by sysdep code */
#define SK_UNIX_PASSIVE 8
#define SK_UNIX 9
+#define SK_SSH_ACTIVE 10 /* - - * * - ? - DA = host */
+#define SK_SSH 11
/*
* Socket subtypes