char **argv; /* the arguments to use if running a process-based check */
char **envp; /* the environment to use if running a process-based check */
struct pid_list *curpid; /* entry in pid_list used for current process-based test, or -1 if not in test */
- struct protocol *proto; /* server address protocol for health checks */
struct sockaddr_storage addr; /* the address to check */
};
const struct netns_entry *netns; /* contains network namespace name or NULL. Network namespace comes from configuration */
/* warning, these structs are huge, keep them at the bottom */
struct sockaddr_storage addr; /* the address to connect to */
- struct protocol *proto; /* server address protocol */
struct xprt_ops *xprt; /* transport-layer operations */
unsigned down_time; /* total time the server was down */
time_t last_change; /* last time, when the state was changed */
/* set the correct protocol on the output stream interface */
if (objt_server(s->target)) {
- conn_prepare(srv_conn, objt_server(s->target)->proto, objt_server(s->target)->xprt);
+ conn_prepare(srv_conn, protocol_by_family(srv_conn->addr.to.ss_family), objt_server(s->target)->xprt);
}
else if (obj_type(s->target) == OBJ_TYPE_PROXY) {
/* proxies exclusively run on raw_sock right now */
/* prepare a new connection */
conn_init(conn);
- conn_prepare(conn, check->proto, check->xprt);
- conn_attach(conn, check, &check_conn_cb);
- conn->target = &s->obj_type;
-
- /* no client address */
- clear_addr(&conn->addr.from);
if (is_addr(&check->addr)) {
-
/* we'll connect to the check addr specified on the server */
conn->addr.to = check->addr;
- proto = check->proto;
}
else {
/* we'll connect to the addr on the server */
conn->addr.to = s->addr;
- proto = s->proto;
}
if (check->port) {
set_host_port(&conn->addr.to, check->port);
}
+ proto = protocol_by_family(conn->addr.to.ss_family);
+
+ conn_prepare(conn, proto, check->xprt);
+ conn_attach(conn, check, &check_conn_cb);
+ conn->target = &s->obj_type;
+
+ /* no client address */
+ clear_addr(&conn->addr.from);
+
/* only plain tcp-check supports quick ACK */
quickack = check->type == 0 || check->type == PR_O2_TCPCHK_CHK;
if (is_addr(&check->addr)) {
/* we'll connect to the check addr specified on the server */
conn->addr.to = check->addr;
- proto = check->proto;
}
else {
/* we'll connect to the addr on the server */
conn->addr.to = s->addr;
- proto = s->proto;
}
+ proto = protocol_by_family(conn->addr.to.ss_family);
/* port */
if (check->current_step->port)
if (!get_host_port(&mailer->addr))
/* Default to submission port */
check->port = 587;
- check->proto = mailer->proto;
check->addr = mailer->addr;
check->server = s;
}
}
newsrv->addr = *sk;
- newsrv->proto = newsrv->check.proto = newsrv->agent.proto = protocol_by_family(newsrv->addr.ss_family);
newsrv->xprt = newsrv->check.xprt = newsrv->agent.xprt = &raw_sock;
- if (!newsrv->proto) {
+ if (!protocol_by_family(newsrv->addr.ss_family)) {
Alert("parsing [%s:%d] : Unknown protocol family %d '%s'\n",
file, linenum, newsrv->addr.ss_family, args[2]);
err_code |= ERR_ALERT | ERR_FATAL;
}
newsrv->check.addr = newsrv->agent.addr = *sk;
- newsrv->check.proto = newsrv->agent.proto = protocol_by_family(sk->ss_family);
cur_arg += 2;
}
else if (!strcmp(args[cur_arg], "port")) {