public inbox for linux-sctp@vger.kernel.org
 help / color / mirror / Atom feed
From: Wang Weidong <wangweidong1@huawei.com>
To: linux-sctp@vger.kernel.org
Subject: [PATCH] lksctp-tools: make bind_test can do while disable IPV6
Date: Fri, 23 May 2014 03:14:33 +0000	[thread overview]
Message-ID: <537EBD19.2030003@huawei.com> (raw)

From e496cc0da4b43f4686e91aa9ffa73869e1f4c91d Mon Sep 17 00:00:00 2001
From: Wang Weidong <wangweidong1@huawei.com>
Date: Mon, 9 Jun 2014 23:32:39 +0800
Subject: [PATCH] lksctp-tools: make bind_test can do while disable IPV6

When disable IPv6, the bind_test can't work for IPv4. So add
a variable 'domain' for support working for IPv4.

Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
---
 src/apps/bindx_test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/apps/bindx_test.c b/src/apps/bindx_test.c
index b1c9ffa..ff3de86 100644
--- a/src/apps/bindx_test.c
+++ b/src/apps/bindx_test.c
@@ -42,6 +42,7 @@ int main (int argc, char **argv)
 	void *addr_buf_size = 0;
 	size_t addrs, cnt;
 	int sd, result, port;
+	int domain = PF_INET6;
 
 	if (argc < 3) {
 		fprintf(stderr,
@@ -84,6 +85,7 @@ int main (int argc, char **argv)
 		} else if (strchr(argv[cnt], '.')) {
 			struct sockaddr_in *sa; 
 
+			domain = PF_INET;
 			sa = (struct sockaddr_in *)buf_ptr;
 			printf (" IPv4 address number %zu", addrs);
 			sa->sin_family = AF_INET;
@@ -103,7 +105,7 @@ int main (int argc, char **argv)
 	printf ("bindx_test: INFO: Got %zu addrs\n", addrs);
   
 	/* Create the socket */
-	sd = socket(PF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP);
+	sd = socket(domain, SOCK_SEQPACKET, IPPROTO_SCTP);
 	if (sd = -1) {
 		perror("bindx_test: ERROR: Cannot open socket");
 		return 1;
-- 
1.8.0.2



             reply	other threads:[~2014-05-23  3:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-23  3:14 Wang Weidong [this message]
2014-05-23 10:47 ` [PATCH] lksctp-tools: make bind_test can do while disable IPV6 Neil Horman
2014-05-23 15:05 ` Vlad Yasevich
2014-05-24 21:47 ` Daniel Borkmann

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=537EBD19.2030003@huawei.com \
    --to=wangweidong1@huawei.com \
    --cc=linux-sctp@vger.kernel.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