mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-08 22:15:38 +00:00
Fix some style issues in udp_proxy
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
34cbf106f3
commit
7fe5ac1b62
|
@ -523,12 +523,13 @@ void print_packet( const packet *p, const char *why )
|
||||||
*
|
*
|
||||||
* We want an explicit state and a place to store the packet.
|
* We want an explicit state and a place to store the packet.
|
||||||
*/
|
*/
|
||||||
static enum {
|
typedef enum {
|
||||||
ich_init, /* haven't seen the first ClientHello yet */
|
ICH_INIT, /* haven't seen the first ClientHello yet */
|
||||||
ich_cached, /* cached the initial ClientHello */
|
ICH_CACHED, /* cached the initial ClientHello */
|
||||||
ich_injected, /* ClientHello already injected, done */
|
ICH_INJECTED, /* ClientHello already injected, done */
|
||||||
} inject_clihlo_state;
|
} inject_clihlo_state_t;
|
||||||
|
|
||||||
|
static inject_clihlo_state_t inject_clihlo_state;
|
||||||
static packet initial_clihlo;
|
static packet initial_clihlo;
|
||||||
|
|
||||||
int send_packet( const packet *p, const char *why )
|
int send_packet( const packet *p, const char *why )
|
||||||
|
@ -538,11 +539,11 @@ int send_packet( const packet *p, const char *why )
|
||||||
|
|
||||||
/* save initial ClientHello? */
|
/* save initial ClientHello? */
|
||||||
if( opt.inject_clihlo != 0 &&
|
if( opt.inject_clihlo != 0 &&
|
||||||
inject_clihlo_state == ich_init &&
|
inject_clihlo_state == ICH_INIT &&
|
||||||
strcmp( p->type, "ClientHello" ) == 0 )
|
strcmp( p->type, "ClientHello" ) == 0 )
|
||||||
{
|
{
|
||||||
memcpy( &initial_clihlo, p, sizeof( packet ) );
|
memcpy( &initial_clihlo, p, sizeof( packet ) );
|
||||||
inject_clihlo_state = ich_cached;
|
inject_clihlo_state = ICH_CACHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* insert corrupted ApplicationData record? */
|
/* insert corrupted ApplicationData record? */
|
||||||
|
@ -592,7 +593,7 @@ int send_packet( const packet *p, const char *why )
|
||||||
|
|
||||||
/* Inject ClientHello after first ApplicationData */
|
/* Inject ClientHello after first ApplicationData */
|
||||||
if( opt.inject_clihlo != 0 &&
|
if( opt.inject_clihlo != 0 &&
|
||||||
inject_clihlo_state == ich_cached &&
|
inject_clihlo_state == ICH_CACHED &&
|
||||||
strcmp( p->type, "ApplicationData" ) == 0 )
|
strcmp( p->type, "ApplicationData" ) == 0 )
|
||||||
{
|
{
|
||||||
print_packet( &initial_clihlo, "injected" );
|
print_packet( &initial_clihlo, "injected" );
|
||||||
|
@ -604,7 +605,7 @@ int send_packet( const packet *p, const char *why )
|
||||||
return( ret );
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
inject_clihlo_state = ich_injected;
|
inject_clihlo_state = ICH_INJECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
|
Loading…
Reference in a new issue