|
16 | 16 | static protocol_error_t decode_l2tp(uint8_t *buf, uint16_t len, uint8_t *sp, uint16_t sp_len, bbl_ethernet_header_s *eth, bbl_l2tp_s **_l2tp); |
17 | 17 | static protocol_error_t encode_l2tp(uint8_t *buf, uint16_t *len, bbl_l2tp_s *l2tp); |
18 | 18 |
|
| 19 | +uint16_t g_li_udp_port = QMX_LI_UDP_PORT; |
| 20 | + |
19 | 21 | /** |
20 | 22 | * This function searches for the BNG Blaster data |
21 | 23 | * traffic signature and returns true if found. |
@@ -3427,37 +3429,32 @@ decode_udp(uint8_t *buf, uint16_t len, |
3427 | 3429 | udp->protocol = UDP_PROTOCOL_DHCP; |
3428 | 3430 | ret_val = decode_dhcp(buf, len, sp, sp_len, (bbl_dhcp_s**)&udp->next); |
3429 | 3431 | break; |
3430 | | - case QMX_LI_UDP_PORT: |
3431 | | - udp->protocol = UDP_PROTOCOL_QMX_LI; |
3432 | | - ret_val = decode_qmx_li(buf, len, sp, sp_len, (bbl_qmx_li_s**)&udp->next); |
3433 | | - break; |
3434 | 3432 | case LDP_PORT: |
3435 | 3433 | if(udp->src == LDP_PORT) { |
3436 | 3434 | udp->protocol = UDP_PROTOCOL_LDP; |
3437 | 3435 | ret_val = decode_ldp_hello(buf, len, sp, sp_len, (bbl_ldp_hello_s**)&udp->next); |
3438 | 3436 | } |
3439 | 3437 | break; |
3440 | 3438 | default: |
| 3439 | + if(udp->dst == g_li_udp_port || udp->src == g_li_udp_port) { |
| 3440 | + udp->protocol = UDP_PROTOCOL_QMX_LI; |
| 3441 | + ret_val = decode_qmx_li(buf, len, sp, sp_len, (bbl_qmx_li_s**)&udp->next); |
| 3442 | + } |
3441 | 3443 | break; |
3442 | 3444 | } |
3443 | 3445 |
|
3444 | 3446 | if(ret_val == UNKNOWN_PROTOCOL) { |
3445 | | - if(udp->src == QMX_LI_UDP_PORT) { |
3446 | | - udp->protocol = UDP_PROTOCOL_QMX_LI; |
3447 | | - ret_val = decode_qmx_li(buf, len, sp, sp_len, (bbl_qmx_li_s**)&udp->next); |
| 3447 | + /* Try if payload could be decoded as BBL! |
| 3448 | + * This fails fast if the 64 bit magic number |
| 3449 | + * is not found on the expected position. */ |
| 3450 | + ret_val = decode_bbl(buf, len, sp, sp_len, (bbl_bbl_s**)&udp->next); |
| 3451 | + if(ret_val == PROTOCOL_SUCCESS) { |
| 3452 | + udp->protocol = UDP_PROTOCOL_BBL; |
| 3453 | + eth->bbl = udp->next; |
3448 | 3454 | } else { |
3449 | | - /* Try if payload could be decoded as BBL! |
3450 | | - * This fails fast if the 64 bit magic number |
3451 | | - * is not found on the expected position. */ |
3452 | | - ret_val = decode_bbl(buf, len, sp, sp_len, (bbl_bbl_s**)&udp->next); |
3453 | | - if(ret_val == PROTOCOL_SUCCESS) { |
3454 | | - udp->protocol = UDP_PROTOCOL_BBL; |
3455 | | - eth->bbl = udp->next; |
3456 | | - } else { |
3457 | | - ret_val = PROTOCOL_SUCCESS; |
3458 | | - udp->protocol = 0; |
3459 | | - udp->next = NULL; |
3460 | | - } |
| 3455 | + ret_val = PROTOCOL_SUCCESS; |
| 3456 | + udp->protocol = 0; |
| 3457 | + udp->next = NULL; |
3461 | 3458 | } |
3462 | 3459 | } |
3463 | 3460 |
|
|
0 commit comments