mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
Add DSL Type support
This commit is contained in:
@@ -144,6 +144,7 @@ Attribute | Description | Default
|
||||
`agent-remote-id` | Optionally overwrite the agent-remote-id from access-line section per access configuration
|
||||
`rate-up` | Optionally overwrite the rate-up from access-line section per access configuration
|
||||
`rate-down` | Optionally overwrite the rate-down from access-line section per access configuration
|
||||
`dsl-type` | Optionally overwrite the dsl-type from access-line section per access configuration
|
||||
`ipcp` | Optionally enable/disable PPP IPCP per access configuration
|
||||
`ip6cp` | Optionally enable/disable PPP IP6CP per access configuration
|
||||
`ipv4` | Optionally enable/disable IPoE IPv4 per access configuration
|
||||
@@ -412,6 +413,7 @@ Attribute | Description | Default
|
||||
`agent-remote-id` | Agent-Remote-Id | DEU.RTBRICK.{session-global}
|
||||
`rate-up` | Actual-Data-Rate-Upstream | 0
|
||||
`rate-down` | Actual-Data-Rate-Downstream | 0
|
||||
`dsl-type` | DSL-Type | 0
|
||||
|
||||
## DHCP
|
||||
|
||||
|
||||
@@ -319,6 +319,7 @@ typedef struct bbl_access_config_
|
||||
char *agent_circuit_id;
|
||||
uint32_t rate_up;
|
||||
uint32_t rate_down;
|
||||
uint32_t dsl_type;
|
||||
|
||||
/* Protocols */
|
||||
bool ipcp_enable;
|
||||
@@ -470,11 +471,13 @@ typedef struct bbl_ctx_
|
||||
char *agent_circuit_id;
|
||||
uint32_t rate_up;
|
||||
uint32_t rate_down;
|
||||
uint32_t dsl_type;
|
||||
|
||||
/* PPPoE */
|
||||
uint32_t pppoe_session_time;
|
||||
uint16_t pppoe_discovery_timeout;
|
||||
uint16_t pppoe_discovery_retry;
|
||||
uint8_t pppoe_vlan_priority;
|
||||
char *pppoe_service_name;
|
||||
bool pppoe_reconnect;
|
||||
bool pppoe_host_uniq;
|
||||
@@ -655,6 +658,7 @@ typedef struct bbl_session_
|
||||
char *agent_remote_id;
|
||||
uint32_t rate_up;
|
||||
uint32_t rate_down;
|
||||
uint32_t dsl_type;
|
||||
|
||||
/* Ethernet */
|
||||
uint8_t server_mac[ETH_ADDR_LEN];
|
||||
|
||||
@@ -163,6 +163,13 @@ json_parse_access_interface (bbl_ctx_s *ctx, json_t *access_interface, bbl_acces
|
||||
access_config->rate_down = ctx->config.rate_down;
|
||||
}
|
||||
|
||||
value = json_object_get(access_interface, "dsl-type");
|
||||
if (value) {
|
||||
access_config->dsl_type = json_number_value(value);
|
||||
} else {
|
||||
access_config->dsl_type = ctx->config.dsl_type;
|
||||
}
|
||||
|
||||
value = json_object_get(access_interface, "ipcp");
|
||||
if (json_is_boolean(value)) {
|
||||
access_config->ipcp_enable = json_boolean_value(value);
|
||||
@@ -540,6 +547,10 @@ json_parse_config (json_t *root, bbl_ctx_s *ctx) {
|
||||
if (json_is_number(value)) {
|
||||
ctx->config.rate_down = json_number_value(value);
|
||||
}
|
||||
value = json_object_get(section, "dsl-type");
|
||||
if (json_is_number(value)) {
|
||||
ctx->config.dsl_type = json_number_value(value);
|
||||
}
|
||||
}
|
||||
|
||||
/* Session Traffic Configuration */
|
||||
|
||||
@@ -1066,6 +1066,15 @@ encode_pppoe_discovery(uint8_t *buf, uint16_t *len,
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint32_t));
|
||||
vendor_len += 6;
|
||||
}
|
||||
if(pppoe->access_line->down) {
|
||||
*buf = ACCESS_LINE_DSL_TYPE;
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint8_t));
|
||||
*buf = 4;
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint8_t));
|
||||
*(uint32_t*)buf = htobe32(pppoe->access_line->dsl_type);
|
||||
BUMP_WRITE_BUFFER(buf, len, sizeof(uint32_t));
|
||||
vendor_len += 6;
|
||||
}
|
||||
*vendor_len_field = htobe16(vendor_len);
|
||||
pppoe_len += 4 + vendor_len;
|
||||
}
|
||||
|
||||
+5
-4
@@ -332,10 +332,11 @@ typedef enum access_line_codes_ {
|
||||
} access_line_codes;
|
||||
|
||||
typedef struct access_line_ {
|
||||
char *aci; // Agent Circuit ID
|
||||
char *ari; // Agent Remote ID
|
||||
uint32_t up; // Actual Data Rate Upstream
|
||||
uint32_t down; // Actual Data Rate Downstream
|
||||
char *aci; // Agent Circuit ID
|
||||
char *ari; // Agent Remote ID
|
||||
uint32_t up; // Actual Data Rate Upstream
|
||||
uint32_t down; // Actual Data Rate Downstream
|
||||
uint32_t dsl_type; // DSL Type
|
||||
} access_line_t;
|
||||
|
||||
/*
|
||||
|
||||
@@ -326,6 +326,7 @@ bbl_sessions_init(bbl_ctx_s *ctx)
|
||||
/* Update access rates ... */
|
||||
session->rate_up = access_config->rate_up;
|
||||
session->rate_down = access_config->rate_down;
|
||||
session->dsl_type = access_config->dsl_type;
|
||||
|
||||
/* IGMP */
|
||||
session->igmp_autostart = access_config->igmp_autostart;
|
||||
|
||||
@@ -1018,6 +1018,7 @@ bbl_encode_padi (bbl_session_s *session)
|
||||
access_line.ari = session->agent_remote_id;
|
||||
access_line.up = session->rate_up;
|
||||
access_line.down = session->rate_down;
|
||||
access_line.dsl_type = session->dsl_type;
|
||||
pppoe.access_line = &access_line;
|
||||
}
|
||||
return encode_ethernet(session->write_buf, &session->write_idx, ð);
|
||||
@@ -1053,6 +1054,7 @@ bbl_encode_padr (bbl_session_s *session)
|
||||
access_line.ari = session->agent_remote_id;
|
||||
access_line.up = session->rate_up;
|
||||
access_line.down = session->rate_down;
|
||||
access_line.dsl_type = session->dsl_type;
|
||||
pppoe.access_line = &access_line;
|
||||
}
|
||||
return encode_ethernet(session->write_buf, &session->write_idx, ð);
|
||||
|
||||
Reference in New Issue
Block a user