From cd417a1a507369b6df9ab23415bf6da3579c2bc5 Mon Sep 17 00:00:00 2001
From: Guillaume Cottenceau <gc@mandriva.com>
Date: Wed, 20 Jun 2001 15:31:20 +0000
Subject: save adsl info for stage2

---
 mdk-stage1/adsl.c    |  5 +++++
 mdk-stage1/network.c | 10 ++++++----
 mdk-stage1/network.h | 11 ++++++-----
 3 files changed, 17 insertions(+), 9 deletions(-)

(limited to 'mdk-stage1')

diff --git a/mdk-stage1/adsl.c b/mdk-stage1/adsl.c
index 74838aa92..706d3c96a 100644
--- a/mdk-stage1/adsl.c
+++ b/mdk-stage1/adsl.c
@@ -147,6 +147,8 @@ enum return_type perform_adsl(struct interface_info * intf)
 	if (results != RETURN_OK)
 		return results;
 
+	intf->boot_proto = BOOTPROTO_ADSL_PPPOE;
+
 	wait_message("Waiting for ADSL connection to show up...");
 	my_insmod("ppp_generic", ANY_DRIVER_TYPE, NULL);
 	my_insmod("ppp_async", ANY_DRIVER_TYPE, NULL);
@@ -158,6 +160,9 @@ enum return_type perform_adsl(struct interface_info * intf)
 		wait_message("Retrying the ADSL connection...");
 		results = adsl_connect(intf->device, answers[0], answers[1]);
 		remove_wait_message();
+	} else {
+		intf->user = strdup(answers[0]);
+		intf->pass = strdup(answers[1]);
 	}
 
 	if (results != RETURN_OK) {
diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c
index e3052b149..6cf24f626 100644
--- a/mdk-stage1/network.c
+++ b/mdk-stage1/network.c
@@ -169,7 +169,7 @@ int configure_net_device(struct interface_info * intf)
 
 	intf->is_up = 1;
 
-	if (intf->boot_proto == BOOTPROTO_STATIC && !streq(intf->device, "lo")) {
+	if (intf->boot_proto != BOOTPROTO_DHCP && !streq(intf->device, "lo")) {
 		/* I need to sleep a bit in order for kernel to finish
 		   init of the network device; if not, first sendto() for
 		   gethostbyaddr will get an EINVAL. */
@@ -303,12 +303,16 @@ static int save_netinfo(struct interface_info * intf) {
 
 	if (intf->boot_proto == BOOTPROTO_DHCP)
 		fprintf(f, "BOOTPROTO=dhcp\n");
-	else {
+	else if (intf->boot_proto == BOOTPROTO_STATIC) {
 		fprintf(f, "BOOTPROTO=static\n");
 		fprintf(f, "IPADDR=%s\n", inet_ntoa(intf->ip));
 		fprintf(f, "NETMASK=%s\n", inet_ntoa(intf->netmask));
 		fprintf(f, "NETWORK=%s\n", inet_ntoa(intf->network));
 		fprintf(f, "BROADCAST=%s\n", inet_ntoa(intf->broadcast));
+	} else if (intf->boot_proto == BOOTPROTO_ADSL_PPPOE) {
+		fprintf(f, "BOOTPROTO=adsl_pppoe\n");
+		fprintf(f, "USER=%s\n", intf->user);
+		fprintf(f, "PASS=%s\n", intf->pass);
 	}
 
 	fclose(f);
@@ -437,8 +441,6 @@ static enum return_type setup_network_interface(struct interface_info * intf)
 			return RETURN_ERROR;
 
 	} else if (streq(choice, "ADSL")) {
-		intf->boot_proto = BOOTPROTO_STATIC;
-
 		results = perform_adsl(intf);
 
 		if (results == RETURN_BACK)
diff --git a/mdk-stage1/network.h b/mdk-stage1/network.h
index 0848c715e..02eea45b6 100644
--- a/mdk-stage1/network.h
+++ b/mdk-stage1/network.h
@@ -32,14 +32,15 @@ enum return_type ftp_prepare(void);
 enum return_type http_prepare(void);
 
 
-enum boot_proto_type { BOOTPROTO_STATIC, BOOTPROTO_DHCP };
+enum boot_proto_type { BOOTPROTO_STATIC, BOOTPROTO_DHCP, BOOTPROTO_ADSL_PPPOE };
 
 /* all of these in_addr things are in network byte order! */
 struct interface_info {
-    char device[10];
-    int is_ptp, is_up;
-    struct in_addr ip, netmask, broadcast, network;
-    enum boot_proto_type boot_proto;
+	char device[10];
+	int is_ptp, is_up;
+	struct in_addr ip, netmask, broadcast, network;
+	enum boot_proto_type boot_proto;
+	char *user, *pass; /* for ADSL connection */
 };
 
 
-- 
cgit v1.2.1