]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use AF_LOCAL, as AF_UNIX is deprecated
authorAlan T. DeKok <aland@freeradius.org>
Tue, 23 Jan 2024 13:50:50 +0000 (08:50 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 23 Jan 2024 13:51:34 +0000 (08:51 -0500)
src/lib/bio/fd.c
src/lib/bio/fd_open.c

index 4c06c60e4d2435e2f2328fdf49d1481e15b6f740..3707d5409d46a802c40617324412c9298ad3b206 100644 (file)
@@ -640,7 +640,7 @@ int fr_filename_to_sockaddr(struct sockaddr_un *sun, socklen_t *sunlen, char con
                return -1;
        }
 
-       sun->sun_family = AF_UNIX;
+       sun->sun_family = AF_LOCAL;
        memcpy(sun->sun_path, filename, len + 1); /* SUN_LEN will do strlen */
 
        *sunlen = SUN_LEN(sun);
@@ -661,7 +661,7 @@ static ssize_t fr_bio_fd_try_connect(fr_bio_fd_t *my)
         socklen_t salen;
         struct sockaddr_storage sockaddr;
 
-       if (my->info.socket.af != AF_UNIX) {
+       if (my->info.socket.af != AF_LOCAL) {
                rcode = fr_ipaddr_to_sockaddr(&sockaddr, &salen, &my->info.socket.inet.dst_ipaddr, my->info.socket.inet.dst_port);
        } else {
                rcode = fr_filename_to_sockaddr((struct sockaddr_un *) &sockaddr, &salen, my->info.socket.unix.path);
index 5fcacf83da6a57ae6c6188cfbe332d7d6bbba597..1fc1b5c401586a50ff954e4151c867553bdb36ff 100644 (file)
@@ -620,7 +620,7 @@ static int fr_bio_fd_socket_bind_to_device(fr_bio_fd_t *my, UNUSED fr_bio_fd_con
        opt = my->info.socket.inet.ifindex;
 
        switch (my->info.socket.af) {
-       case AF_UNIX:
+       case AF_LOCAL:
                rcode = setsockopt(my->info.socket.fd, IPPROTO_IP, IP_BOUND_IF, &opt, sizeof(opt));
                break;
 
@@ -663,7 +663,7 @@ static int fr_bio_fd_socket_bind(fr_bio_fd_t *my, fr_bio_fd_config_t const *cfg)
        socklen_t salen;
        struct sockaddr_storage salocal;
 
-       if (my->info.socket.af == AF_UNIX) {
+       if (my->info.socket.af == AF_LOCAL) {
                return fr_bio_fd_socket_bind_unix(my, cfg);
        }
 
@@ -808,7 +808,7 @@ int fr_bio_fd_socket_open(fr_bio_t *bio, fr_bio_fd_config_t const *cfg)
         */
        switch (cfg->type) {
                /*
-                *      Unconnected UDP or datagram AF_UNUX server sockets.
+                *      Unconnected UDP or datagram AF_LOCAL server sockets.
                 */
        case FR_BIO_FD_UNCONNECTED:
                if (my->info.socket.type != SOCK_DGRAM) {
@@ -816,7 +816,7 @@ int fr_bio_fd_socket_open(fr_bio_t *bio, fr_bio_fd_config_t const *cfg)
                        return -1;
                }
 
-               if (my->info.socket.af == AF_UNIX) {
+               if (my->info.socket.af == AF_LOCAL) {
                        rcode = fr_bio_fd_common_datagram(fd, &my->info.socket, cfg);
                } else {
                        rcode = fr_bio_fd_server_udp(fd, &my->info.socket, cfg); /* sets SO_REUSEPORT, too */
@@ -829,14 +829,14 @@ int fr_bio_fd_socket_open(fr_bio_t *bio, fr_bio_fd_config_t const *cfg)
                break;
 
                /*
-                *      A connected client: UDP, TCP, or AF_UNIX.
+                *      A connected client: UDP, TCP, or AF_LOCAL.
                 */
        case FR_BIO_FD_CONNECTED:
                if (my->info.socket.type == SOCK_DGRAM) {
                        rcode = fr_bio_fd_common_datagram(fd, &my->info.socket, cfg); /* we don't use SO_REUSEPORT for clients */
                        if (rcode < 0) goto fail;
 
-               } else if (my->info.socket.af != AF_UNIX) {
+               } else if ((my->info.socket.af == AF_INET) || (my->info.socket.af == AF_INET6)) {
                        rcode = fr_bio_fd_common_tcp(fd, &my->info.socket, cfg);
                        if (rcode < 0) goto fail;
                }
@@ -861,7 +861,7 @@ int fr_bio_fd_socket_open(fr_bio_t *bio, fr_bio_fd_config_t const *cfg)
                        rcode = fr_bio_fd_server_ipv6(fd, &my->info.socket, cfg);
                        break;
 
-               case AF_UNIX:
+               case AF_LOCAL:
                        rcode = 0;
                        break;