summaryrefslogtreecommitdiff
path: root/sysdep
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-01-21 23:49:52 +0100
committerMaria Matejka <mq@ucw.cz>2023-01-21 23:49:52 +0100
commit21c4c8eafb7125375b2e562cc0e7e9d52bbb1aaf (patch)
tree22ddac5513f6495334666e7af2aa218640a1afb1 /sysdep
parent2f764c87ff3c8a8af6d3bc043b439276ba2b0a79 (diff)
parent1e47b9f203aaaad0fb658d40a1670f1d0437f1f8 (diff)
Merge commit '1e47b9f203aaaad0fb658d40a1670f1d0437f1f8' into thread-next
Diffstat (limited to 'sysdep')
-rw-r--r--sysdep/bsd/krt-sock.c4
-rw-r--r--sysdep/config.h2
-rw-r--r--sysdep/unix/main.c15
3 files changed, 15 insertions, 6 deletions
diff --git a/sysdep/bsd/krt-sock.c b/sysdep/bsd/krt-sock.c
index 0706f546..fcf9ac4d 100644
--- a/sysdep/bsd/krt-sock.c
+++ b/sysdep/bsd/krt-sock.c
@@ -193,6 +193,10 @@ static inline void
sockaddr_fill_dl(struct sockaddr_dl *sa, struct iface *ifa)
{
uint len = OFFSETOF(struct sockaddr_dl, sdl_data);
+
+ /* Workaround for FreeBSD 13.0 */
+ len = MAX(len, sizeof(struct sockaddr));
+
memset(sa, 0, len);
sa->sdl_len = len;
sa->sdl_family = AF_LINK;
diff --git a/sysdep/config.h b/sysdep/config.h
index 5cdadbb0..9b0591a3 100644
--- a/sysdep/config.h
+++ b/sysdep/config.h
@@ -13,7 +13,7 @@
#ifdef GIT_LABEL
#define BIRD_VERSION XSTR1(GIT_LABEL)
#else
-#define BIRD_VERSION "2.0.10"
+#define BIRD_VERSION "2.0.11"
#endif
/* Include parameters determined by configure script */
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index b15376cc..1ed57a99 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -448,7 +448,7 @@ cli_get_command(cli *c)
{
sock *s = c->sock;
ASSERT_DIE(c->sock);
- byte *t = c->rx_aux ? : s->rbuf;
+ byte *t = s->rbuf;
byte *tend = s->rpos;
byte *d = c->rx_pos;
byte *dend = c->rx_buf + CLI_RX_BUF_SIZE - 2;
@@ -459,16 +459,22 @@ cli_get_command(cli *c)
t++;
else if (*t == '\n')
{
+ *d = 0;
t++;
+
+ /* Move remaining data and reset pointers */
+ uint rest = (t < tend) ? (tend - t) : 0;
+ memmove(s->rbuf, t, rest);
+ s->rpos = s->rbuf + rest;
c->rx_pos = c->rx_buf;
- c->rx_aux = t;
- *d = 0;
+
return (d < dend) ? 1 : -1;
}
else if (d < dend)
*d++ = *t++;
}
- c->rx_aux = s->rpos = s->rbuf;
+
+ s->rpos = s->rbuf;
c->rx_pos = d;
return 0;
}
@@ -516,7 +522,6 @@ cli_connect(sock *s, uint size UNUSED)
s->pool = c->pool; /* We need to have all the socket buffers allocated in the cli pool */
s->fast_rx = 1;
c->rx_pos = c->rx_buf;
- c->rx_aux = NULL;
rmove(s, c->pool);
return 1;
}