From 6c2c2415d32f33655f632e17ce1dd95b18a0a109 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 29 Jun 2004 08:20:49 +0000 Subject: allow to use a specific ACNAME for pppoe connections --- mdk-stage1/adsl.c | 16 +++++++++++----- mdk-stage1/network.c | 1 + mdk-stage1/network.h | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mdk-stage1/adsl.c b/mdk-stage1/adsl.c index bdbd06872..82978ed34 100644 --- a/mdk-stage1/adsl.c +++ b/mdk-stage1/adsl.c @@ -38,7 +38,7 @@ #include "adsl.h" -static enum return_type adsl_connect(char * net_device, char * username, char * password) +static enum return_type adsl_connect(char * net_device, char * username, char * password, char * acname) { char pppoe_call[500]; char * pppd_launch[] = { "/sbin/pppd", "pty", pppoe_call, "noipdefault", "noauth", "default-asyncmap", "defaultroute", @@ -53,6 +53,10 @@ static enum return_type adsl_connect(char * net_device, char * username, char * snprintf(pppoe_call, sizeof(pppoe_call), "/sbin/pppoe -p /var/run/pppoe.conf-adsl.pid.pppoe -I %s -T 80 -U -m 1412", net_device); + if (!streq(acname, "")) { + strcat(pppoe_call, "-C "); + strcat(pppoe_call, acname); + } fd = open(tty_adsl, O_RDWR); if (fd == -1) { @@ -115,8 +119,8 @@ static enum return_type adsl_connect(char * net_device, char * username, char * enum return_type perform_adsl(struct interface_info * intf) { struct in_addr addr; - char * questions[] = { "Username", "Password", NULL }; - char * questions_auto[] = { "adsluser", "adslpass", NULL }; + char * questions[] = { "Username", "Password", "AC Name", NULL }; + char * questions_auto[] = { "adsluser", "adslpass", "adslacname", NULL }; static char ** answers = NULL; enum return_type results; @@ -137,6 +141,7 @@ enum return_type perform_adsl(struct interface_info * intf) } results = ask_from_entries_auto("Please enter the username and password for your ADSL account.\n" + "Leave blank the AC Name field if you don't know what it means.\n" "(Warning! only PPPoE protocol is supported)", questions, &answers, 40, questions_auto, NULL); if (results != RETURN_OK) @@ -148,16 +153,17 @@ enum return_type perform_adsl(struct interface_info * intf) my_insmod("ppp_generic", ANY_DRIVER_TYPE, NULL, 1); my_insmod("ppp_async", ANY_DRIVER_TYPE, NULL, 1); my_insmod("ppp", ANY_DRIVER_TYPE, NULL, 1); - results = adsl_connect(intf->device, answers[0], answers[1]); + results = adsl_connect(intf->device, answers[0], answers[1], answers[2]); remove_wait_message(); if (results != RETURN_OK) { wait_message("Retrying the ADSL connection..."); - results = adsl_connect(intf->device, answers[0], answers[1]); + results = adsl_connect(intf->device, answers[0], answers[1], answers[2]); remove_wait_message(); } else { intf->user = strdup(answers[0]); intf->pass = strdup(answers[1]); + intf->acname = strdup(answers[2]); } if (results != RETURN_OK) { diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c index 963dcee53..67102bb16 100644 --- a/mdk-stage1/network.c +++ b/mdk-stage1/network.c @@ -318,6 +318,7 @@ static int save_netinfo(struct interface_info * intf) { fprintf(f, "BOOTPROTO=adsl_pppoe\n"); fprintf(f, "USER=%s\n", intf->user); fprintf(f, "PASS=%s\n", intf->pass); + fprintf(f, "ACNAME=%s\n", intf->acname); } if (!streq(intf->http_proxy_host, "") && !streq(intf->http_proxy_port, "")) { diff --git a/mdk-stage1/network.h b/mdk-stage1/network.h index 44a96c77b..33f4b8d71 100644 --- a/mdk-stage1/network.h +++ b/mdk-stage1/network.h @@ -40,7 +40,7 @@ struct interface_info { int is_ptp, is_up; struct in_addr ip, netmask, broadcast, network; enum boot_proto_type boot_proto; - char *user, *pass; /* for ADSL connection */ + char *user, *pass, *acname; /* for ADSL connection */ char *http_proxy_host, *http_proxy_port; }; -- cgit v1.2.1