return EXIT_FAILURE;
}
-#ifdef DEBUG
/* Fast rebinding for debug mode, could cause invalid packets. */
- {
+ if (LOG_DEBUG <= global_log_level) {
int socket_option = 1;
setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR,
&socket_option, sizeof(socket_option));
}
-#endif
/* Bind to the listen socket. */
memset(&server_in, 0, sizeof(server_in));
#ifdef USE_IPV4_ONLY
server_in.sin_family = AF_INET; /* IPv4 only */
- server_in.sin_addr.s_addr = INADDR_ANY; /* bind to any address */
+ server_in.sin_addr.s_addr = htonl(INADDR_ANY); /* bind to any address */
server_in.sin_port = htons((uint16_t)port); /* port to bind to */
#else
server_in.sin6_family = AF_INET6; /* IPv6 (and IPv4) */
#else
global_log_level = LOG_WARNING;
#endif
+ global_passthrough_unknown = 0;
- while (-1 != (option = getopt(argc, argv, "d:p:t:h?"))) {
+ while (-1 != (option = getopt(argc, argv, "d:p:t:uh?"))) {
switch (option) {
case 'd': {
if (0 > atoi(optarg)) {
thread_count = (size_t)atoi(optarg);
break;
}
+ case 'u': {
+ global_passthrough_unknown = 1;
+ break;
+ }
case 'h':
default: /* '?' */
print_usage(argv[0]);
}
}
static void print_usage(const char *argv) {
- fprintf(stderr, "Usage: %s [-d level] [-p host:port] [-t count] port\n",
+ fprintf(stderr, "Usage: %s [-d level] [-p host:port] [-t count] [-u] port\n",
argv);
fprintf(stderr, "\n");
fprintf(stderr, "-d debug level: 0=errors only, 2=debug [default: 1]\n");
fprintf(stderr, "-p proxy hostname and port\n");
fprintf(stderr, "-t number of threads [default: 10]\n");
+ fprintf(stderr, "-u passthrough connection if no certificate is stored \
+[default: error]\n");
+ fprintf(stderr, " WARNING: might be a security problem!\n");
}
static void initialize_gnutls(void) {