]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move fr_is_inaddr_any to socket.c
authorAlan T. DeKok <aland@freeradius.org>
Wed, 3 May 2017 15:27:29 +0000 (11:27 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 3 May 2017 15:34:03 +0000 (11:34 -0400)
src/include/libradius.h
src/include/packet.h
src/lib/util/socket.c
src/protocols/radius/list.c

index db9f63458f35fbe0a7d8c95a36b2e2b2cab358b0..3ec28d557f84f6b112979713631e71a8e2f11ea4 100644 (file)
@@ -519,6 +519,7 @@ int         fr_socket_client_tcp(fr_ipaddr_t const *src_ipaddr, fr_ipaddr_t const *dst_
 int            fr_socket_wait_for_connect(int sockfd, struct timeval const *timeout);
 int            fr_socket_server_base(int proto, fr_ipaddr_t *ipaddr, int *port, char const *port_name, bool async);
 int            fr_socket_server_bind(int sockfd, fr_ipaddr_t *ipaddr, int *port, char const *interface);
+int            fr_is_inaddr_any(fr_ipaddr_t *ipaddr);
 
 #ifdef __cplusplus
 }
index 1bc47b1bb8a6c0121c5528621680e2c14d40c333..b587e76c50db734d843146e99f56c453c3d1a79c 100644 (file)
@@ -30,7 +30,6 @@ extern "C" {
 #endif
 
 int fr_packet_cmp(RADIUS_PACKET const *a, RADIUS_PACKET const *b);
-int fr_is_inaddr_any(fr_ipaddr_t *ipaddr);
 void fr_request_from_reply(RADIUS_PACKET *request,
                             RADIUS_PACKET const *reply);
 
index 81513bad8037310aacd86b4e61cba49f59ce5054..d7a9dc8a139896080834bc381284e45c0ef15c13 100644 (file)
@@ -807,3 +807,35 @@ int fr_socket(fr_ipaddr_t const *ipaddr, uint16_t port)
 
        return sockfd;
 }
+
+
+/** Determine if an address is the INADDR_ANY address for its address family
+ *
+ * @param ipaddr to check.
+ * @return
+ *     - 0 if it's not.
+ *     - 1 if it is.
+ *     - -1 on error.
+ */
+int fr_is_inaddr_any(fr_ipaddr_t *ipaddr)
+{
+
+       if (ipaddr->af == AF_INET) {
+               if (ipaddr->ipaddr.ip4addr.s_addr == INADDR_ANY) {
+                       return 1;
+               }
+
+#ifdef HAVE_STRUCT_SOCKADDR_IN6
+       } else if (ipaddr->af == AF_INET6) {
+               if (IN6_IS_ADDR_UNSPECIFIED(&(ipaddr->ipaddr.ip6addr))) {
+                       return 1;
+               }
+#endif
+
+       } else {
+               fr_strerror_printf("Unknown address family");
+               return -1;
+       }
+
+       return 0;
+}
index 8e837c8c388e3f7a125297f80e13ef73b05285e7..a1a1b20eb6926af648a61c9ea65683ff5f3d4c53 100644 (file)
@@ -86,38 +86,6 @@ int fr_packet_cmp(RADIUS_PACKET const *a, RADIUS_PACKET const *b)
        return rcode;
 }
 
-/** Determine if an address is the INADDR_ANY address for its address family
- *
- * @param ipaddr to check.
- * @return
- *     - 0 if it's not.
- *     - 1 if it is.
- *     - -1 on error.
- */
-int fr_is_inaddr_any(fr_ipaddr_t *ipaddr)
-{
-
-       if (ipaddr->af == AF_INET) {
-               if (ipaddr->ipaddr.ip4addr.s_addr == INADDR_ANY) {
-                       return 1;
-               }
-
-#ifdef HAVE_STRUCT_SOCKADDR_IN6
-       } else if (ipaddr->af == AF_INET6) {
-               if (IN6_IS_ADDR_UNSPECIFIED(&(ipaddr->ipaddr.ip6addr))) {
-                       return 1;
-               }
-#endif
-
-       } else {
-               fr_strerror_printf("Unknown address family");
-               return -1;
-       }
-
-       return 0;
-}
-
-
 /*
  *     Create a fake "request" from a reply, for later lookup.
  */