diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-09-25 20:31:24 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-09-25 20:31:24 +0100 |
commit | 1e3ee834083227f552179f6e43902cba5a866e6b (patch) | |
tree | 5decf48f78a082c0baac73aac5b60d0bc42b3d53 /net/slirp.c | |
parent | 460b6c8e581aa06b86f59eebd9e52edfe7adf417 (diff) | |
parent | 13146a83951e045c810c37c5c11c2a016ebc0663 (diff) | |
download | qemu-1e3ee834083227f552179f6e43902cba5a866e6b.zip qemu-1e3ee834083227f552179f6e43902cba5a866e6b.tar.gz qemu-1e3ee834083227f552179f6e43902cba5a866e6b.tar.bz2 |
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
slirp updates
# gpg: Signature made Sun 24 Sep 2017 19:07:51 BST
# gpg: using RSA key 0x9E511E01C737F075
# gpg: Good signature from "Samuel Thibault <samuel.thibault@aquilenet.fr>"
# gpg: aka "Samuel Thibault <sthibault@debian.org>"
# gpg: aka "Samuel Thibault <samuel.thibault@gnu.org>"
# gpg: aka "Samuel Thibault <samuel.thibault@inria.fr>"
# gpg: aka "Samuel Thibault <samuel.thibault@labri.fr>"
# gpg: aka "Samuel Thibault <samuel.thibault@ens-lyon.org>"
# gpg: aka "Samuel Thibault <samuel.thibault@u-bordeaux.fr>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg: It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 900C B024 B679 31D4 0F82 304B D017 8C76 7D06 9EE6
# Subkey fingerprint: 9A37 3D36 64A8 DC62 DA0A 34FD 9E51 1E01 C737 F075
* remotes/thibault/tags/samuel-thibault:
slirp: Add a special case for the NULL socket
slirp: Fix intermittent send queue hangs on a socket
slirp: Add explanation for hostfwd parsing failure
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'net/slirp.c')
-rw-r--r-- | net/slirp.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/slirp.c b/net/slirp.c index 01ed21c..318a26e 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -496,9 +496,11 @@ static int slirp_hostfwd(SlirpState *s, const char *redir_str, char buf[256]; int is_udp; char *end; + const char *fail_reason = "Unknown reason"; p = redir_str; if (!p || get_str_sep(buf, sizeof(buf), &p, ':') < 0) { + fail_reason = "No : separators"; goto fail_syntax; } if (!strcmp(buf, "tcp") || buf[0] == '\0') { @@ -506,35 +508,43 @@ static int slirp_hostfwd(SlirpState *s, const char *redir_str, } else if (!strcmp(buf, "udp")) { is_udp = 1; } else { + fail_reason = "Bad protocol name"; goto fail_syntax; } if (!legacy_format) { if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { + fail_reason = "Missing : separator"; goto fail_syntax; } if (buf[0] != '\0' && !inet_aton(buf, &host_addr)) { + fail_reason = "Bad host address"; goto fail_syntax; } } if (get_str_sep(buf, sizeof(buf), &p, legacy_format ? ':' : '-') < 0) { + fail_reason = "Bad host port separator"; goto fail_syntax; } host_port = strtol(buf, &end, 0); if (*end != '\0' || host_port < 0 || host_port > 65535) { + fail_reason = "Bad host port"; goto fail_syntax; } if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) { + fail_reason = "Missing guest address"; goto fail_syntax; } if (buf[0] != '\0' && !inet_aton(buf, &guest_addr)) { + fail_reason = "Bad guest address"; goto fail_syntax; } guest_port = strtol(p, &end, 0); if (*end != '\0' || guest_port < 1 || guest_port > 65535) { + fail_reason = "Bad guest port"; goto fail_syntax; } @@ -547,7 +557,8 @@ static int slirp_hostfwd(SlirpState *s, const char *redir_str, return 0; fail_syntax: - error_setg(errp, "Invalid host forwarding rule '%s'", redir_str); + error_setg(errp, "Invalid host forwarding rule '%s' (%s)", redir_str, + fail_reason); return -1; } |