mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
fixed #115 l2tp hello
This commit is contained in:
committed by
Christian Giese
parent
99666edc87
commit
ddebe8cb2e
@@ -2468,7 +2468,7 @@ json_parse_config(json_t *root)
|
||||
}
|
||||
l2tp_server->receive_window = number;
|
||||
} else {
|
||||
l2tp_server->receive_window = 4;
|
||||
l2tp_server->receive_window = 16;
|
||||
}
|
||||
value = json_object_get(sub, "max-retry");
|
||||
if(json_is_number(value)) {
|
||||
@@ -2479,7 +2479,7 @@ json_parse_config(json_t *root)
|
||||
}
|
||||
l2tp_server->max_retry = number;
|
||||
} else {
|
||||
l2tp_server->max_retry = 30;
|
||||
l2tp_server->max_retry = 5;
|
||||
}
|
||||
if(json_unpack(sub, "{s:s}", "congestion-mode", &s) == 0) {
|
||||
if(strcmp(s, "default") == 0) {
|
||||
@@ -2525,6 +2525,17 @@ json_parse_config(json_t *root)
|
||||
}
|
||||
l2tp_server->data_control_tos = number;
|
||||
}
|
||||
value = json_object_get(sub, "hello-interval");
|
||||
if(json_is_number(value)) {
|
||||
number = json_number_value(value);
|
||||
if(number < 0 || number > UINT16_MAX) {
|
||||
fprintf(stderr, "JSON config error: Invalid value for l2tp-server->hello-interval\n");
|
||||
return false;
|
||||
}
|
||||
l2tp_server->hello_interval = number;
|
||||
} else {
|
||||
l2tp_server->hello_interval = 30;
|
||||
}
|
||||
}
|
||||
} else if(json_is_object(section)) {
|
||||
fprintf(stderr, "JSON config error: List expected in L2TP server configuration but dictionary found\n");
|
||||
|
||||
@@ -251,9 +251,9 @@ bbl_l2tp_tunnel_tx_job(timer_s *timer)
|
||||
bbl_l2tp_queue_s *q = NULL;
|
||||
bbl_l2tp_queue_s *q_del = NULL;
|
||||
|
||||
struct timespec timestamp;
|
||||
struct timespec now;
|
||||
struct timespec time_diff;
|
||||
double time_diff_ms;
|
||||
int backoff;
|
||||
|
||||
uint16_t max_ns = l2tp_tunnel->peer_nr + l2tp_tunnel->cwnd;
|
||||
|
||||
@@ -264,7 +264,7 @@ bbl_l2tp_tunnel_tx_job(timer_s *timer)
|
||||
}
|
||||
}
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, ×tamp);
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
q = CIRCLEQ_FIRST(&l2tp_tunnel->txq_qhead);
|
||||
while (q != (const void *)(&l2tp_tunnel->txq_qhead)) {
|
||||
@@ -281,9 +281,9 @@ bbl_l2tp_tunnel_tx_job(timer_s *timer)
|
||||
}
|
||||
if(L2TP_SEQ_LT(q->ns, max_ns)) {
|
||||
if(q->last_tx_time.tv_sec) {
|
||||
timespec_sub(&time_diff, ×tamp, &q->last_tx_time);
|
||||
time_diff_ms = round(time_diff.tv_nsec / 1.0e6) * (time_diff.tv_sec * 1000);
|
||||
if(time_diff_ms < (q->retries * 1000)) {
|
||||
timespec_sub(&time_diff, &now, &q->last_tx_time);
|
||||
backoff = 1 << (q->retries - 1);
|
||||
if(time_diff.tv_sec < backoff) {
|
||||
q = CIRCLEQ_NEXT(q, txq_qnode);
|
||||
continue;
|
||||
}
|
||||
@@ -292,8 +292,8 @@ bbl_l2tp_tunnel_tx_job(timer_s *timer)
|
||||
l2tp_tunnel->stats.control_tx++;
|
||||
interface->stats.l2tp_control_tx++;
|
||||
l2tp_tunnel->zlb = false;
|
||||
q->last_tx_time.tv_sec = timestamp.tv_sec;
|
||||
q->last_tx_time.tv_nsec = timestamp.tv_nsec;
|
||||
q->last_tx_time.tv_sec = now.tv_sec;
|
||||
q->last_tx_time.tv_nsec = now.tv_nsec;
|
||||
/* Update Nr. ... */
|
||||
*(uint16_t*)(q->packet + q->nr_offset) = htobe16(l2tp_tunnel->nr);
|
||||
if(q->retries) {
|
||||
|
||||
@@ -63,7 +63,6 @@ typedef struct bbl_l2tp_server_
|
||||
{
|
||||
/* Filled by configuration ...*/
|
||||
uint32_t ip;
|
||||
uint16_t idle_timeout;
|
||||
uint16_t hello_interval;
|
||||
uint16_t session_limit;
|
||||
uint16_t receive_window;
|
||||
|
||||
@@ -21,13 +21,16 @@
|
||||
-
|
||||
* - `receive-window-size`
|
||||
- Control messages receive window size
|
||||
- 4
|
||||
- 16
|
||||
* - `max-retry`
|
||||
- Control messages max retry
|
||||
- 30
|
||||
- 5
|
||||
* - `congestion-mode`
|
||||
- Control messages congestion mode
|
||||
- default
|
||||
* - `hello-interval`
|
||||
- Set hello interval
|
||||
- 30
|
||||
* - `data-control-priority`
|
||||
- Set the priority bit in the L2TP header for all non-IP data packets (LCP, IPCP, ...)
|
||||
- false
|
||||
|
||||
Reference in New Issue
Block a user