- * This creates a ready-made IPv4/v6 socket structure after looking up the
- * necessary parameters. The interpretation of \a host depends on the value of
- * \a passive:
- * - on a passive socket host is interpreted as an interface IPv4/6 address
- * (can be left NULL);
- * - on an active socket, \a host is the peer DNS name or IPv4/6 address
- * to connect to;
- * - \a port_number is in either case the numeric port number (not service
- * string).
- *
- * Furthermore, bind(2) is called on passive sockets, and connect(2) on active
- * sockets. The algorithm tries all possible address combinations until it
- * succeeds. If \a fo is supplied, options are set and cleanup is performed.
- *
- * \return This function returns 1 on success and \a -E_ADDRESS_LOOKUP when no
- * matching connection could be set up (with details in the error log).
- *
- * \sa ipv6(7), getaddrinfo(3), bind(2), connect(2).
- */
-int makesock(unsigned l4type, bool passive,
- const char *host, uint16_t port_number,
- struct flowopts *fo)
-{
- struct addrinfo *local = NULL, *src,
- *remote = NULL, *dst, hints;
- unsigned int l3type = AF_UNSPEC;
- int rc, on = 1, sockfd = -1,
- socktype = sock_type(l4type);
+ * The interpretation of \a host depends on the value of \a passive. On a
+ * passive socket host is interpreted as an interface IPv4/6 address (can be
+ * left NULL). On an active socket, \a host is the peer DNS name or IPv4/6
+ * address to connect to.
+ *
+ * \return Standard.
+ *
+ * \sa getaddrinfo(3).
+ */
+int lookup_address(unsigned l4type, bool passive, const char *host,
+ int port_number, struct addrinfo **result)
+{
+ int ret;