Treat G-line-related times as network times, rather than local times.
[ircu2.10.12-pk.git] / ircd / listener.c
index 31d1ba5e9f8d8cade2a192eec806ba6ee83badfe..a3c9e93785e2fd3ce4a302c3a3ca99323e9d8d94 100644 (file)
@@ -147,8 +147,24 @@ 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_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,
@@ -303,7 +319,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 +335,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;