alexcrichton / curl-rust

Rust bindings to libcurl
MIT License
1.02k stars 233 forks source link

Unable to connect to an IPv6 link local address #568

Open M-Tarasov opened 1 month ago

M-Tarasov commented 1 month ago

A connection to link local address requires the scope ID to be set (e.g. 4 in https://[fe80::abcd:1234:abcd:1234%4]) in the struct sockaddr_in6. However, the symbol HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID is not defined in the curl-sys crate, and the scope_id field is always set to 0.

See cf-socket.c -> socket_open(..):

#if defined(USE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
  if(data->conn->scope_id && (addr->family == AF_INET6)) {
    struct sockaddr_in6 * const sa6 = (void *)&addr->sa_addr;
    sa6->sin6_scope_id = data->conn->scope_id;
  }
#endif
M-Tarasov commented 1 month ago

Added pull request https://github.com/alexcrichton/curl-rust/pull/569