[PATCH] Use the iBFT values during net configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 loader2/Makefile |    2 +-
 loader2/net.c    |   49 +++++++++++++++++++++++++++++++++++--------------
 2 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/loader2/Makefile b/loader2/Makefile
index 3b93ce3..8bf74e3 100644
--- a/loader2/Makefile
+++ b/loader2/Makefile
@@ -35,7 +35,7 @@ METHOBJS = method.o cdinstall.o hdinstall.o nfsinstall.o urlinstall.o
 OBJS = log.o moduleinfo.o loadermisc.o modules.o moduledeps.o windows.o \
 	lang.o kbd.o modstubs.o driverdisk.o selinux.o \
 	md5.o mediacheck.o kickstart.o driverselect.o \
-	getparts.o dirbrowser.o fwloader.o \
+	getparts.o dirbrowser.o fwloader.o ibft.o \
 	$(HWOBJS) $(METHOBJS)
 LOADEROBJS = loader.o loader-pcmcia.o
 NETOBJS = net.o urls.o ftp.o telnet.o telnetd.o
diff --git a/loader2/net.c b/loader2/net.c
index 7c0d948..6a9fdbc 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -57,6 +57,7 @@
 #include "method.h"
 #include "net.h"
 #include "windows.h"
+#include "ibft.h"
 
 /* boot flags */
 extern uint64_t flags;
@@ -415,18 +416,20 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
         }
 
 	if (!strncmp(loaderData->ip, "ibft", 4)) {
+	    char *devmacaddr = nl_mac2str(loaderData->netDev);
 	    configMode = USE_IBFT_STATIC;
             cfg->isiBFT = 1;
-	    /* TODO Read the data from ibft table and get the information about configMode */
 
-	    /* TODO Problems with getting the info from iBFT */
-	    if(0){
+	    /* Problems with getting the info from iBFT or iBFT uses dhcp*/
+	    if(!devmacaddr || !ibft_present() || ibft_iface_dhcp()){
 		configMode = USE_DHCP;
 	    }
-	    /* TODO MAC address doesn't match */
-	    if(0){
+	    /* MAC address doesn't match */
+	    else if(strcmp(ibft_iface_mac(), devmacaddr)){
 		configMode = USE_DHCP;
 	    }
+
+	    if(devmacaddr) free(devmacaddr);
 	}
 
         /* this is how we specify dhcp */
@@ -435,16 +438,34 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
 	}
 
 	if (configMode == USE_IBFT_STATIC){
-	    /* TODO setup static from iBFT table */
-            cfg->dev.ip = /* XXX */0;
-            cfg->dev.ipv4 = /* XXX */0;
-            cfg->isDynamic = 0;
-	    
-	    /* TODO Problems with getting the info from iBFT */
-	    if(0){
+	    /* Problems with getting the info from iBFT */
+	    if(!ibft_iface_ip() || !ibft_iface_mask() || !ibft_iface_gw()){
 		configMode = USE_DHCP;
 	    }
 	    else{
+		/* static setup from iBFT table */
+		cfg->dev.ip = ip_addr_in(ibft_iface_ip());
+		cfg->dev.ipv4 = ip_addr_in(ibft_iface_ip());
+		cfg->isDynamic = 0;
+		
+		cfg->dev.netmask = ip_addr_in(ibft_iface_mask());
+		cfg->dev.set |= PUMP_INTFINFO_HAS_NETMASK;
+        
+		cfg->dev.gateway = ip_addr_in(ibft_iface_gw());
+		cfg->dev.set |= PUMP_NETINFO_HAS_GATEWAY;
+                
+		if(cfg->dev.numDns<MAX_DNS_SERVERS){
+		    cfg->dev.dnsServers[cfg->dev.numDns] = ip_addr_in(ibft_iface_dns1());
+		    cfg->dev.numDns++;
+		}
+		if(cfg->dev.numDns<MAX_DNS_SERVERS){
+		    cfg->dev.dnsServers[cfg->dev.numDns] = ip_addr_in(ibft_iface_dns2());
+		    cfg->dev.numDns++;
+		}
+	    
+		if (cfg->dev.numDns)
+		    cfg->dev.set |= PUMP_NETINFO_HAS_DNS;
+
 		cfg->dev.set |= PUMP_INTFINFO_HAS_IP|PUMP_INTFINFO_HAS_IPV4_IP;
 		cfg->preset = 1;
 	    }
@@ -2139,8 +2160,8 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
         char *devmacaddr = NULL;
 	char *ibftmacaddr = "";
 	
-	/* TODO get MAC from the iBFT table */
-	if(0){ /* TODO iBFT not present or error */
+	/* get MAC from the iBFT table */
+	if(!(ibftmacaddr = ibft_iface_mac())){ /* iBFT not present or error */
 	    /* lookForLink = 0; is the w/o iBFT default link or ask? */
 	    break;
 	}
-- 
1.5.4.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux