+ /* Send initial message */
+ dest_sa = (struct sockaddr *)&keys.keyentries[agentid]->peer_info;
+ sa_size = (dest_sa->sa_family == AF_INET) ?
+ sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6);
+
+ /*
+ * Because we handle multiple IP addresses, we won't know what interfaces
+ * are active for network communication until we receive something on one
+ * of them. This is a work around in the event we need to send before
+ * we have identified the working interface in secure.c. (dgs - 2/26/18)
+ */
+
+ if (logr.sock == 0) {
+ int i, ok = 0;
+
+ /* socket not established - try current sockets */
+ for (i = 0; i < logr.netinfo->fdcnt; i++) {
+ if (sendto(logr.netinfo->fds[i], crypt_msg, msg_size, 0,
+ dest_sa, sa_size) < 0) {
+ continue;
+ }
+
+ ok = 1;
+ break;
+ }