mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
PPPoE max-payload (#155)
This commit is contained in:
@@ -1990,6 +1990,10 @@ json_parse_config(json_t *root)
|
||||
if(json_is_boolean(value)) {
|
||||
g_ctx->config.pppoe_host_uniq = json_boolean_value(value);
|
||||
}
|
||||
value = json_object_get(section, "max-payload");
|
||||
if(json_is_number(value)) {
|
||||
g_ctx->config.pppoe_max_payload = json_number_value(value);
|
||||
}
|
||||
value = json_object_get(section, "vlan-priority");
|
||||
if(json_is_number(value)) {
|
||||
g_ctx->config.pppoe_vlan_priority = json_number_value(value);
|
||||
|
||||
@@ -229,6 +229,7 @@ typedef struct bbl_ctx_
|
||||
uint32_t pppoe_session_time;
|
||||
uint16_t pppoe_discovery_timeout;
|
||||
uint16_t pppoe_discovery_retry;
|
||||
uint16_t pppoe_max_payload;
|
||||
uint8_t pppoe_vlan_priority;
|
||||
char *pppoe_service_name;
|
||||
bool pppoe_reconnect;
|
||||
|
||||
@@ -1451,6 +1451,15 @@ encode_pppoe_discovery(uint8_t *buf, uint16_t *len,
|
||||
BUMP_WRITE_BUFFER(buf, len, pppoe->host_uniq_len);
|
||||
pppoe_len += pppoe->host_uniq_len;
|
||||
}
|
||||
if(pppoe->max_payload) {
|
||||
*(uint16_t*)buf = htobe16(PPPOE_TAG_MAX_PAYLOAD);
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint16_t));
|
||||
*(uint16_t*)buf = htobe16(sizeof(uint16_t));
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint16_t));
|
||||
*(uint16_t*)buf = htobe16(pppoe->max_payload);
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint16_t));
|
||||
pppoe_len += 6;
|
||||
}
|
||||
if(pppoe->ac_cookie) {
|
||||
*(uint16_t*)buf = htobe16(PPPOE_TAG_AC_COOKIE);
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint16_t));
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
#define PPPOE_TAG_HOST_UNIQ 0x0103
|
||||
#define PPPOE_TAG_AC_COOKIE 0x0104
|
||||
#define PPPOE_TAG_VENDOR 0x0105
|
||||
#define PPPOE_TAG_MAX_PAYLOAD 0x0120
|
||||
|
||||
#define PPPOE_PADI 0x09
|
||||
#define PPPOE_PADO 0x07
|
||||
@@ -614,6 +615,7 @@ typedef struct bbl_pppoe_discovery_ {
|
||||
uint16_t ac_cookie_len;
|
||||
uint8_t *host_uniq;
|
||||
uint16_t host_uniq_len;
|
||||
uint16_t max_payload;
|
||||
access_line_s *access_line;
|
||||
} bbl_pppoe_discovery_s;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user