From bf1c11aa8155fdcce6b4e0eea491f1910414948b Mon Sep 17 00:00:00 2001
From: Michael Tuexen <tuexen@fh-muenster.de>
Date: Tue, 14 Jul 2015 16:25:44 +0200
Subject: [PATCH] Use the local IP address for binding sockets.

Using the explicit local IP address instead of the wildcard
address doesn't change the behavior for UDP/TCP, but for
SCTP it forces the SUT to be single homed.
---
 gtests/net/packetdrill/config.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gtests/net/packetdrill/config.c b/gtests/net/packetdrill/config.c
index 4ccc5694..cc61bdea 100644
--- a/gtests/net/packetdrill/config.c
+++ b/gtests/net/packetdrill/config.c
@@ -259,7 +259,7 @@ static void finalize_ipv4_config(struct config *config)
 	config->live_prefix_len =
 		netmask_to_prefix(config->live_netmask_ip_string);
 	config->live_gateway_ip = ipv4_parse(config->live_gateway_ip_string);
-	config->live_bind_ip	= ipv4_parse("0.0.0.0");
+	config->live_bind_ip	= config->live_local_ip;
 	config->live_connect_ip	= config->live_remote_ip;
 	config->socket_domain	= AF_INET;
 	config->wire_protocol	= AF_INET;
@@ -279,7 +279,7 @@ static void finalize_ipv4_mapped_ipv6_config(struct config *config)
 	config->live_prefix_len =
 		netmask_to_prefix(config->live_netmask_ip_string);
 	config->live_gateway_ip = ipv4_parse(config->live_gateway_ip_string);
-	config->live_bind_ip	= ipv6_parse("::");
+	config->live_bind_ip	= ipv6_map_from_ipv4(config->live_local_ip);
 	config->live_connect_ip	= ipv6_map_from_ipv4(config->live_remote_ip);
 	config->socket_domain	= AF_INET6;
 	config->wire_protocol	= AF_INET;
@@ -298,7 +298,7 @@ static void finalize_ipv6_config(struct config *config)
 
 	config->live_prefix_len	= DEFAULT_V6_LIVE_PREFIX_LEN;
 	config->live_gateway_ip = ipv6_parse(config->live_gateway_ip_string);
-	config->live_bind_ip	= ipv6_parse("::");
+	config->live_bind_ip	= config->live_local_ip;
 	config->live_connect_ip	= config->live_remote_ip;
 	config->socket_domain	= AF_INET6;
 	config->wire_protocol	= AF_INET6;
-- 
GitLab