Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

libraries/SocketWrapper: Fix agrs and improve error handling.#238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pennam merged 2 commits intoarduino:mainfromiabdalkader:fix_sockets
Nov 5, 2025

Conversation

@iabdalkader
Copy link

  • Fix socket timeout arg to use proper struct timeval
  • Initialize addrinfo structs to prevent undefined behavior
  • Add error checking for tls_credential_add() and setsockopt() calls
  • Centralize socket cleanup in error path
  • Change default return value to false for safer error handling

@per1234per1234 added bugSomething isn't working enhancementNew feature or request labelsOct 30, 2025

Serial.println("Adding CA certificate...");
// Add the ISRG Root X1 CA certificate
int ret =tls_credential_add(CA_CERTIFICATE_TAG, TLS_CREDENTIAL_CA_CERTIFICATE,
Copy link

@pennampennamNov 5, 2025
edited
Loading

Choose a reason for hiding this comment

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

I would addsetCACert(const char *rootCA) toZephyrSSLClient instead of using directlytls_credential_add

Copy link
Author

Choose a reason for hiding this comment

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

Actually,connectSSL(const char *host, uint16_t port, char *ca_certificate_pem = nullptr) already accepts a cert blob, I should just use that instead.

pennam reacted with thumbs up emoji
}

#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
boolconnectSSL(constchar *host,uint16_t port,char *ca_certificate_pem =nullptr) {

Choose a reason for hiding this comment

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

This should beconst char *ca_certificate_pem together with

int connectSSL(const char *host, uint16_t port, const char *cert) in ZephyrClient.h and
int connect(const char *host, uint16_t port, const char *cert) in ZephyrSSLClient.h

or we need to cast the certificate blob

Copy link
Author

Choose a reason for hiding this comment

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

Fixed. Can you test it again?

pennam reacted with thumbs up emoji
- Fix socket timeout arg to use proper struct timeval- Initialize addrinfo structs to prevent undefined behavior- Add error checking for tls_credential_add() and setsockopt() calls- Centralize socket cleanup in error path- Change default return value to false for safer error handling- Change cert args to constSigned-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
@pennam
Copy link

works on

PR coming to enable MBEDTLS on GIGA R1

@pennampennam merged commit6847a9c intoarduino:mainNov 5, 2025
24 checks passed
@iabdalkaderiabdalkader deleted the fix_sockets branchNovember 5, 2025 12:39
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@pennampennampennam approved these changes

Assignees

No one assigned

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@iabdalkader@pennam@per1234

[8]ページ先頭

©2009-2025 Movatter.jp