diff mbox

libceph: use CEPH_MON_PORT when the specified port is 0

Message ID 1388487284-4774-1-git-send-email-ilya.dryomov@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ilya Dryomov Dec. 31, 2013, 10:54 a.m. UTC
Similar to userspace, don't bail with "parse_ips bad ip ..." if the
specified port is port 0, instead use port CEPH_MON_PORT (6789, the
default monitor port).

Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
---
 net/ceph/messenger.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Sage Weil Dec. 31, 2013, 4:14 p.m. UTC | #1
Reviewed-by: Sage Weil <sage@inktank.com>

On Tue, 31 Dec 2013, Ilya Dryomov wrote:

> Similar to userspace, don't bail with "parse_ips bad ip ..." if the
> specified port is port 0, instead use port CEPH_MON_PORT (6789, the
> default monitor port).
> 
> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
> ---
>  net/ceph/messenger.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index bd172e1ee0ae..d2cadb5b2b63 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -1866,7 +1866,9 @@ int ceph_parse_ips(const char *c, const char *end,
>  				port = (port * 10) + (*p - '0');
>  				p++;
>  			}
> -			if (port > 65535 || port == 0)
> +			if (port == 0)
> +				port = CEPH_MON_PORT;
> +			else if (port > 65535)
>  				goto bad;
>  		} else {
>  			port = CEPH_MON_PORT;
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index bd172e1ee0ae..d2cadb5b2b63 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -1866,7 +1866,9 @@  int ceph_parse_ips(const char *c, const char *end,
 				port = (port * 10) + (*p - '0');
 				p++;
 			}
-			if (port > 65535 || port == 0)
+			if (port == 0)
+				port = CEPH_MON_PORT;
+			else if (port > 65535)
 				goto bad;
 		} else {
 			port = CEPH_MON_PORT;