Set errno appropriately if we're building without IPv6 support and an IPv6 socket...
[freeradius.git] / src / lib / udpfromto.c
index b96fc59..beda5cf 100644 (file)
@@ -118,7 +118,7 @@ int udpfromto_init(int s)
                proto = SOL_IP;
                flag = IP_PKTINFO;
 #else
-#ifdef IP_RECVDSTADDR
+#  ifdef IP_RECVDSTADDR
 
                /*
                 *      Set the IP_RECVDSTADDR option (BSD).  Note:
@@ -126,9 +126,9 @@ int udpfromto_init(int s)
                 */
                proto = IPPROTO_IP;
                flag = IP_RECVDSTADDR;
-#else
+#  else
                return -1;
-#endif
+#  endif
 #endif
 
 #ifdef AF_INET6
@@ -144,6 +144,9 @@ int udpfromto_init(int s)
                 */
                flag = FR_IPV6_RECVPKTINFO;
 #else
+#  ifdef EPROTONOSUPPORT
+               errno = EPROTONOSUPPORT;
+#  endif
                return -1;
 #  endif
 #endif
@@ -464,7 +467,7 @@ int main(int argc, char **argv)
        struct sockaddr_in from, to, in;
        char buf[TESTLEN];
        char *destip = DESTIP;
-       int port = DEF_PORT;
+       uint16_t port = DEF_PORT;
        int n, server_socket, client_socket, fl, tl, pid;
 
        if (argc > 1) destip = argv[1];