public inbox for linux-sctp@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lksctp-tools: make bind_test can do while disable IPV6
@ 2014-05-23  3:14 Wang Weidong
  2014-05-23 10:47 ` Neil Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wang Weidong @ 2014-05-23  3:14 UTC (permalink / raw)
  To: linux-sctp

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-24 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23  3:14 [PATCH] lksctp-tools: make bind_test can do while disable IPV6 Wang Weidong
2014-05-23 10:47 ` Neil Horman
2014-05-23 15:05 ` Vlad Yasevich
2014-05-24 21:47 ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox