From patchwork Tue Dec 31 10:54:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3421761 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 82442C02DC for ; Tue, 31 Dec 2013 10:55:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B095D20120 for ; Tue, 31 Dec 2013 10:55:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB0552011B for ; Tue, 31 Dec 2013 10:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812Ab3LaKzg (ORCPT ); Tue, 31 Dec 2013 05:55:36 -0500 Received: from mail-ea0-f171.google.com ([209.85.215.171]:42432 "EHLO mail-ea0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254Ab3LaKzg (ORCPT ); Tue, 31 Dec 2013 05:55:36 -0500 Received: by mail-ea0-f171.google.com with SMTP id h10so5440143eak.16 for ; Tue, 31 Dec 2013 02:55:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Uj0yLncUQYIOC7oVeXfVEozf0MY/U4z5wdpc5/lrhOY=; b=iGJSyeXsxVRaGX4nEQLSQVP6OvpDrCR5LCnUpJBWGUo8U5C9l4Z0oLjp/+IKah1ewM 78y2oObI36yd0BfA71Hqven9yyFeRp8eMjKkfh2vPV5ZlbKVznnxRmQ1RruG6Oj1w7IH i+fnXa0jczwV6EfQWwgtmk41c1yr8ERQS6WM6EXRisGkVDb9Y01dPLbUeVOzELddYQjt i5aJ7q8WA2qZ8Gpnd4Vu3lPgc8vk25FlBrhzz1XKluFufzeB8poHTA94sfG04CxCY6Ch EO0+nJNqwcDAQi5IzSXxI+s1dCEHUJR8GB/xwEhWKPqtRcPnpDEQUR++e3n+EwJHd/e1 Iyrw== X-Gm-Message-State: ALoCoQm58EIetrE92WGc+26gcVMyRSJzjxkM1Fes/Xttc1pOtBSDZfd800UO9TN+9iSfaG3SIXBS X-Received: by 10.15.75.68 with SMTP id k44mr6099142eey.57.1388487334674; Tue, 31 Dec 2013 02:55:34 -0800 (PST) Received: from localhost ([109.110.66.145]) by mx.google.com with ESMTPSA id v7sm117120534eel.2.2013.12.31.02.55.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 31 Dec 2013 02:55:34 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: ilya.dryomov@inktank.com Subject: [PATCH] libceph: use CEPH_MON_PORT when the specified port is 0 Date: Tue, 31 Dec 2013 12:54:44 +0200 Message-Id: <1388487284-4774-1-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Sage Weil --- 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;