--- loader2/net.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- loader2/net.h | 1 + 2 files changed, 81 insertions(+), 1 deletions(-) diff --git a/loader2/net.c b/loader2/net.c index 33ec1f7..cb6785d 100644 --- a/loader2/net.c +++ b/loader2/net.c @@ -381,6 +381,7 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, struct in_addr addr; struct in6_addr addr6; char *c; + enum{USE_DHCP, USE_IBFT_STATIC, USE_STATIC} configMode = USE_STATIC; /* set to 1 to get ks network struct logged */ #if 0 @@ -413,8 +414,45 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, setupWireless(cfg); } + if (!strncmp(loaderData->ip, "ibft", 4)) { + 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){ + configMode = USE_DHCP; + } + /* TODO MAC address doesn't match */ + if(0){ + configMode = USE_DHCP; + } + } + /* this is how we specify dhcp */ if (!strncmp(loaderData->ip, "dhcp", 4)) { + configMode = USE_DHCP; + } + + 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){ + configMode = USE_DHCP; + } + else{ + cfg->dev.set |= PUMP_INTFINFO_HAS_IP|PUMP_INTFINFO_HAS_IPV4_IP; + cfg->preset = 1; + } + } + + if (configMode == USE_IBFT_STATIC){ + /* do nothing, already done */ + } else if (configMode == USE_DHCP) { /* JKFIXME: this soooo doesn't belong here. and it needs to * be broken out into a function too */ logMessage(INFO, "sending dhcp request through device %s", @@ -589,6 +627,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, newCfg.essid = NULL; newCfg.wepkey = NULL; newCfg.isDynamic = cfg->isDynamic; + newCfg.isiBFT = cfg->isiBFT; newCfg.noDns = cfg->noDns; newCfg.dhcpTimeout = cfg->dhcpTimeout; newCfg.preset = cfg->preset; @@ -668,6 +707,7 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, } cfg->isDynamic = newCfg.isDynamic; + cfg->isiBFT = newCfg.isiBFT; memcpy(&cfg->dev,&newCfg.dev,sizeof(newCfg.dev)); if (!(cfg->dev.set & PUMP_NETINFO_HAS_GATEWAY)) { @@ -1712,7 +1752,9 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev) { fprintf(f, "ONBOOT=yes\n"); - if (dev->isDynamic) { + if (dev->isiBFT) { + fprintf(f, "BOOTPROTO=ibft\n"); + } else if (dev->isDynamic) { fprintf(f, "BOOTPROTO=dhcp\n"); } else { fprintf(f, "BOOTPROTO=static\n"); @@ -1999,6 +2041,7 @@ void setKickstartNetwork(struct loaderData_s * loaderData, int argc, int chooseNetworkInterface(struct loaderData_s * loaderData) { int i, rc, ask, idrc, secs, deviceNums = 0, deviceNum, foundDev = 0; unsigned int max = 40; + int lookForLink = 0; char **devices; char **deviceNames; char *ksMacAddr = NULL, *seconds = strdup("10"), *idstr = NULL; @@ -2089,8 +2132,44 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) { return LOADER_NOOP; } + + + if ((loaderData->netDev && (loaderData->netDev_set == 1)) && + !strcmp(loaderData->netDev, "ibft")){ + char *devmacaddr = NULL; + char *ibftmacaddr = ""; + + /* TODO get MAC from the iBFT table */ + + logMessage(INFO, "looking for iBFT configured device with link"); + lookForLink = 1; + + for (i = 0; devs[i]; i++) { + if (!devs[i]->device) + continue; + devmacaddr = nl_mac2str(devs[i]->device); + if(!strcmp(devmacaddr, ibftmacaddr)){ + free(devmacaddr); + if(get_link_status(devices[i]) == 1){ + lookForLink = 0; + loaderData->netDev = devices[i]; + logMessage(INFO, "%s has link, using it", devices[i]); + return LOADER_NOOP; + } + break; + } + else{ + free(devmacaddr); + } + } + } + if ((loaderData->netDev && (loaderData->netDev_set == 1)) && !strcmp(loaderData->netDev, "link")) { + lookForLink = 1; + } + + if (lookForLink) logMessage(INFO, "looking for first netDev with link"); for (rc = 0; rc < 5; rc++) { for (i = 0; i < deviceNums; i++) { diff --git a/loader2/net.h b/loader2/net.h index 4efc84f..f636cac 100644 --- a/loader2/net.h +++ b/loader2/net.h @@ -28,6 +28,7 @@ struct networkDeviceConfig { /* misc settings */ int isDynamic; + int isiBFT; int noDns; int dhcpTimeout; int preset; -- 1.5.4.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list