From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Roth Subject: Re: [Qemu-devel] [PATCH v3 8/9] net: split hostname and service by last colon Date: Tue, 13 Mar 2012 14:34:16 -0500 Message-ID: <20120313193416.GD3699@illuin> References: <20120306224330.24264.9494.stgit@dhcp-8-167.nay.redhat.com> <20120306224848.24264.53905.stgit@dhcp-8-167.nay.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, quintela@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org, owasserm@redhat.com, laine@redhat.com To: Amos Kong Return-path: Received: from mail-gx0-f174.google.com ([209.85.161.174]:37552 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753789Ab2CMTeX (ORCPT ); Tue, 13 Mar 2012 15:34:23 -0400 Received: by gghe5 with SMTP id e5so945761ggh.19 for ; Tue, 13 Mar 2012 12:34:23 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20120306224848.24264.53905.stgit@dhcp-8-167.nay.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 07, 2012 at 06:48:48AM +0800, Amos Kong wrote: > IPv6 address contains colons, parse will be wrong. > > [2312::8274]:5200 > > Signed-off-by: Amos Kong > --- > net.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/net.c b/net.c > index 2518e5f..d6ce1fa 100644 > --- a/net.c > +++ b/net.c > @@ -84,7 +84,7 @@ static int get_str_sep(char *buf, int buf_size, const char **pp, int sep) > const char *p, *p1; > int len; > p = *pp; > - p1 = strchr(p, sep); > + p1 = strrchr(p, sep); Some callers expect get_str_sep() to split from the front, net/slirp.c:net_slirp_hostfwd_remove() for example. Would add a seperate helper, or replace it with a wrapper around a more generic implementation. > if (!p1) > return -1; > len = p1 - p; > >