- For security reasons by default listen on localhost address,

not on wildcard. [1]
- Move the default port assignment from pci_fbuf.c to rfb.c,
  to avoid polluting pci_fbuf.c with network things.

Suggested by:	grehan
This commit is contained in:
Gleb Smirnoff 2017-04-28 05:32:26 +00:00
parent 3909a600a5
commit bc5d44ec53
2 changed files with 2 additions and 4 deletions

View File

@ -365,8 +365,6 @@ pci_fbuf_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
sc->fsc_pi = pi;
sc->rfb_port = 5900;
error = pci_fbuf_parse_opts(sc, opts);
if (error != 0)
goto done;

View File

@ -897,11 +897,11 @@ rfb_init(char *hostname, int port, int wait)
sin.sin_len = sizeof(sin);
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
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_ANY);
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
if (bind(rc->sfd, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
perror("bind");