FreeBSD Bugzilla – Attachment 198462 Details for
Bug 232018
[PATCH][bhyve] Add IPv6 support to VNC frame buffer server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated version of you patch for review
20181022-bhyve-v6-vnc.diff (text/plain), 5.43 KB, created by
Bjoern A. Zeeb
on 2018-10-22 11:53:31 UTC
(
hide
)
Description:
Updated version of you patch for review
Filename:
MIME Type:
Creator:
Bjoern A. Zeeb
Created:
2018-10-22 11:53:31 UTC
Size:
5.43 KB
patch
obsolete
>Index: usr.sbin/bhyve/Makefile >=================================================================== >--- usr.sbin/bhyve/Makefile (revision 339586) >+++ usr.sbin/bhyve/Makefile (working copy) >@@ -73,6 +73,12 @@ SRCS+= vmm_instruction_emul.c > > LIBADD= vmmapi md pthread z util sbuf cam > >+.if ${MK_INET_SUPPORT} != "no" >+CFLAGS+=-DINET >+.endif >+.if ${MK_INET6_SUPPORT} != "no" >+CFLAGS+=-DINET6 >+.endif > .if ${MK_OPENSSL} == "no" > CFLAGS+=-DNO_OPENSSL > .else >Index: usr.sbin/bhyve/bhyve.8 >=================================================================== >--- usr.sbin/bhyve/bhyve.8 (revision 339586) >+++ usr.sbin/bhyve/bhyve.8 (working copy) >@@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" >-.Dd Aug 23, 2018 >+.Dd October 20, 2018 > .Dt BHYVE 8 > .Os > .Sh NAME >@@ -369,7 +369,7 @@ Framebuffer devices: > .Bl -tag -width 10n > .It Oo rfb= Ns Oo Ar IP: Oc Ns Ar port Oc Ns Oo ,w= Ns Ar width Oc Ns Oo ,h= Ns Ar height Oc Ns Oo ,vga= Ns Ar vgaconf Oc Ns Oo Ns ,wait Oc Ns Oo ,password= Ns Ar password Oc > .Bl -tag -width 8n >-.It Ar IP:port >+.It Ar IPv4:port No or Ar [IPv6%zone]:port > An > .Ar IP > address and a >@@ -376,7 +376,8 @@ address and a > .Ar port > VNC should listen on. > The default is to listen on localhost IPv4 address and default VNC port 5900. >-Listening on an IPv6 address is not supported. >+An IPv6 address must be enclosed in square brackets and may contain an >+optional zone identifer. > .It Ar width No and Ar height > A display resolution, width and height, respectively. > If not specified, a default resolution of 1024x768 pixels will be used. >@@ -587,6 +588,20 @@ bhyve -c 2 -m 4G -w -H \\ > -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ > uefivm > .Ed >+.Pp >+Run a UEFI virtual machine with a VNC display that is bound to all IPv6 >+addresses on port 5900. >+.Bd -literal -offset indent >+bhyve -c 2 -m 4G -w -H \\ >+ -s 0,hostbridge \\ >+ -s 4,ahci-hd,disk.img \\ >+ -s 5,virtio-net,tap0 \\ >+ -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\ >+ -s 30,xhci,tablet \\ >+ -s 31,lpc -l com1,stdio \\ >+ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ >+ uefivm >+.Ed > .Sh SEE ALSO > .Xr bhyve 4 , > .Xr nmdm 4 , >Index: usr.sbin/bhyve/pci_fbuf.c >=================================================================== >--- usr.sbin/bhyve/pci_fbuf.c (revision 339586) >+++ usr.sbin/bhyve/pci_fbuf.c (working copy) >@@ -251,13 +251,33 @@ pci_fbuf_parse_opts(struct pci_fbuf_softc *sc, cha > xopts, config)); > > if (!strcmp(xopts, "tcp") || !strcmp(xopts, "rfb")) { >- /* parse host-ip:port */ >- tmpstr = strsep(&config, ":"); >- if (!config) >- sc->rfb_port = atoi(tmpstr); >- else { >+ /* >+ * IPv4 -- host-ip:port >+ * IPv6 -- [host-ip%zone]:port >+ * XXX for now port is mandatory. >+ */ >+ tmpstr = strsep(&config, "]"); >+ if (config) { >+ if (tmpstr[0] == '[') >+ tmpstr++; >+ sc->rfb_host = tmpstr; >+ if (config[0] == ':') >+ config++; >+ else { >+ pci_fbuf_usage(xopts); >+ ret = -1; >+ goto done; >+ } > sc->rfb_port = atoi(config); >- sc->rfb_host = tmpstr; >+ } else { >+ config = tmpstr; >+ tmpstr = strsep(&config, ":"); >+ if (!config) >+ sc->rfb_port = atoi(tmpstr); >+ else { >+ sc->rfb_port = atoi(config); >+ sc->rfb_host = tmpstr; >+ } > } > } else if (!strcmp(xopts, "vga")) { > if (!strcmp(config, "off")) { >Index: usr.sbin/bhyve/rfb.c >=================================================================== >--- usr.sbin/bhyve/rfb.c (revision 339586) >+++ usr.sbin/bhyve/rfb.c (working copy) >@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); > #include <machine/cpufunc.h> > #include <machine/specialreg.h> > #include <netinet/in.h> >+#include <netdb.h> > > #include <assert.h> > #include <err.h> >@@ -960,8 +961,11 @@ sse42_supported(void) > int > rfb_init(char *hostname, int port, int wait, char *password) > { >+ int e; >+ char servname[6]; > struct rfb_softc *rc; >- struct sockaddr_in sin; >+ struct addrinfo *ai; >+ struct addrinfo hints; > int on = 1; > #ifndef WITHOUT_CAPSICUM > cap_rights_t rights; >@@ -978,29 +982,43 @@ rfb_init(char *hostname, int port, int wait, char > > rc->password = password; > >- rc->sfd = socket(AF_INET, SOCK_STREAM, 0); >+ snprintf(servname, sizeof(servname), "%d", port ? port : 5900); >+ >+ if (!hostname || strlen(hostname) == 0) >+#if defined(INET) >+ hostname = "127.0.0.1"; >+#elif defined(INET6) >+ hostname = "[::1]"; >+#endif >+ >+ memset(&hints, 0, sizeof(hints)); >+ hints.ai_family = AF_UNSPEC; >+ hints.ai_socktype = SOCK_STREAM; >+ hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_PASSIVE; >+ >+ if ((e = getaddrinfo(hostname, servname, &hints, &ai)) != 0) { >+ fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(e)); >+ return(-1); >+ } >+ >+ rc->sfd = socket(ai->ai_family, ai->ai_socktype, 0); > if (rc->sfd < 0) { > perror("socket"); >+ freeaddrinfo(ai); > return (-1); > } > > setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); > >- sin.sin_len = sizeof(sin); >- sin.sin_family = AF_INET; >- sin.sin_port = port ? htons(port) : htons(5900); >- if (hostname && strlen(hostname) > 0) >- inet_pton(AF_INET, hostname, &(sin.sin_addr)); >- else >- sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); >- >- if (bind(rc->sfd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { >+ if (bind(rc->sfd, ai->ai_addr, ai->ai_addrlen) < 0) { > perror("bind"); >+ freeaddrinfo(ai); > return (-1); > } > > if (listen(rc->sfd, 1) < 0) { > perror("listen"); >+ freeaddrinfo(ai); > return (-1); > } > >@@ -1028,5 +1046,6 @@ rfb_init(char *hostname, int port, int wait, char > pthread_mutex_unlock(&rc->mtx); > } > >+ freeaddrinfo(ai); > return (0); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 232018
:
197853
| 198462