mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 05:55:07 -05:00
Drop support for SUBNETS_ACCESSED and CLIENT_ACCESSES commands
Support for the SUBNETS_ACCESSED and CLIENT_ACCESSES commands was enabled in chronyd, but in chronyc it was always disabled and the CLIENT_ACCESSES_BY_INDEX command was used instead. As there is no plan to enable it in the future, remove the support completely.
This commit is contained in:
112
cmdmon.c
112
cmdmon.c
@@ -1479,110 +1479,6 @@ handle_cyclelogs(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
#define FLIPL(X) ((X) = htonl(X))
|
||||
|
||||
static void
|
||||
handle_subnets_accessed(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||
{
|
||||
int i, j;
|
||||
unsigned long ns, bits_specd;
|
||||
IPAddr ip;
|
||||
CLG_Status result;
|
||||
|
||||
ns = ntohl(rx_message->data.subnets_accessed.n_subnets);
|
||||
tx_message->status = htons(STT_SUCCESS);
|
||||
tx_message->reply = htons(RPY_SUBNETS_ACCESSED);
|
||||
tx_message->data.subnets_accessed.n_subnets = htonl(ns);
|
||||
|
||||
for (i=0; i<ns; i++) {
|
||||
UTI_IPNetworkToHost(&rx_message->data.subnets_accessed.subnets[i].ip, &ip);
|
||||
bits_specd = ntohl(rx_message->data.subnets_accessed.subnets[i].bits_specd);
|
||||
|
||||
UTI_IPHostToNetwork(&ip, &tx_message->data.subnets_accessed.subnets[i].ip);
|
||||
tx_message->data.subnets_accessed.subnets[i].bits_specd = htonl(bits_specd);
|
||||
|
||||
result = CLG_GetSubnetBitmap(&ip, bits_specd, tx_message->data.subnets_accessed.subnets[i].bitmap);
|
||||
switch (result) {
|
||||
case CLG_SUCCESS:
|
||||
case CLG_EMPTYSUBNET:
|
||||
/* Flip endianness of each 4 byte word. Don't care if subnet
|
||||
is empty - just return an all-zero bitmap. */
|
||||
for (j=0; j<8; j++) {
|
||||
FLIPL(tx_message->data.subnets_accessed.subnets[i].bitmap[j]);
|
||||
}
|
||||
break;
|
||||
case CLG_BADSUBNET:
|
||||
tx_message->status = htons(STT_BADSUBNET);
|
||||
tx_message->data.subnets_accessed.n_subnets = htonl(0);
|
||||
return;
|
||||
case CLG_INACTIVE:
|
||||
tx_message->status = htons(STT_INACTIVE);
|
||||
tx_message->data.subnets_accessed.n_subnets = htonl(0);
|
||||
return;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
handle_client_accesses(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||
{
|
||||
CLG_Status result;
|
||||
RPT_ClientAccess_Report report;
|
||||
unsigned long nc;
|
||||
IPAddr ip;
|
||||
int i;
|
||||
struct timeval now;
|
||||
|
||||
LCL_ReadCookedTime(&now, NULL);
|
||||
|
||||
nc = ntohl(rx_message->data.client_accesses.n_clients);
|
||||
tx_message->status = htons(STT_SUCCESS);
|
||||
tx_message->reply = htons(RPY_CLIENT_ACCESSES);
|
||||
tx_message->data.client_accesses.n_clients = htonl(nc);
|
||||
|
||||
printf("%d %d\n", (int)sizeof(RPY_ClientAccesses_Client), (int)offsetof(CMD_Reply, data.client_accesses.clients));
|
||||
|
||||
for (i=0; i<nc; i++) {
|
||||
UTI_IPNetworkToHost(&rx_message->data.client_accesses.client_ips[i], &ip);
|
||||
UTI_IPHostToNetwork(&ip, &tx_message->data.client_accesses.clients[i].ip);
|
||||
|
||||
result = CLG_GetClientAccessReportByIP(&ip, &report, now.tv_sec);
|
||||
switch (result) {
|
||||
case CLG_SUCCESS:
|
||||
tx_message->data.client_accesses.clients[i].client_hits = htonl(report.client_hits);
|
||||
tx_message->data.client_accesses.clients[i].peer_hits = htonl(report.peer_hits);
|
||||
tx_message->data.client_accesses.clients[i].cmd_hits_auth = htonl(report.cmd_hits_auth);
|
||||
tx_message->data.client_accesses.clients[i].cmd_hits_normal = htonl(report.cmd_hits_normal);
|
||||
tx_message->data.client_accesses.clients[i].cmd_hits_bad = htonl(report.cmd_hits_bad);
|
||||
tx_message->data.client_accesses.clients[i].last_ntp_hit_ago = htonl(report.last_ntp_hit_ago);
|
||||
tx_message->data.client_accesses.clients[i].last_cmd_hit_ago = htonl(report.last_cmd_hit_ago);
|
||||
printf("%s %lu %lu %lu %lu %lu %lu %lu\n", UTI_IPToString(&ip), report.client_hits, report.peer_hits, report.cmd_hits_auth, report.cmd_hits_normal, report.cmd_hits_bad, report.last_ntp_hit_ago, report.last_cmd_hit_ago);
|
||||
break;
|
||||
case CLG_EMPTYSUBNET:
|
||||
/* Signal back to the client that this single client address
|
||||
was unknown */
|
||||
ip.family = IPADDR_UNSPEC;
|
||||
UTI_IPHostToNetwork(&ip, &tx_message->data.client_accesses.clients[i].ip);
|
||||
break;
|
||||
case CLG_INACTIVE:
|
||||
tx_message->status = htons(STT_INACTIVE);
|
||||
tx_message->data.client_accesses.n_clients = htonl(0);
|
||||
return;
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
handle_client_accesses_by_index(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||
{
|
||||
@@ -2243,14 +2139,6 @@ read_from_cmd_socket(void *anything)
|
||||
handle_cyclelogs(&rx_message, &tx_message);
|
||||
break;
|
||||
|
||||
case REQ_SUBNETS_ACCESSED:
|
||||
handle_subnets_accessed(&rx_message, &tx_message);
|
||||
break;
|
||||
|
||||
case REQ_CLIENT_ACCESSES:
|
||||
handle_client_accesses(&rx_message, &tx_message);
|
||||
break;
|
||||
|
||||
case REQ_CLIENT_ACCESSES_BY_INDEX:
|
||||
handle_client_accesses_by_index(&rx_message, &tx_message);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user