mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Define EL_PF_INET and EL_PF_INET6 to identify protocol in use instead
of numeric values.
This commit is contained in:
parent
d3670173f2
commit
88730120ba
@ -49,7 +49,7 @@ struct keepalive_connection {
|
||||
timeval_T timeout;
|
||||
timeval_T creation_time;
|
||||
|
||||
unsigned int protocol_family:1; /* 0 == PF_INET, 1 == PF_INET6 */
|
||||
unsigned int protocol_family:1; /* see network/socket.h, EL_PF_INET, EL_PF_INET6 */
|
||||
int socket;
|
||||
};
|
||||
|
||||
|
@ -279,7 +279,7 @@ get_pasv_socket(struct socket *ctrl_socket, struct sockaddr_storage *addr)
|
||||
#ifdef CONFIG_IPV6
|
||||
struct sockaddr_in6 bind_addr6;
|
||||
|
||||
if (ctrl_socket->protocol_family == 1) {
|
||||
if (ctrl_socket->protocol_family == EL_PF_INET6) {
|
||||
bind_addr = (struct sockaddr *) &bind_addr6;
|
||||
addrlen = sizeof(bind_addr6);
|
||||
} else
|
||||
@ -316,7 +316,7 @@ sock_error:
|
||||
|
||||
memcpy(bind_addr, pasv_addr, addrlen);
|
||||
#ifdef CONFIG_IPV6
|
||||
if (ctrl_socket->protocol_family == 1)
|
||||
if (ctrl_socket->protocol_family == EL_PF_INET6)
|
||||
bind_addr6.sin6_port = 0;
|
||||
else
|
||||
#endif
|
||||
@ -585,7 +585,7 @@ connect_socket(struct socket *csocket, enum connection_state state)
|
||||
if (connect(sock, (struct sockaddr *) &addr,
|
||||
sizeof(struct sockaddr_in6)) == 0) {
|
||||
/* Success */
|
||||
csocket->protocol_family = 1;
|
||||
csocket->protocol_family = EL_PF_INET6;
|
||||
complete_connect_socket(csocket, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
@ -595,7 +595,7 @@ connect_socket(struct socket *csocket, enum connection_state state)
|
||||
if (connect(sock, (struct sockaddr *) &addr,
|
||||
sizeof(struct sockaddr_in)) == 0) {
|
||||
/* Success */
|
||||
csocket->protocol_family = 0;
|
||||
csocket->protocol_family = EL_PF_INET;
|
||||
complete_connect_socket(csocket, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
@ -94,12 +94,14 @@ struct socket {
|
||||
* lot of compilation time. --pasky */
|
||||
void *ssl;
|
||||
|
||||
unsigned int protocol_family:1; /* 0 == PF_INET, 1 == PF_INET6 */
|
||||
unsigned int protocol_family:1; /* EL_PF_INET, EL_PF_INET6 */
|
||||
unsigned int need_ssl:1; /* If the socket needs SSL support */
|
||||
unsigned int no_tls:1; /* Internal SSL flag. */
|
||||
unsigned int duplex:1; /* Allow simultaneous reads & writes. */
|
||||
};
|
||||
|
||||
#define EL_PF_INET 0
|
||||
#define EL_PF_INET6 1
|
||||
|
||||
/* Socket management: */
|
||||
|
||||
|
@ -592,7 +592,7 @@ get_ftp_data_socket(struct connection *conn, struct string *command)
|
||||
#ifdef CONFIG_IPV6
|
||||
ftp->use_epsv = get_opt_bool("protocol.ftp.use_epsv");
|
||||
|
||||
if (conn->socket->protocol_family == 1) {
|
||||
if (conn->socket->protocol_family == EL_PF_INET6) {
|
||||
if (ftp->use_epsv) {
|
||||
add_to_string(command, "EPSV");
|
||||
|
||||
@ -1201,9 +1201,9 @@ ftp_data_accept(struct connection *conn)
|
||||
set_connection_timeout(conn);
|
||||
clear_handlers(conn->data_socket->fd);
|
||||
|
||||
if ((conn->socket->protocol_family != 1 && ftp->use_pasv)
|
||||
if ((conn->socket->protocol_family != EL_PF_INET6 && ftp->use_pasv)
|
||||
#ifdef CONFIG_IPV6
|
||||
|| (conn->socket->protocol_family == 1 && ftp->use_epsv)
|
||||
|| (conn->socket->protocol_family == EL_PF_INET6 && ftp->use_epsv)
|
||||
#endif
|
||||
) {
|
||||
newsock = conn->data_socket->fd;
|
||||
|
Loading…
Reference in New Issue
Block a user