]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove dead code. CID #1469168
authorAlan T. DeKok <aland@freeradius.org>
Sun, 17 Apr 2022 13:45:12 +0000 (09:45 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 20 Apr 2022 13:14:10 +0000 (09:14 -0400)
src/lib/util/socket.c

index cb49d9970f8f08b86092e1db12f928316ca0f6b6..c17947225f7354c946408ce5a4ee5046b78c4935 100644 (file)
@@ -405,11 +405,10 @@ int fr_socket_client_udp(fr_ipaddr_t *src_ipaddr, uint16_t *src_port, fr_ipaddr_
         *      FreeBSD jail issues.  We bind to 0.0.0.0, but the
         *      kernel instead binds us to a 1.2.3.4.  So once the
         *      socket is bound, ask it what it's IP address is.
+        *
+        *      If the caller asks for only one, well, too bad.
         */
-       if (src_port) {
-               fr_ipaddr_t             my_ipaddr;
-               uint16_t                my_port;
-
+       if (src_ipaddr && src_port) {
                salen = sizeof(salocal);
                memset(&salocal, 0, salen);
                if (getsockname(sockfd, (struct sockaddr *) &salocal, &salen) < 0) {
@@ -418,12 +417,6 @@ int fr_socket_client_udp(fr_ipaddr_t *src_ipaddr, uint16_t *src_port, fr_ipaddr_
                        return -1;
                }
 
-               /*
-                *      Return these if the caller cared.
-                */
-               if (!src_ipaddr) src_ipaddr = &my_ipaddr;
-               if (!src_port) src_port = &my_port;
-
                if (fr_ipaddr_from_sockaddr(src_ipaddr, src_port, &salocal, salen) < 0) {
                        close(sockfd);
                        return -1;