From c5f632382f0fcd85889c22d974394bf1c4b05ff3 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 12 Nov 2012 19:34:23 +0000 Subject: [PATCH] Show an error instead of silently falling back to AF_INET6. --- ncat/ncat_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ncat/ncat_main.c b/ncat/ncat_main.c index b99f81dac..df3b7e847 100644 --- a/ncat/ncat_main.c +++ b/ncat/ncat_main.c @@ -642,9 +642,13 @@ int main(int argc, char *argv[]) if (targetss.storage.ss_family == AF_INET) targetss.in.sin_port = htons(o.portno); #ifdef HAVE_IPV6 - else + else if (targetss.storage.ss_family == AF_INET6) targetss.in6.sin6_port = htons(o.portno); #endif + else if (targetss.storage.ss_family == AF_UNSPEC) + ; /* Leave unspecified. */ + else + bye("Unknown address family %d.", targetss.storage.ss_family); if (srcport != -1) { if (o.listen) {