1
0
Fork 0

Feature: Warn on dashboard if IPv6 is not enabled

This commit is contained in:
Philipp Schafft 2022-03-06 18:49:11 +00:00
parent 567b51420f
commit 81e965a08f
3 changed files with 27 additions and 1 deletions

View File

@ -1621,6 +1621,7 @@ static void command_dashboard (client_t *client, source_t *source, adm
bool has_many_clients;
bool has_too_many_clients;
bool has_legacy_sources;
bool inet6_enabled;
resource = reportxml_node_new(REPORTXML_NODE_TYPE_RESOURCE, NULL, NULL, NULL);
@ -1646,13 +1647,14 @@ static void command_dashboard (client_t *client, source_t *source, adm
has_many_clients = global.clients > ((75 * config->client_limit) / 100);
has_too_many_clients = global.clients > ((90 * config->client_limit) / 100);
has_legacy_sources = global.sources_legacy > 0;
inet6_enabled = listensocket_container_is_family_included(global.listensockets, SOCK_FAMILY_INET6);
global_unlock();
reportxml_node_add_child(resource, node);
refobject_unref(node);
if (config->config_problems || has_too_many_clients) {
status = command_dashboard__atbest(status, ADMIN_DASHBOARD_STATUS_ERROR);
} else if (!has_sources || has_many_clients) {
} else if (!has_sources || has_many_clients || !inet6_enabled) {
status = command_dashboard__atbest(status, ADMIN_DASHBOARD_STATUS_WARNING);
}
@ -1661,6 +1663,9 @@ static void command_dashboard (client_t *client, source_t *source, adm
__reportxml_add_maintenance(reportnode, config->reportxml_db, "c704804e-d3b9-4544-898b-d477078135de", "warning", "Developer logging is active. This mode is not for production.", NULL);
#endif
if (!inet6_enabled)
__reportxml_add_maintenance(reportnode, config->reportxml_db, "f90219e1-bd07-4b54-b1ee-0ba6a0289a15", "warning", "IPv6 not enabled.", NULL);
if (config->config_problems & CONFIG_PROBLEM_HOSTNAME)
__reportxml_add_maintenance(reportnode, config->reportxml_db, "c4f25c51-2720-4b38-a806-19ef024b5289", "warning", "Hostname is not set to anything useful in <hostname>.", NULL);
if (config->config_problems & CONFIG_PROBLEM_LOCATION)

View File

@ -530,6 +530,24 @@ listensocket_t ** listensocket_container_list_sockets(listensocket_con
return res;
}
bool listensocket_container_is_family_included(listensocket_container_t *self, sock_family_t family)
{
size_t i;
thread_mutex_lock(&self->lock);
for (i = 0; i < self->sock_len; i++) {
if (self->sock[i] != NULL) {
if (listensocket_get_family(self->sock[i]) == family) {
thread_mutex_unlock(&self->lock);
return true;
}
}
}
thread_mutex_unlock(&self->lock);
return false;
}
/* ---------------------------------------------------------------------------- */
static void __listensocket_free(refobject_t self, void **userdata)

View File

@ -9,6 +9,8 @@
#ifndef __LISTENSOCKET_H__
#define __LISTENSOCKET_H__
#include <stdbool.h>
#include "common/net/sock.h"
#include "icecasttypes.h"
@ -26,6 +28,7 @@ int listensocket_container_set_sockcount_cb(listensocket
ssize_t listensocket_container_sockcount(listensocket_container_t *self);
listensocket_t * listensocket_container_get_by_id(listensocket_container_t *self, const char *id);
listensocket_t ** listensocket_container_list_sockets(listensocket_container_t *self);
bool listensocket_container_is_family_included(listensocket_container_t *self, sock_family_t family);
REFOBJECT_FORWARD_TYPE(listensocket_t);