diff --git a/src/bbl_a10nsp.c b/src/bbl_a10nsp.c index 5a6c6e7d..cc574a73 100644 --- a/src/bbl_a10nsp.c +++ b/src/bbl_a10nsp.c @@ -272,7 +272,9 @@ bbl_a10nsp_pppoes_handler(bbl_interface_s *interface, stream = *search; stream->packets_rx++; stream->rx_len = eth->length; - stream->rx_priority = ((bbl_ipv4_t*)eth->next)->tos; + stream->rx_priority = ipv4->tos; + stream->rx_outer_vlan_pbit = eth->vlan_outer_priority; + stream->rx_inner_vlan_pbit = eth->vlan_inner_priority; timespec_sub(&delay, ð->timestamp, &bbl->timestamp); delay_nsec = delay.tv_sec * 1e9 + delay.tv_nsec; if(delay_nsec > stream->max_delay_ns) { diff --git a/src/bbl_l2tp.c b/src/bbl_l2tp.c index 49d50eee..b3197c52 100644 --- a/src/bbl_l2tp.c +++ b/src/bbl_l2tp.c @@ -1026,7 +1026,9 @@ bbl_l2tp_data_rx(bbl_ethernet_header_t *eth, bbl_l2tp_t *l2tp, bbl_interface_s * stream = *search; stream->packets_rx++; stream->rx_len = eth->length; - stream->rx_priority = ((bbl_ipv4_t*)eth->next)->tos; + stream->rx_priority = ipv4->tos; + stream->rx_outer_vlan_pbit = eth->vlan_outer_priority; + stream->rx_inner_vlan_pbit = eth->vlan_inner_priority; timespec_sub(&delay, ð->timestamp, &bbl->timestamp); delay_nsec = delay.tv_sec * 1e9 + delay.tv_nsec; if(delay_nsec > stream->max_delay_ns) { diff --git a/src/bbl_stream.c b/src/bbl_stream.c index 134284a3..e142b0da 100644 --- a/src/bbl_stream.c +++ b/src/bbl_stream.c @@ -148,6 +148,7 @@ bbl_stream_build_access_pppoe_packet(bbl_stream *stream) { bbl.outer_vlan_id = session->vlan_key.outer_vlan_id; bbl.inner_vlan_id = session->vlan_key.inner_vlan_id; bbl.flow_id = stream->flow_id; + bbl.tos = config->priority; bbl.direction = BBL_DIRECTION_UP; switch (stream->config->type) { @@ -263,10 +264,10 @@ bbl_stream_build_a10nsp_pppoe_packet(bbl_stream *stream) { eth.qinq = a10nsp_if->qinq; eth.vlan_outer = a10nsp_session->s_vlan; } - eth.vlan_outer_priority = config->vlan_priority; eth.vlan_inner = session->vlan_key.inner_vlan_id; - eth.vlan_inner_priority = config->vlan_priority; eth.vlan_three = session->access_third_vlan; + eth.vlan_outer_priority = config->vlan_priority; + eth.vlan_inner_priority = config->vlan_priority; eth.type = ETH_TYPE_PPPOE_SESSION; eth.next = &pppoe; pppoe.session_id = session->pppoe_session_id; @@ -280,7 +281,7 @@ bbl_stream_build_a10nsp_pppoe_packet(bbl_stream *stream) { bbl.outer_vlan_id = session->vlan_key.outer_vlan_id; bbl.inner_vlan_id = session->vlan_key.inner_vlan_id; bbl.flow_id = stream->flow_id; - + bbl.tos = config->priority; switch (stream->config->type) { case STREAM_IPV4: pppoe.protocol = PROTOCOL_IPV4; @@ -388,10 +389,10 @@ bbl_stream_build_access_ipoe_packet(bbl_stream *stream) { eth.src = session->client_mac; eth.qinq = session->access_config->qinq; eth.vlan_outer = session->vlan_key.outer_vlan_id; - eth.vlan_outer_priority = config->vlan_priority; eth.vlan_inner = session->vlan_key.inner_vlan_id; - eth.vlan_inner_priority = config->vlan_priority; eth.vlan_three = session->access_third_vlan; + eth.vlan_inner_priority = config->vlan_priority; + eth.vlan_outer_priority = config->vlan_priority; udp.src = BBL_UDP_PORT; udp.dst = BBL_UDP_PORT; @@ -403,6 +404,7 @@ bbl_stream_build_access_ipoe_packet(bbl_stream *stream) { bbl.outer_vlan_id = session->vlan_key.outer_vlan_id; bbl.inner_vlan_id = session->vlan_key.inner_vlan_id; bbl.flow_id = stream->flow_id; + bbl.tos = config->priority; bbl.direction = BBL_DIRECTION_UP; switch (stream->config->type) { @@ -519,6 +521,7 @@ bbl_stream_build_network_packet(bbl_stream *stream) { bbl.inner_vlan_id = session->vlan_key.inner_vlan_id; } bbl.flow_id = stream->flow_id; + bbl.tos = config->priority; bbl.direction = BBL_DIRECTION_DOWN; switch (stream->config->type) { case STREAM_IPV4: @@ -667,6 +670,7 @@ bbl_stream_build_l2tp_packet(bbl_stream *stream) { bbl.outer_vlan_id = session->vlan_key.outer_vlan_id; bbl.inner_vlan_id = session->vlan_key.inner_vlan_id; bbl.flow_id = stream->flow_id; + bbl.tos = config->priority; bbl.direction = BBL_DIRECTION_DOWN; bbl.sub_type = BBL_SUB_TYPE_IPV4; if (config->length > 76) { @@ -1177,6 +1181,7 @@ bbl_stream_add(bbl_ctx_s *ctx, bbl_access_config_s *access_config, bbl_session_s bbl_stream *stream; bbl_stream *session_stream; bbl_stream_thread *thread; + bbl_interface_s *network_if; dict_insert_result result; @@ -1184,28 +1189,25 @@ bbl_stream_add(bbl_ctx_s *ctx, bbl_access_config_s *access_config, bbl_session_s long timer_nsec = 0; config = ctx->config.stream_config; - - /* * - * The corresponding network interfaces will be selected - * in the following order: - * - "network-interface" from stream section - * - "network-interface" from access interface section - * - first network interface from network section (default) - */ - bbl_interface_s *network_if; - if(config->network_interface) { - network_if = bbl_get_network_interface(ctx, config->network_interface); - } else if(config->a10nsp_interface) { - network_if = bbl_get_a10nsp_interface(ctx, config->a10nsp_interface); - } else { - network_if = session->network_interface; - } - if(!network_if) { - return false; - } - while(config) { if(config->stream_group_id == access_config->stream_group_id) { + /* * + * The corresponding network interfaces will be selected + * in the following order: + * - "network-interface" from stream section + * - "network-interface" from access interface section + * - first network interface from network section (default) + */ + if(config->network_interface) { + network_if = bbl_get_network_interface(ctx, config->network_interface); + } else if(config->a10nsp_interface) { + network_if = bbl_get_a10nsp_interface(ctx, config->a10nsp_interface); + } else { + network_if = session->network_interface; + } + if(!network_if) { + return false; + } if(!network_if) { LOG(ERROR, "Failed to add stream because of missing network interface\n"); return false;