summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:58:22 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-11-25 23:58:22 +0100
commitd854968453a5a32c5bc786d0c83ab0040de17bea (patch)
tree504076f1565e8cb9ab1b0fd944d7d68d47095cdd
parentdc665727dcf149873be53c6e9a1616ae7b8d97e6 (diff)
parent8041b0e93695e788fe16343aa71334e834e22b35 (diff)
Merge branch 'tmp3' into wireguard-next-tmp7-1
-rw-r--r--conf/cf-lex.l2
-rw-r--r--filter/config.Y4
-rw-r--r--lib/base64.c13
-rw-r--r--lib/base64.h6
-rw-r--r--proto/wireguard/config.Y2
5 files changed, 15 insertions, 12 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l
index 5eb709bc..8c20b2d0 100644
--- a/conf/cf-lex.l
+++ b/conf/cf-lex.l
@@ -354,7 +354,7 @@ else: {
<BQUOTED><<EOF>> cf_error("Unterminated byte string");
<BQUOTED>["] {
BEGIN(INITIAL);
- struct bytestring *bytes;
+ struct adata *bytes;
bytes = cfg_allocz(sizeof(*bytes) + quoted_buffer.used);
memcpy(bytes->data, quoted_buffer.data, quoted_buffer.used);
diff --git a/filter/config.Y b/filter/config.Y
index 11b1a7f1..4f857350 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -242,7 +242,7 @@ f_new_sub_tlv_tunnel_ep(u32 type, ip_addr ip)
}
static struct f_tree *
-f_new_sub_tlv_encap(u32 st_type, u32 type, const struct bytestring *bytes)
+f_new_sub_tlv_encap(u32 st_type, u32 type, const struct adata *bytes)
{
struct f_tree *t;
@@ -263,7 +263,7 @@ f_new_sub_tlv_encap(u32 st_type, u32 type, const struct bytestring *bytes)
}
static struct f_tree *
-f_new_sub_tlv_unknown(u32 type, const struct bytestring *bytes)
+f_new_sub_tlv_unknown(u32 type, const struct adata *bytes)
{
struct f_tree *t;
diff --git a/lib/base64.c b/lib/base64.c
index d5f3ae9b..27bc7bc4 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -7,6 +7,7 @@
*/
#include "nest/bird.h"
+#include "nest/route.h"
#include "conf/conf.h"
#include "lib/resource.h"
#include "lib/base64.h"
@@ -26,12 +27,12 @@ static const unsigned char base64_table[65] =
* nul terminated to make it easier to use as a C string. The nul terminator is
* not included in out_len.
*/
-struct bytestring * base64_encode(linpool *pool,
+struct adata * base64_encode(linpool *pool,
const unsigned char *src, size_t len,
size_t *out_len)
{
unsigned char *pos;
- struct bytestring *out;
+ struct adata *out;
const unsigned char *end, *in;
size_t olen;
int line_len;
@@ -41,7 +42,7 @@ struct bytestring * base64_encode(linpool *pool,
olen++; /* nul termination */
if (olen < len)
return NULL; /* integer overflow */
- out = lp_alloc(pool, sizeof(struct bytestring) + olen);
+ out = lp_alloc(pool, sizeof(struct adata) + olen);
if (out == NULL)
return NULL;
@@ -97,14 +98,14 @@ struct bytestring * base64_encode(linpool *pool,
*
* Caller is responsible for freeing the returned buffer.
*/
-struct bytestring * base64_decode_bs(linpool *pool,
+struct adata * base64_decode_bs(linpool *pool,
const unsigned char *src, size_t len,
size_t *out_len)
{
unsigned char dtable[256], *pos, block[4], tmp;
size_t i, count, olen;
int pad = 0;
- struct bytestring *out;
+ struct adata *out;
memset(dtable, 0x80, 256);
for (i = 0; i < sizeof(base64_table) - 1; i++)
@@ -121,7 +122,7 @@ struct bytestring * base64_decode_bs(linpool *pool,
return NULL;
olen = count / 4 * 3;
- out = lp_alloc(pool, sizeof(struct bytestring) + olen);
+ out = lp_alloc(pool, sizeof(struct adata) + olen);
if (out == NULL)
return NULL;
pos = out->data;
diff --git a/lib/base64.h b/lib/base64.h
index 8ca4dd9b..99c3ef82 100644
--- a/lib/base64.h
+++ b/lib/base64.h
@@ -3,9 +3,11 @@
#include "lib/resource.h"
-struct bytestring * base64_encode_bs(linpool *pool, const unsigned char *src, size_t len,
+struct adata;
+
+struct adata * base64_encode_bs(linpool *pool, const unsigned char *src, size_t len,
size_t *out_len);
-struct bytestring * base64_decode_bs(linpool *pool, const unsigned char *src, size_t len,
+struct adata * base64_decode_bs(linpool *pool, const unsigned char *src, size_t len,
size_t *out_len);
#endif /* _BIRD_BASE64_H_ */
diff --git a/proto/wireguard/config.Y b/proto/wireguard/config.Y
index 6a435da3..0fae832a 100644
--- a/proto/wireguard/config.Y
+++ b/proto/wireguard/config.Y
@@ -23,7 +23,7 @@ typedef char wg_key_b64_string[45];
int wg_key_from_base64(u8 key[32], const wg_key_b64_string base64);
static struct f_tree *
-f_new_sub_tlv_wg(u32 type, const struct bytestring *bs)
+f_new_sub_tlv_wg(u32 type, const struct adata *bs)
{
struct f_tree *t = f_new_tree();
t->right = t;