]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC Server Demo: Use IPv4 only
authorHugo Landau <hlandau@openssl.org>
Tue, 9 Apr 2024 12:17:04 +0000 (13:17 +0100)
committerNeil Horman <nhorman@openssl.org>
Mon, 17 Feb 2025 16:27:32 +0000 (11:27 -0500)
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24037)

demos/quic/server/server.c

index c0167da72e1a5993dc02bd3c0d75beaa14012cba..ad0fc1f462070063b2c38aa1270c1c512e438bcc 100644 (file)
@@ -76,15 +76,15 @@ err:
 static int create_socket(uint16_t port)
 {
     int fd = -1;
-    struct sockaddr_in6 sa = {0};
+    struct sockaddr_in sa = {0};
 
-    if ((fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
+    if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
         fprintf(stderr, "cannot create socket");
         goto err;
     }
 
-    sa.sin6_family  = AF_INET6;
-    sa.sin6_port    = htons(port);
+    sa.sin_family  = AF_INET;
+    sa.sin_port    = htons(port);
 
     if (bind(fd, (const struct sockaddr *)&sa, sizeof(sa)) < 0) {
         fprintf(stderr, "cannot bind to %u\n", port);