Skip to contentSkip to conversation

inet_parse: Clarify IPv6 comment and error message

PATCH In review Doug Evans via 5 participants 6 messages Mar 8, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 inet_parse: Clarify IPv6 comment and error message

Wrapping an IP address in square brackets does not necessarily mean the address is an IPv6 address. The wrapping is just an aid to parsing since IPv6 addresses have colons, but does not provide semantic information.
E.g., [127.0.0.1] is a valid way to write 127.0.0.1.

---
 util/qemu-sockets.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
util/qemu-sockets.c +5 -2
index 8af0278f15..0c41d372c0 100644
@@ -635,9 +635,12 @@ int inet_parse(InetSocketAddress *addr, const char *str, Error **errp)
             return -1;
         }
     } else if (str[0] == '[') {
-        /* IPv6 addr */
+        /*
+         * Probably, but not necessarily, an IPv6 addr.
+         * Note that [127.0.0.1] is also valid.
+         */
         if (sscanf(str, "[%64[^]]]:%32[^,]%n", host, port, &pos) != 2) {
-            error_setg(errp, "error parsing IPv6 address '%s'", str);
+            error_setg(errp, "error parsing address '%s'", str);
             return -1;
         }
     } else {
Signature · 1 line
2.30.1.766.gb4fecdf3b7-goog
#1 lore raw
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH] inet_parse: Clarify IPv6 comment and error message

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
6e42a49 inet_parse: Clarify IPv6 comment and error message

=== OUTPUT BEGIN ===
ERROR: Author email address is mangled by the mailing list #2:
Author: Doug Evans via <[email protected]>

total: 1 errors, 0 warnings, 14 lines checked

Commit 6e42a4981895 (inet_parse: Clarify IPv6 comment and error message) has style problems, please review. If any of these errors are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#2 lore raw

Not sure how this "Author email address is mangled" happened.

$ git format-patch -o patches/error-parsing-ipv6 -1
$ git send-email --to='[email protected],Samuel Thibault <
[email protected]>,"Daniel P. Berrangé" <[email protected]>' \
--smtp-server=foo
patches/error-parsing-ipv6/0001-inet_parse-Clarify-IPv6-comment-and-error-message.patch

It's possible my smtp-server arg munged things incorrectly, but I've done the identical thing for previous patches and not seen this for at least some of them.
Sigh.

Quoted 53 lines · On Sun, Mar 7, 2021 at 4:33 PM <[email protected]> wrote:

Patchew URL:
https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH] inet_parse: Clarify IPv6 comment and error message

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] ->
patchew/[email protected] Switched to a new branch 'test'
6e42a49 inet_parse: Clarify IPv6 comment and error message

=== OUTPUT BEGIN ===
ERROR: Author email address is mangled by the mailing list #2:
Author: Doug Evans via <[email protected]>

total: 1 errors, 0 warnings, 14 lines checked

Commit 6e42a4981895 (inet_parse: Clarify IPv6 comment and error message) has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1

The full log is available at

http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message
.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#3 lore raw
Quoted 8 lines · Doug Evans

Not sure how this "Author email address is mangled" happened.

$ git format-patch -o patches/error-parsing-ipv6 -1
$ git send-email --to='[email protected],Samuel Thibault <
[email protected]>,"Daniel P. Berrangé" <[email protected]>' \
--smtp-server=foo
patches/error-parsing-ipv6/0001-inet_parse-Clarify-IPv6-comment-and-error-message.patch
Quoted 4 lines

It's possible my smtp-server arg munged things incorrectly, but I've done the identical thing for previous patches and not seen this for at least some of them.
Sigh.

The 'via <[email protected]>' mangling is something that gnu.org mailman is configured to do. It used to do this in many scenarios, but supposedly it now only mangles when the sender has a bad DKIM signature and their domain has strict DMARC policies:

https://lists.gnu.org/archive/html/qemu-devel/2019-09/msg00416.html

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
Quoted 14 lines · Daniel P. Berrangé
Quoted 8 lines · Doug Evans

Not sure how this "Author email address is mangled" happened.

$ git format-patch -o patches/error-parsing-ipv6 -1
$ git send-email --to='[email protected],Samuel Thibault <
[email protected]>,"Daniel P. Berrangé" <[email protected]>' \
--smtp-server=foo
patches/error-parsing-ipv6/0001-inet_parse-Clarify-IPv6-comment-and-error-message.patch
Quoted 4 lines

It's possible my smtp-server arg munged things incorrectly, but I've done the identical thing for previous patches and not seen this for at least some of them.
Sigh.

Quoted 6 lines

The 'via <[email protected]>' mangling is something that gnu.org mailman is configured to do. It used to do this in many scenarios, but supposedly it now only mangles when the sender has a bad DKIM signature and their domain has strict DMARC policies:

https://lists.gnu.org/archive/html/qemu-devel/2019-09/msg00416.html

And the solution to avoid triggering the check failure is to include 'From: you <real@address>' as the first line of the body (which will then override whatever header mangling the list inflicted on your message). There are supposedly ways to configure git to do this automatically for you as part of 'git send-email', but as I don't suffer from the problem, I'm not sure off-hand what those steps are (git config format.from ?)

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org
Reviewed-by on v1 1/1
#5 lore raw
In reply to Doug Evans via
Quoted 10 lines · Doug Evans via

Wrapping an IP address in square brackets does not necessarily mean the address is an IPv6 address. The wrapping is just an aid to parsing since IPv6 addresses have colons, but does not provide semantic information.
E.g., [127.0.0.1] is a valid way to write 127.0.0.1.

---
 util/qemu-sockets.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|