X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Flistener.c;h=5339fd9f52896cfc4f28c280a31fe70be750564f;hb=c13fbd5384338be6c99d529db9b6ba787afcb1c0;hp=31d1ba5e9f8d8cade2a192eec806ba6ee83badfe;hpb=dcecf316a0813ae009af5aaa2ca938a53c1a3835;p=ircu2.10.12-pk.git diff --git a/ircd/listener.c b/ircd/listener.c index 31d1ba5..5339fd9 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -40,6 +40,7 @@ #include "s_misc.h" #include "s_stats.h" #include "send.h" +#include "ssl.h" #include "sys.h" /* MAXCLIENTS */ /* #include -- Now using assert in ircd_log.h */ @@ -131,7 +132,7 @@ void show_ports(struct Client* sptr, const struct StatDesc* sd, char* param) { struct Listener *listener = 0; - char flags[8]; + char flags[9]; int show_hidden = IsOper(sptr); int count = (IsOper(sptr) || MyUser(sptr)) ? 100 : 8; int port = 0; @@ -147,8 +148,29 @@ void show_ports(struct Client* sptr, const struct StatDesc* sd, continue; len = 0; flags[len++] = listener_server(listener) ? 'S' : 'C'; - if (show_hidden && FlagHas(&listener->flags, LISTEN_HIDDEN)) + + if (FlagHas(&listener->flags, LISTEN_SSL)) + { + flags[len++] = 'E'; + } + if (FlagHas(&listener->flags, LISTEN_HIDDEN)) + { + if (!show_hidden) + continue; flags[len++] = 'H'; + } + if (FlagHas(&listener->flags, LISTEN_IPV4)) + { + flags[len++] = '4'; + if (listener->fd_v4 < 0) + flags[len++] = '-'; + } + if (FlagHas(&listener->flags, LISTEN_IPV6)) + { + flags[len++] = '6'; + if (listener->fd_v6 < 0) + flags[len++] = '-'; + } flags[len] = '\0'; send_reply(sptr, RPL_STATSPLINE, listener->addr.port, listener->ref_count, @@ -294,8 +316,18 @@ void add_listener(int port, const char* vhost_ip, const char* mask, { new_listener = 1; listener = make_listener(port, &vaddr); + + } memcpy(&listener->flags, flags, sizeof(listener->flags)); + + if(FlagHas(&listener->flags, LISTEN_SSL) && !listener->ssl_listener) { + listener->ssl_listener = ssl_create_listener(); + } else if(!FlagHas(&listener->flags, LISTEN_SSL) && listener->ssl_listener) { + ssl_free_listener(listener->ssl_listener); + listener->ssl_listener = NULL; + } + FlagSet(&listener->flags, LISTEN_ACTIVE); if (mask) ipmask_parse(mask, &listener->mask, &listener->mask_bits); @@ -303,7 +335,8 @@ void add_listener(int port, const char* vhost_ip, const char* mask, listener->mask_bits = 0; #ifdef IPV6 - if (FlagHas(&listener->flags, LISTEN_IPV6)) { + if (FlagHas(&listener->flags, LISTEN_IPV6) + && (irc_in_addr_unspec(&vaddr) || !irc_in_addr_is_ipv4(&vaddr))) { if (listener->fd_v6 >= 0) { set_listener_options(listener, listener->fd_v6); okay = 1; @@ -318,7 +351,8 @@ void add_listener(int port, const char* vhost_ip, const char* mask, } #endif - if (FlagHas(&listener->flags, LISTEN_IPV4)) { + if (FlagHas(&listener->flags, LISTEN_IPV4) + && (irc_in_addr_unspec(&vaddr) || irc_in_addr_is_ipv4(&vaddr))) { if (listener->fd_v4 >= 0) { set_listener_options(listener, listener->fd_v4); okay = 1;