Skip to content

improvements for ipv6#703

Merged
dgarske merged 3 commits intowolfSSL:masterfrom
anhu:ipv6_part2
Jun 3, 2024
Merged

improvements for ipv6#703
dgarske merged 3 commits intowolfSSL:masterfrom
anhu:ipv6_part2

Conversation

@anhu
Copy link
Copy Markdown
Member

@anhu anhu commented May 30, 2024

Fixes ZD18053

@anhu anhu requested a review from ejohnstown May 30, 2024 18:33
@anhu anhu self-assigned this May 30, 2024
@anhu anhu requested a review from wolfSSL-Bot May 30, 2024 18:34
@anhu anhu assigned ejohnstown and unassigned anhu May 30, 2024
@anhu
Copy link
Copy Markdown
Member Author

anhu commented May 31, 2024

Have confirmation from ZD Ticket that this change is working as expected.
Fixups squashed and now ready for merge.

dgarske
dgarske previously approved these changes May 31, 2024
Copy link
Copy Markdown
Member

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over to @ejohnstown

@ejohnstown ejohnstown removed the request for review from wolfSSL-Bot May 31, 2024 16:32
@ejohnstown ejohnstown assigned dgarske and anhu and unassigned ejohnstown and dgarske May 31, 2024
Comment thread apps/wolfsshd/wolfsshd.c Outdated
inet_ntop(AF_INET,
#ifdef TEST_IPV6
&clientAddr.sin6_addr,
inet_ntop(AF_INET, &clientAddr.sin6_addr, conn->ip,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't actually work. inet_ntop() is going to take the first 32-bits of sin6_addr and turn it into a dotted-quad string.

Comment thread wolfssh/test.h Outdated


static INLINE void tcp_socket(WS_SOCKET_T* sockFd)
static INLINE void tcp_socket(WS_SOCKET_T* sockFd, int specifyProtocol, int targetProtocol)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this a little smarter? Maybe have tcp_socket() and tcp6_socket() that call a utility function?

Comment thread apps/wolfssh/wolfssh.c Outdated
build_addr(&clientAddr, config.hostname, config.port);
tcp_socket(&sockFd);
tcp_socket(&sockFd, 1,
#ifdef TEST_IPV6
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These checks are really awkward. TEST_IPV6 is meant to force the example tools to use IPV6 for testing. It was a quick-and-dirty way to support IPv6. In general, we shouldn't need checks like this. Information about the IP address type are kept with the IP address. (clientAddr.sin_family)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to make it less awkward. Since we have the typedef for SOCKADDR_IN_T , the check of the member will need this macro wrap. (clientAddr.sin_family vs. clientAddr.sin6_family).

@ejohnstown ejohnstown requested review from ejohnstown and removed request for ejohnstown June 3, 2024 22:08
Comment thread apps/wolfsshd/wolfsshd.c
#else
SOCKADDR_IN_T clientAddr;
socklen_t clientAddrSz = sizeof(clientAddr);
struct sockaddr_in6 clientAddr;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we don't have all this wrapped with TEST_IPV6 and use SOCKADDR_IN_T in the non IPv6 case? I noticed a bit of a mess between the examples for the IPv4 and IPv6 support.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already discussed internally. No need for changes. Back to @dgarske.

Copy link
Copy Markdown
Member

@dgarske dgarske Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sshd will always support IPv6

@anhu anhu requested a review from dgarske June 3, 2024 23:05
@anhu anhu assigned anhu and dgarske and unassigned anhu Jun 3, 2024
@dgarske dgarske merged commit b6ccb07 into wolfSSL:master Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants