Skip to content
Snippets Groups Projects
Commit fb85590d authored by Marek Vavruša's avatar Marek Vavruša
Browse files

requestor: store address instead of reference

This prevents problems when sharing/reusing the address bytes.
parent fcf2558e
Branches
Tags
No related merge requests found
......@@ -154,8 +154,8 @@ struct request *requestor_make(struct requestor *requestor,
}
request->state = NS_PROC_DONE;
request->data.origin = from;
request->data.remote = to;
memcpy(&request->data.origin, from, sizeof(struct sockaddr_storage));
memcpy(&request->data.remote, to, sizeof(struct sockaddr_storage));
request->data.fd = -1;
request->data.query = query;
return request;
......@@ -168,8 +168,8 @@ int requestor_enqueue(struct requestor *requestor, struct request * request, voi
}
/* Fetch a bound socket. */
int fd = net_connected_socket(SOCK_STREAM, request->data.remote,
request->data.origin, O_NONBLOCK);
int fd = net_connected_socket(SOCK_STREAM, &request->data.remote,
&request->data.origin, O_NONBLOCK);
if (fd < 0) {
return KNOT_ECONN;
}
......
......@@ -40,7 +40,7 @@ struct requestor {
struct request_data {
node_t node;
int fd;
const struct sockaddr_storage *remote, *origin;
struct sockaddr_storage remote, origin;
knot_pkt_t *query;
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment