From fc19705d6198ffea39e31306c9d92c7180a2af43 Mon Sep 17 00:00:00 2001 From: DmitriyEshenko Date: Fri, 23 Apr 2021 12:40:05 +0300 Subject: Add accept-blank-service option --- accel-pppd/accel-ppp.conf.5 | 4 ++++ accel-pppd/ctrl/pppoe/pppoe.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'accel-pppd') diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 880f8224..51612ca9 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -557,6 +557,10 @@ Specifies Service-Name to respond. If absent any Service-Name is acceptable and If service-name specified still will answer with service names, but accepts any service name in PADR request. Useful for scenarios, where selection of PPPoE done by client, based on service names in PADO. .TP +.BI "accept-blank-service=" n +Allow answering on blank Service-Name even if Service-Name configured. +Useful when needs to allow only Service-Names described in the config and also blank Service-Name. +.TP .BI "pado-delay=" delay[,delay1:count1[,delay2:count2[,...]]] Specifies delays (also in condition of connection count) to send PADO (ms). Last delay in list may be -1 which means don't accept new connections. diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 18aac8bd..415dd7c0 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -90,6 +90,7 @@ struct iplink_arg { int conf_verbose; char *conf_service_name[255]; int conf_accept_any_service; +int conf_accept_blank_service; char *conf_ac_name; int conf_ifname_in_sid; char *conf_pado_delay; @@ -1003,7 +1004,11 @@ static void pppoe_recv_PADI(struct pppoe_serv_t *serv, uint8_t *pack, int size) case TAG_END_OF_LIST: break; case TAG_SERVICE_NAME: - if (conf_service_name[0]) { + if (tag->tag_len == 0 && conf_accept_blank_service) { + service_match = 1; + break; + } + else if (conf_service_name[0]) { int svc_index = 0; do { if (ntohs(tag->tag_len) == strlen(conf_service_name[svc_index]) && @@ -1949,6 +1954,10 @@ static void load_config(void) if (opt) conf_accept_any_service = atoi(opt); + opt = conf_get_opt("pppoe", "accept-blank-service"); + if (opt) + conf_accept_blank_service = atoi(opt); + opt = conf_get_opt("pppoe", "ac-name"); if (!opt) opt = conf_get_opt("pppoe", "AC-Name"); -- cgit v1.2.3 From 4b52c1a3590b43ca892c460d9b1478e1da742156 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 27 Apr 2021 14:10:03 +0300 Subject: Add 'show version' command in CLI --- accel-pppd/cli/std_cmd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'accel-pppd') diff --git a/accel-pppd/cli/std_cmd.c b/accel-pppd/cli/std_cmd.c index e752918c..e22ea768 100644 --- a/accel-pppd/cli/std_cmd.c +++ b/accel-pppd/cli/std_cmd.c @@ -84,6 +84,17 @@ static void show_stat_help(char * const *fields, int fields_cnt, void *client) } //============================= +static int show_version_exec(const char *cmd, char * const *fields, int fields_cnt, void *client) +{ + cli_sendv(client, "%s\r\n", ACCEL_PPP_VERSION); +} + +static void show_version_help(char * const *fields, int fields_cnt, void *client) +{ + cli_send(client, "show version - shows version of running accel-pppd\r\n"); +} +//============================= + static int exit_exec(const char *cmd, char * const *fields, int fields_cnt, void *client) { return CLI_CMD_EXIT; @@ -381,6 +392,7 @@ static void restart_help(char * const *fields, int fields_cnt, void *client) static void init(void) { cli_register_simple_cmd2(show_stat_exec, show_stat_help, 2, "show", "stat"); + cli_register_simple_cmd2(show_version_exec, show_version_help, 2, "show", "version"); cli_register_simple_cmd2(terminate_exec, terminate_help, 1, "terminate"); cli_register_simple_cmd2(reload_exec, reload_help, 1, "reload"); cli_register_simple_cmd2(restart_exec, restart_help, 1, "restart"); -- cgit v1.2.3