Page MenuHomeFreeBSD

D52329.diff
No OneTemporary

D52329.diff

diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c
--- a/usr.sbin/bhyve/rfb.c
+++ b/usr.sbin/bhyve/rfb.c
@@ -63,6 +63,7 @@
#include "bhyvegc.h"
#include "debug.h"
#include "console.h"
+#include "config.h"
#include "rfb.h"
#include "sockstream.h"
@@ -152,6 +153,8 @@
struct pixfmt pixfmt; /* owned by the write thread */
struct pixfmt new_pixfmt; /* managed with pixfmt_mtx */
uint32_t *pixrow;
+ char *fbname;
+ int fbnamelen;
};
struct rfb_pixfmt {
@@ -262,7 +265,7 @@
};
static void
-rfb_send_server_init_msg(int cfd)
+rfb_send_server_init_msg(struct rfb_softc *rc, int cfd)
{
struct bhyvegc_image *gc_image;
struct rfb_srvr_info sinfo;
@@ -284,9 +287,9 @@
sinfo.pixfmt.pad[0] = 0;
sinfo.pixfmt.pad[1] = 0;
sinfo.pixfmt.pad[2] = 0;
- sinfo.namelen = htonl(strlen("bhyve"));
+ sinfo.namelen = htonl(rc->fbnamelen);
(void)stream_write(cfd, &sinfo, sizeof(sinfo));
- (void)stream_write(cfd, "bhyve", strlen("bhyve"));
+ (void)stream_write(cfd, rc->fbname, rc->fbnamelen);
}
static void
@@ -1144,7 +1147,7 @@
len = stream_read(cfd, buf, 1);
/* 4a. Write server-init info */
- rfb_send_server_init_msg(cfd);
+ rfb_send_server_init_msg(rc, cfd);
if (!rc->zbuf) {
rc->zbuf = malloc(RFB_ZLIB_BUFSZ + 16);
@@ -1276,6 +1279,13 @@
rc->password = password;
+ rc->fbnamelen = asprintf(&rc->fbname, "bhyve:%s",
+ get_config_value("name"));
+ if (rc->fbnamelen < 0) {
+ EPRINTLN("rfb: failed to allocate memory for VNC title");
+ goto error;
+ }
+
rc->pixrow = malloc(RFB_MAX_WIDTH * sizeof(uint32_t));
if (rc->pixrow == NULL) {
EPRINTLN("rfb: failed to allocate memory for pixrow buffer");
@@ -1358,6 +1368,7 @@
free(rc->crc);
free(rc->crc_tmp);
free(rc->pixrow);
+ free(rc->fbname);
free(rc);
return (-1);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 16, 6:42 AM (6 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35126709
Default Alt Text
D52329.diff (1 KB)

Event Timeline