diff mbox series

inet_parse: Clarify IPv6 comment and error message

Message ID 20210308002928.3385275-1-dje@google.com (mailing list archive)
State New, archived
Headers show
Series inet_parse: Clarify IPv6 comment and error message | expand

Commit Message

Doug Evans March 8, 2021, 12:29 a.m. UTC
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.

Signed-off-by: Doug Evans <dje@google.com>
---
 util/qemu-sockets.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

no-reply@patchew.org March 8, 2021, 12:33 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20210308002928.3385275-1-dje@google.com/



Hi,

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

Type: series
Message-id: 20210308002928.3385275-1-dje@google.com
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/20210308002928.3385275-1-dje@google.com -> patchew/20210308002928.3385275-1-dje@google.com
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 <qemu-devel@nongnu.org>

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/20210308002928.3385275-1-dje@google.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Doug Evans March 8, 2021, 1:31 a.m. UTC | #2
Not sure how this "Author email address is mangled" happened.

$ git format-patch -o patches/error-parsing-ipv6 -1
$ git send-email --to='qemu-devel@nongnu.org,Samuel Thibault <
samuel.thibault@ens-lyon.org>,"Daniel P. Berrangé" <berrange@redhat.com>' \
--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.


On Sun, Mar 7, 2021 at 4:33 PM <no-reply@patchew.org> wrote:

> Patchew URL:
> https://patchew.org/QEMU/20210308002928.3385275-1-dje@google.com/
>
>
>
> Hi,
>
> This series seems to have some coding style problems. See output below for
> more information:
>
> Type: series
> Message-id: 20210308002928.3385275-1-dje@google.com
> 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/20210308002928.3385275-1-dje@google.com ->
> patchew/20210308002928.3385275-1-dje@google.com
> 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 <qemu-devel@nongnu.org>
>
> 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/20210308002928.3385275-1-dje@google.com/testing.checkpatch/?type=message
> .
> ---
> Email generated automatically by Patchew [https://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com
Daniel P. Berrangé March 8, 2021, 11:30 a.m. UTC | #3
On Sun, Mar 07, 2021 at 05:31:24PM -0800, Doug Evans wrote:
> Not sure how this "Author email address is mangled" happened.
> 
> $ git format-patch -o patches/error-parsing-ipv6 -1
> $ git send-email --to='qemu-devel@nongnu.org,Samuel Thibault <
> samuel.thibault@ens-lyon.org>,"Daniel P. Berrangé" <berrange@redhat.com>' \
> --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.

The 'via <qemu-devel@nongnu.org>' 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
Daniel P. Berrangé March 8, 2021, 11:31 a.m. UTC | #4
On Sun, Mar 07, 2021 at 04:29:28PM -0800, Doug Evans via wrote:
> 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.
> 
> Signed-off-by: Doug Evans <dje@google.com>
> ---
>  util/qemu-sockets.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
Eric Blake March 8, 2021, 4:05 p.m. UTC | #5
On 3/8/21 5:30 AM, Daniel P. Berrangé wrote:
> On Sun, Mar 07, 2021 at 05:31:24PM -0800, Doug Evans wrote:
>> Not sure how this "Author email address is mangled" happened.
>>
>> $ git format-patch -o patches/error-parsing-ipv6 -1
>> $ git send-email --to='qemu-devel@nongnu.org,Samuel Thibault <
>> samuel.thibault@ens-lyon.org>,"Daniel P. Berrangé" <berrange@redhat.com>' \
>> --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.
> 
> The 'via <qemu-devel@nongnu.org>' 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 ?)
diff mbox series

Patch

diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index 8af0278f15..0c41d372c0 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -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 {