ntp: combine parameters of NCR_AddBroadcastDestination()

This commit is contained in:
Miroslav Lichvar 2020-06-17 09:50:23 +02:00
parent 46714fec2d
commit 500c9cbf3b
4 changed files with 8 additions and 11 deletions

10
conf.c
View file

@ -287,8 +287,7 @@ static ARR_Instance ntp_restrictions;
static ARR_Instance cmd_restrictions; static ARR_Instance cmd_restrictions;
typedef struct { typedef struct {
IPAddr addr; NTP_Remote_Address addr;
unsigned short port;
int interval; int interval;
} NTP_Broadcast_Destination; } NTP_Broadcast_Destination;
@ -1345,8 +1344,8 @@ parse_broadcast(char *line)
} }
destination = (NTP_Broadcast_Destination *)ARR_GetNewElement(broadcasts); destination = (NTP_Broadcast_Destination *)ARR_GetNewElement(broadcasts);
destination->addr = ip; destination->addr.ip_addr = ip;
destination->port = port; destination->addr.port = port;
destination->interval = interval; destination->interval = interval;
} }
@ -1827,8 +1826,7 @@ CNF_AddBroadcasts(void)
for (i = 0; i < ARR_GetSize(broadcasts); i++) { for (i = 0; i < ARR_GetSize(broadcasts); i++) {
destination = (NTP_Broadcast_Destination *)ARR_GetElement(broadcasts, i); destination = (NTP_Broadcast_Destination *)ARR_GetElement(broadcasts, i);
NCR_AddBroadcastDestination(&destination->addr, destination->port, NCR_AddBroadcastDestination(&destination->addr, destination->interval);
destination->interval);
} }
ARR_SetSize(broadcasts, 0); ARR_SetSize(broadcasts, 0);

View file

@ -2606,14 +2606,13 @@ broadcast_timeout(void *arg)
/* ================================================== */ /* ================================================== */
void void
NCR_AddBroadcastDestination(IPAddr *addr, unsigned short port, int interval) NCR_AddBroadcastDestination(NTP_Remote_Address *addr, int interval)
{ {
BroadcastDestination *destination; BroadcastDestination *destination;
destination = (BroadcastDestination *)ARR_GetNewElement(broadcasts); destination = (BroadcastDestination *)ARR_GetNewElement(broadcasts);
destination->addr.ip_addr = *addr; destination->addr = *addr;
destination->addr.port = port;
destination->local_addr.ip_addr.family = IPADDR_UNSPEC; destination->local_addr.ip_addr.family = IPADDR_UNSPEC;
destination->local_addr.if_index = INVALID_IF_INDEX; destination->local_addr.if_index = INVALID_IF_INDEX;
destination->local_addr.sock_fd = NIO_OpenServerSocket(&destination->addr); destination->local_addr.sock_fd = NIO_OpenServerSocket(&destination->addr);

View file

@ -139,6 +139,6 @@ extern int NCR_IsSyncPeer(NCR_Instance instance);
extern void NCR_DumpAuthData(NCR_Instance inst); extern void NCR_DumpAuthData(NCR_Instance inst);
extern void NCR_AddBroadcastDestination(IPAddr *addr, unsigned short port, int interval); extern void NCR_AddBroadcastDestination(NTP_Remote_Address *addr, int interval);
#endif /* GOT_NTP_CORE_H */ #endif /* GOT_NTP_CORE_H */

View file

@ -147,7 +147,7 @@ MNL_Finalise(void)
#ifndef FEAT_NTP #ifndef FEAT_NTP
void void
NCR_AddBroadcastDestination(IPAddr *addr, unsigned short port, int interval) NCR_AddBroadcastDestination(NTP_Remote_Address *addr, int interval)
{ {
} }