1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

sockets not connecting.

This commit is contained in:
Annika Wierichs 2017-12-14 13:10:03 +01:00
parent 770c944599
commit c86a846fdd
3 changed files with 19 additions and 5 deletions

View file

@ -50,6 +50,7 @@ struct ibv_context * guest_to_host_ibv_context(struct ibv_context * contex
struct ibv_context_ops * guest_to_host_ibv_context_ops(struct ibv_context_ops * context_ops);
struct ibv_port_attr * guest_to_host_ibv_port_attr(struct ibv_port_attr * port_attr);
struct ibv_recv_wr * guest_to_host_ibv_recv_wr(struct ibv_recv_wr * wr);
struct ibv_send_wr * guest_to_host_ibv_send_wr(struct ibv_send_wr * wr);
struct ibv_sge * guest_to_host_ibv_sge(struct ibv_sge * sg);
struct ibv_abi_compat_v2 * guest_to_host_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat);
pthread_mutex_t * guest_to_host_pthread_mutex_t(pthread_mutex_t * mutex);
@ -60,6 +61,7 @@ struct ibv_context_ops * host_to_guest_ibv_context_ops(struct ibv_context_ops
struct ibv_port_attr * host_to_guest_ibv_port_attr(struct ibv_port_attr * port_attr, addr_type type);
struct ibv_comp_channel * host_to_guest_ibv_comp_channel(struct ibv_comp_channel * channel, addr_type type);
struct ibv_recv_wr * host_to_guest_ibv_recv_wr(struct ibv_recv_wr * wr, addr_type type);
struct ibv_send_wr * host_to_guest_ibv_send_wr(struct ibv_send_wr * wr, addr_type type);
struct ibv_sge * host_to_guest_ibv_sge(struct ibv_sge * sg, addr_type type);
struct ibv_abi_compat_v2 * host_to_guest_ibv_abi_compat_v2(struct ibv_abi_compat_v2 * abi_compat, addr_type type);
pthread_mutex_t * host_to_guest_pthread_mutex_t(pthread_mutex_t * mutex, addr_type type);

View file

@ -151,10 +151,11 @@ const char * ibv_wc_status_str(enum ibv_wc_status status) {
uhyve_args.status = status;
static const char ret[MAX_CHAR_ARR_LENGTH];
uhyve_send(UHYVE_PORT_IBV_WC_STATUS_STR, (unsigned) virt_to_phys((size_t) &uhyve_args));
// memcpy here TODO
uhyve_args.ret = ret;
return uhyve_args.ret;
uhyve_send(UHYVE_PORT_IBV_WC_STATUS_STR, (unsigned) virt_to_phys((size_t) &uhyve_args));
return ret;
}

View file

@ -158,30 +158,41 @@ static struct pingpong_dest *pp_client_exch_dest(const char *servername, int por
return NULL;
n = getaddrinfo(servername, service, &hints, &res);
printf(" after getaddrinfo().\n");
printf(" .res->ai_addr->sa_data (the address): %s\n", res->ai_addr->sa_data);
if (n < 0) {
fprintf(stderr, "error for %s:%d\n", servername, port);
free(service);
return NULL;
}
printf(" after if(n < 0) {.\n");
for (t = res; t; t = t->ai_next) {
printf(" \twithin for loop.\n");
sockfd = socket(t->ai_family, t->ai_socktype, t->ai_protocol);
if (sockfd >= 0) {
printf(" \t\tsockfd >= 0.\n");
if (!connect(sockfd, t->ai_addr, t->ai_addrlen))
printf(" \t\t!connect.\n");
break;
printf(" \t\tbefore close.\n");
close(sockfd);
printf(" \t\tafter close.\n");
sockfd = -1;
}
}
printf(" after for loop.\n");
freeaddrinfo(res);
free(service);
printf(" after free(service).\n");
if (sockfd < 0) {
fprintf(stderr, "Couldn't connect to %s:%d\n", servername, port);
return NULL;
}
printf(" after if (sockfd < 0).\n");
gid_to_wire_gid(&my_dest->gid, gid);
sprintf(msg, "%04x:%06x:%06x:%s", my_dest->lid, my_dest->qpn,
@ -677,8 +688,8 @@ int main(int argc, char *argv[])
}
}
/* servername = "137.226.133.156"; // ! */
/* printf("Servername manually set.\n"); */
servername = "10.0.5.3"; // !
printf("Servername manually set.\n");
if (optind == argc - 1) {
servername = strdupa(argv[optind]);