netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Heffner <jheffner@psc.edu>
To: shemminger@linux-foundation.org
Cc: netdev@vger.kernel.org, John Heffner <jheffner@psc.edu>
Subject: [PATCH 2/2] [IPROUTE2] ss: parse bare integers are port numbers rather than IP addresses
Date: Tue, 11 Sep 2007 16:02:35 -0400	[thread overview]
Message-ID: <11895409552209-git-send-email-jheffner@psc.edu> (raw)
In-Reply-To: <11895409553082-git-send-email-jheffner@psc.edu>


Signed-off-by: John Heffner <jheffner@psc.edu>
---
 misc/ss.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index 5d14f13..d617f6d 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -953,6 +953,10 @@ void *parse_hostcond(char *addr)
 	memset(&a, 0, sizeof(a));
 	a.port = -1;
 
+	/* Special case: integer by itself is considered a port number */
+	if (!get_integer(&a.port, addr, 0))
+		goto out;
+
 	if (fam == AF_UNIX || strncmp(addr, "unix:", 5) == 0) {
 		char *p;
 		a.addr.family = AF_UNIX;
-- 
1.5.3.rc4.29.g74276-dirty


      reply	other threads:[~2007-09-11 20:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-11 20:02 [PATCH 1/2] [IPROUTE2] Add missing LIBUTIL for dependencies John Heffner
2007-09-11 20:02 ` John Heffner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11895409552209-git-send-email-jheffner@psc.edu \
    --to=jheffner@psc.edu \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).