Skip to content

Commit

Permalink
[shell/linux] update port in getaddrinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
versaloon committed Aug 9, 2023
1 parent 183a4f6 commit f96f3d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/shell/sys/linux/kernel/socket/vsf_linux_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ int getaddrinfo(const char *name, const char *service, const struct addrinfo *hi
return EAI_BADFLAGS;
}

uint16_t port = strtoul(service, NULL, 10);
// TODO: is port is 0, check service name to get real port

// TODO: re-implement
struct in_addr addr;
if (!inet_aton(name, &addr)) {
Expand Down Expand Up @@ -410,6 +413,7 @@ int getaddrinfo(const char *name, const char *service, const struct addrinfo *hi
ai->info.ai_addr = &ai->sa;
ai->sa_in.sin_family = AF_INET;
ai->sa_in.sin_addr = addr;
ai->sa_in.sin_port = htons(port);
ai->info.ai_addrlen = sizeof(ai->sa_in);
*pai = &ai->info;
return 0;
Expand Down

0 comments on commit f96f3d8

Please sign in to comment.