修正stream_proto从cmsg读出的方式

This commit is contained in:
luqiuwen
2019-06-02 17:18:34 +08:00
parent 57f5a4d906
commit 7462a558c1
2 changed files with 6 additions and 4 deletions

View File

@@ -106,10 +106,11 @@ int tfe_proxy_fds_accept(struct tfe_proxy * ctx, int fd_downstream, int fd_upstr
struct tfe_stream * stream = tfe_stream_create(ctx, worker_thread_ctx); struct tfe_stream * stream = tfe_stream_create(ctx, worker_thread_ctx);
enum tfe_stream_proto stream_protocol; enum tfe_stream_proto stream_protocol;
uint16_t __size; uint8_t stream_protocol_in_char = 0;
uint16_t size = 0;
int result = tfe_cmsg_get_value(cmsg, TFE_CMSG_TCP_RESTORE_PROTOCOL, (unsigned char *)&stream_protocol, int result = tfe_cmsg_get_value(cmsg, TFE_CMSG_TCP_RESTORE_PROTOCOL, (unsigned char *)&stream_protocol_in_char,
sizeof(stream_protocol), &__size); sizeof(stream_protocol_in_char), &size);
if (unlikely(result < 0)) if (unlikely(result < 0))
{ {
@@ -117,6 +118,7 @@ int tfe_proxy_fds_accept(struct tfe_proxy * ctx, int fd_downstream, int fd_upstr
goto __errout; goto __errout;
} }
stream_protocol = (enum tfe_stream_proto)stream_protocol_in_char;
tfe_stream_option_set(stream, TFE_STREAM_OPT_SESSION_TYPE, &stream_protocol, sizeof(stream_protocol)); tfe_stream_option_set(stream, TFE_STREAM_OPT_SESSION_TYPE, &stream_protocol, sizeof(stream_protocol));
tfe_stream_cmsg_setup(stream, cmsg); tfe_stream_cmsg_setup(stream, cmsg);

View File

@@ -214,7 +214,7 @@ enum ssl_stream_action ssl_policy_enforce(struct ssl_stream *upstream, void* u_p
ret=ssl_stream_get_integer_opt(upstream, SSL_STREAM_OPT_IS_MUTUAL_AUTH, &is_mauth); ret=ssl_stream_get_integer_opt(upstream, SSL_STREAM_OPT_IS_MUTUAL_AUTH, &is_mauth);
ret=ssl_stream_get_integer_opt(upstream, SSL_STREAM_OPT_IS_CT_CERT, &is_ct); ret=ssl_stream_get_integer_opt(upstream, SSL_STREAM_OPT_IS_CT_CERT, &is_ct);
ret=ssl_stream_get_integer_opt(upstream, SSL_STREAM_OPT_HAS_PROTOCOL_ERRORS, &has_error); ret=ssl_stream_get_integer_opt(upstream, SSL_STREAM_OPT_HAS_PROTOCOL_ERRORS, &has_error);
assert(ret=0); assert(ret==0);
if( (pinning_staus==1 && param->bypass_pinning) || if( (pinning_staus==1 && param->bypass_pinning) ||
(is_mauth && param->bypass_mutual_auth) || (is_mauth && param->bypass_mutual_auth) ||
(is_ev && param->bypass_ev_cert) || (is_ev && param->bypass_ev_cert) ||