add config l2tp-server->lcp-padding

This config options allows to add a
fixed padding to all LCP packets send
from emulated LNS.
This commit is contained in:
Christian Giese
2022-11-04 16:15:01 +00:00
parent 3f204e3805
commit 39fd6b4bc2
6 changed files with 20 additions and 9 deletions
+4
View File
@@ -2544,6 +2544,10 @@ json_parse_config(json_t *root)
} else {
l2tp_server->hello_interval = 30;
}
value = json_object_get(sub, "lcp-padding");
if(json_is_number(value)) {
l2tp_server->lcp_padding = json_number_value(value);;
}
}
} else if(json_is_object(section)) {
fprintf(stderr, "JSON config error: List expected in L2TP server configuration but dictionary found\n");
+7 -8
View File
@@ -904,21 +904,20 @@ bbl_l2tp_data_rx(bbl_network_interface_s *interface,
}
l2tp_session->stats.data_rx++;
switch (l2tp->protocol) {
switch(l2tp->protocol) {
case PROTOCOL_LCP:
lcp_rx = (bbl_lcp_s*)l2tp->next;
if(lcp_rx->code == PPP_CODE_TERM_REQUEST) {
lcp_rx->padding = l2tp_session->tunnel->server->lcp_padding;
if(lcp_rx->code == PPP_CODE_ECHO_REQUEST) {
lcp_rx->code = PPP_CODE_ECHO_REPLY;
bbl_l2tp_send_data(l2tp_session, PROTOCOL_LCP, lcp_rx);
} else if(lcp_rx->code == PPP_CODE_TERM_REQUEST) {
l2tp_session->disconnect_code = 3;
l2tp_session->disconnect_protocol = 0;
l2tp_session->disconnect_direction = 1;
bbl_l2tp_send(l2tp_session->tunnel, l2tp_session, L2TP_MESSAGE_CDN);
bbl_l2tp_session_delete(l2tp_session);
return;
}
if(lcp_rx->code == PPP_CODE_ECHO_REQUEST) {
lcp_rx->code = PPP_CODE_ECHO_REPLY;
bbl_l2tp_send_data(l2tp_session, PROTOCOL_LCP, lcp_rx);
}
}
break;
case PROTOCOL_PAP:
memset(&pap_tx, 0x0, sizeof(bbl_pap_s));
+1
View File
@@ -67,6 +67,7 @@ typedef struct bbl_l2tp_server_
uint16_t session_limit;
uint16_t receive_window;
uint16_t max_retry;
uint16_t lcp_padding;
bool data_control_priority;
bool data_length;
+4 -1
View File
@@ -1206,7 +1206,7 @@ encode_ppp_lcp(uint8_t *buf, uint16_t *len,
lcp_len = lcp->options_len + 4;
*lcp_len_field = htobe16(lcp_len);
} else {
/* Constuct options ... */
/* Options ... */
lcp_len = 4;
if(lcp->mru) {
*buf = PPP_LCP_OPTION_MRU;
@@ -1238,6 +1238,9 @@ encode_ppp_lcp(uint8_t *buf, uint16_t *len,
*lcp_len_field = htobe16(lcp_len);
}
}
if(lcp->padding) {
BUMP_WRITE_BUFFER(buf, len, lcp->padding);
}
return PROTOCOL_SUCCESS;
}
+1
View File
@@ -634,6 +634,7 @@ typedef struct bbl_lcp_ {
uint16_t vendor_value_len;
uint8_t *start;
uint16_t len;
uint16_t padding;
uint8_t *option[PPP_MAX_OPTIONS];
bool unknown_options;
} bbl_lcp_s;
+3
View File
@@ -46,6 +46,9 @@
* - `data-control-tos`
- Set the L2TP tunnel TOS priority (outer IPv4 header) for all non-IP data packets (LCP, IPCP, ...)
- 0
* - `lcp-padding`
- Add fixed padding to LCP packets send from LNS
- 0
The BNG Blaster supports different congestion modes for the
reliable delivery of control messages. The ``default`` mode