diff options
| author | yangwei <[email protected]> | 2024-03-12 18:31:47 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-03-12 18:31:47 +0800 |
| commit | dc679ead1ed057e6fabbfeaec4ab2fdaebd13c27 (patch) | |
| tree | ae0b966864a19802a98ec549dc413f7df0fe6430 | |
| parent | 726f77a4645d9b3a4ed7e9a13a9205688e7f2860 (diff) | |
✨ feat(session new): new session for innermost streamv1.0.15
| -rw-r--r-- | src/adapter/adapter.c | 1 | ||||
| -rw-r--r-- | src/stellar_on_sapp/stellar_on_sapp.c | 18 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/adapter/adapter.c b/src/adapter/adapter.c index 0d86e4e..30ad67a 100644 --- a/src/adapter/adapter.c +++ b/src/adapter/adapter.c @@ -47,6 +47,7 @@ static struct plugin_specific *load_plugin_specs(const char *toml_conf_path, int { *spec_num = 0; FILE* fp = fopen(toml_conf_path, "r"); + if(fp==NULL)return NULL; char errbuf[256]; toml_table_t* conf = toml_parse_file(fp, errbuf, sizeof(errbuf)); fclose(fp); diff --git a/src/stellar_on_sapp/stellar_on_sapp.c b/src/stellar_on_sapp/stellar_on_sapp.c index 42f2d27..dd0d834 100644 --- a/src/stellar_on_sapp/stellar_on_sapp.c +++ b/src/stellar_on_sapp/stellar_on_sapp.c @@ -26,9 +26,17 @@ struct stellar *g_stellar=NULL; int g_session_bridge_id=-1; int g_streaminfo_exdata_id=-1; -static int is_l7_type_tunnels(struct streaminfo *a_stream) +static int stream_is_inner_most(struct streaminfo *a_stream) { const struct streaminfo *pfather=NULL, *ptmp=a_stream; + unsigned short tunnel_type=0; + int tunnel_type_len=sizeof(unsigned short); + MESA_get_stream_opt(a_stream, MSO_STREAM_UP_LAYER_TUNNEL_TYPE, (void *)&tunnel_type, &tunnel_type_len); + if (tunnel_type != STREAM_TUNNLE_NON) // tunnel_type != STREAM_TUNNLE_NON means it is a outer of tunnel + { + return 0; + } + while(ptmp) { pfather = ptmp->pfather; @@ -37,13 +45,13 @@ static int is_l7_type_tunnels(struct streaminfo *a_stream) case STREAM_TYPE_SOCKS4: case STREAM_TYPE_SOCKS5: case STREAM_TYPE_HTTP_PROXY: - return 1; + return 0; default: break; } ptmp = pfather; } - return 0; + return 1; } static void stellar_on_sapp_bridge_free(const struct streaminfo *stream, int bridge_id, void *data) @@ -78,7 +86,7 @@ int STELLAR_DEFER_LOADER_INIT() char stellar_on_sapp_defer_entry(struct streaminfo *pstream,void **pme, int thread_seq,void *a_packet) { - if(pstream->pktstate==OP_STATE_PENDING && is_l7_type_tunnels(pstream)==1) + if(pstream->pktstate==OP_STATE_PENDING && stream_is_inner_most(pstream)==0) { return APP_STATE_DROPME; } @@ -106,7 +114,7 @@ static unsigned char loader_transfer_stream_entry(struct streaminfo *pstream, UC int is_ctrl_pkt=0; const void *raw_pkt=NULL; unsigned char entry_ret=APP_STATE_GIVEME; - if(state == OP_STATE_PENDING && (is_l7_type_tunnels(pstream)==1)) + if(state == OP_STATE_PENDING && (stream_is_inner_most(pstream)==0)) { return APP_STATE_DROPME; } |
