Skip to content

Commit 6dd61d9

Browse files
committed
add config for LI udp port
1 parent 3df5c73 commit 6dd61d9

4 files changed

Lines changed: 33 additions & 20 deletions

File tree

code/bngblaster/src/bbl_config.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const char g_default_system_id[] = "0100.1001.0010";
2020
const char g_default_area[] = "49.0001/24";
2121
const char g_default_ospf_area[] = "0.0.0.0";
2222

23+
extern uint16_t g_li_udp_port;
24+
2325
#define JSON_OBJ_GET_BOOL(_json, _val, _section, _key) \
2426
do { \
2527
_val = json_object_get(_json, _key); \
@@ -3938,7 +3940,8 @@ json_parse_config(json_t *root)
39383940
"stream-burst-ms",
39393941
"reassemble-fragments",
39403942
"multicast-autostart",
3941-
"udp-checksum"
3943+
"udp-checksum",
3944+
"li-udp-port"
39423945
};
39433946
if(!schema_validate(section, "traffic", schema,
39443947
sizeof(schema)/sizeof(schema[0]))) {
@@ -3981,6 +3984,10 @@ json_parse_config(json_t *root)
39813984
if(value) {
39823985
g_ctx->config.stream_udp_checksum = json_boolean_value(value);
39833986
}
3987+
JSON_OBJ_GET_NUMBER(section, value, "traffic", "li-udp-port", 0, 65535);
3988+
if(value) {
3989+
g_li_udp_port = json_number_value(value);
3990+
}
39843991
}
39853992

39863993
/* Session Traffic Configuration */

code/bngblaster/src/bbl_interactive.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,15 @@ void
163163
bbl_interactive_read_key_job(timer_s *timer)
164164
{
165165
int ch;
166+
static bool show_li = false;
166167

167168
UNUSED(timer);
168169

170+
if(!show_li && dict_count(g_ctx->li_flow_dict)) {
171+
show_li = true;
172+
bbl_interactive_init_window();
173+
}
174+
169175
ch = getch();
170176
switch (ch) {
171177
case KEY_F(1):

code/bngblaster/src/bbl_protocols.c

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
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);
1717
static protocol_error_t encode_l2tp(uint8_t *buf, uint16_t *len, bbl_l2tp_s *l2tp);
1818

19+
uint16_t g_li_udp_port = QMX_LI_UDP_PORT;
20+
1921
/**
2022
* This function searches for the BNG Blaster data
2123
* traffic signature and returns true if found.
@@ -3427,37 +3429,32 @@ decode_udp(uint8_t *buf, uint16_t len,
34273429
udp->protocol = UDP_PROTOCOL_DHCP;
34283430
ret_val = decode_dhcp(buf, len, sp, sp_len, (bbl_dhcp_s**)&udp->next);
34293431
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;
34343432
case LDP_PORT:
34353433
if(udp->src == LDP_PORT) {
34363434
udp->protocol = UDP_PROTOCOL_LDP;
34373435
ret_val = decode_ldp_hello(buf, len, sp, sp_len, (bbl_ldp_hello_s**)&udp->next);
34383436
}
34393437
break;
34403438
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+
}
34413443
break;
34423444
}
34433445

34443446
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;
34483454
} 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;
34613458
}
34623459
}
34633460

docsrc/sources/configuration/traffic.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,7 @@
5757
| | | Currently, this is restricted to BBL stream traffic |
5858
| | | only! |
5959
| | | Default: false |
60+
+---------------------------------+--------------------------------------------------------+
61+
| **li-udp-port** | | Change default UDP port for LI traffic. |
62+
| | | Default: 49152 |
6063
+---------------------------------+--------------------------------------------------------+

0 commit comments

Comments
 (0)