conf: adopt default bind*address values
Move the default values of the bind*address settings from the ntp/nts/cmdmon code to conf.
This commit is contained in:
parent
c10b66b579
commit
58da0c0ad2
5 changed files with 8 additions and 12 deletions
3
cmdmon.c
3
cmdmon.c
|
@ -169,10 +169,7 @@ open_socket(int family)
|
|||
return INVALID_SOCK_FD;
|
||||
|
||||
CNF_GetBindCommandAddress(family, &local_addr.ip_addr);
|
||||
if (local_addr.ip_addr.family != family)
|
||||
SCK_GetLoopbackIPAddress(family, &local_addr.ip_addr);
|
||||
local_addr.port = port;
|
||||
|
||||
iface = CNF_GetBindCommandInterface();
|
||||
|
||||
sock_fd = SCK_OpenUdpSocket(NULL, &local_addr, iface, SCK_FLAG_RX_DEST_ADDR);
|
||||
|
|
8
conf.c
8
conf.c
|
@ -36,6 +36,7 @@
|
|||
#include "nts_ke.h"
|
||||
#include "refclock.h"
|
||||
#include "cmdmon.h"
|
||||
#include "socket.h"
|
||||
#include "srcparams.h"
|
||||
#include "logging.h"
|
||||
#include "nameserv.h"
|
||||
|
@ -393,6 +394,13 @@ CNF_Initialise(int r, int client_only)
|
|||
bind_cmd_path = Strdup(DEFAULT_COMMAND_SOCKET);
|
||||
pidfile = Strdup(DEFAULT_PID_FILE);
|
||||
}
|
||||
|
||||
SCK_GetAnyLocalIPAddress(IPADDR_INET4, &bind_address4);
|
||||
SCK_GetAnyLocalIPAddress(IPADDR_INET6, &bind_address6);
|
||||
SCK_GetAnyLocalIPAddress(IPADDR_INET4, &bind_acq_address4);
|
||||
SCK_GetAnyLocalIPAddress(IPADDR_INET6, &bind_acq_address6);
|
||||
SCK_GetLoopbackIPAddress(IPADDR_INET4, &bind_cmd_address4);
|
||||
SCK_GetLoopbackIPAddress(IPADDR_INET6, &bind_cmd_address6);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
|
3
ntp_io.c
3
ntp_io.c
|
@ -98,9 +98,6 @@ open_socket(int family, int local_port, int client_only, IPSockAddr *remote_addr
|
|||
iface = CNF_GetBindAcquisitionInterface();
|
||||
}
|
||||
|
||||
if (local_addr.ip_addr.family != family)
|
||||
SCK_GetAnyLocalIPAddress(family, &local_addr.ip_addr);
|
||||
|
||||
local_addr.port = local_port;
|
||||
|
||||
sock_flags = SCK_FLAG_RX_DEST_ADDR | SCK_FLAG_PRIV_BIND;
|
||||
|
|
|
@ -320,9 +320,6 @@ NKC_Start(NKC_Instance inst)
|
|||
|
||||
/* Follow the bindacqaddress and bindacqdevice settings */
|
||||
CNF_GetBindAcquisitionAddress(inst->address.ip_addr.family, &local_addr.ip_addr);
|
||||
if (local_addr.ip_addr.family != inst->address.ip_addr.family)
|
||||
SCK_GetAnyLocalIPAddress(inst->address.ip_addr.family, &local_addr.ip_addr);
|
||||
|
||||
local_addr.port = 0;
|
||||
iface = CNF_GetBindAcquisitionInterface();
|
||||
|
||||
|
|
|
@ -265,9 +265,6 @@ open_socket(int family, int port)
|
|||
CNF_GetBindAddress(family, &local_addr.ip_addr);
|
||||
iface = CNF_GetBindNtpInterface();
|
||||
|
||||
if (local_addr.ip_addr.family != family)
|
||||
SCK_GetAnyLocalIPAddress(family, &local_addr.ip_addr);
|
||||
|
||||
local_addr.port = port;
|
||||
|
||||
sock_fd = SCK_OpenTcpSocket(NULL, &local_addr, iface, 0);
|
||||
|
|
Loading…
Reference in a new issue