diff --git a/code/bngblaster/src/bbl_config.c b/code/bngblaster/src/bbl_config.c index 0cd1bf40..18720083 100644 --- a/code/bngblaster/src/bbl_config.c +++ b/code/bngblaster/src/bbl_config.c @@ -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); diff --git a/code/bngblaster/src/bbl_ctx.h b/code/bngblaster/src/bbl_ctx.h index 59eda4b8..ec36ca9b 100644 --- a/code/bngblaster/src/bbl_ctx.h +++ b/code/bngblaster/src/bbl_ctx.h @@ -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; diff --git a/code/bngblaster/src/bbl_protocols.c b/code/bngblaster/src/bbl_protocols.c index 9834d773..246682d1 100644 --- a/code/bngblaster/src/bbl_protocols.c +++ b/code/bngblaster/src/bbl_protocols.c @@ -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)); diff --git a/code/bngblaster/src/bbl_protocols.h b/code/bngblaster/src/bbl_protocols.h index 8626b572..dec5d12f 100644 --- a/code/bngblaster/src/bbl_protocols.h +++ b/code/bngblaster/src/bbl_protocols.h @@ -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;