Re: [PATCH] RHEL5 iBFT forward port to Fedora - part 1

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

 



> 
> Note that due to some changes I made wrt iscsi in Fedora currently
> startup only 
> gets called from addTarget, so this code path will no longer
> automatically execute.
> 
> startup used to be called from partitionObjectsInitialize(), but I've
> removed 
> it being called from there as that let to lots of start stop start
> iscsi madness.
> 
> For iBFT we will need to call it some place sane, so that it gets done
> only 
> once (and not start stop start for each iscsi target added).

OK, what is the sane place right now?
 
> 
> <snip>
> 
> --- a/loader/net.c
> +++ b/loader/net.c
> @@ -53,6 +53,7 @@
>   #include "method.h"
>   #include "net.h"
>   #include "windows.h"
> +#include "ibft.h"
> 
>   /* boot flags */
>   extern uint64_t flags;
> 
> I do not see ibft.h getting added by this patch

Ehmm you are right.. the two missing files are attached to this reply



>       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++) {
> 
> I do not understand what the purpose of lookForLink is here, before
> the
> 
>       if ((loaderData->netDev && (loaderData->netDev_set == 1)) &&
>           !strcmp(loaderData->netDev, "link")) {
> 
> It is always 0, so the "if(lookForLink){" is equivalent to
> 
>       if ((loaderData->netDev && (loaderData->netDev_set == 1)) &&
>           !strcmp(loaderData->netDev, "link")) {

Right now it is, there was different default value before, so I kept it there for debugging purposes and to have the possibility to change the default. 
 
> 
> > To my knowledge, there is no way to tell NM over D-Bus that you want
> a
> > NIC configured a particular way.  The way it's set up is to retain
> > knowledge about the network interfaces it is set to control.  For
> > interfaces that have an ifcfg-DEVICE file, there is another daemon
> > called nm-system-settings that constantly monitors those files for
> > changes and feeds the new/changed data in to NetworkManager.  It
> looks
> > like this:
> > 
> >    NetworkManager (main daemon)
> >         |
> >         +-- nm-system-settings (monitors /etc files for changes)
> >                  |
> >                  +--- uses plugins such as ifcfg-fedora or
> ifcfg-suse
> > 
> > In loader, I set everything up to talk to network manager via the
> ifcfg
> > files since that was the easiest to maintain.  I'm glad I've done
> that
> > for now because the other APIs for NetworkManager keep changing.
> > 
> > What happens when BOOTPROTO=ibft is set?  Right now, the
> ifcfg-fedora
> > plugin for nm-system-settings reads the ifcfg files and can handle
> > BOOTPROTO=static and BOOTPROTO=dhcp.  It takes appropriate action
> > depending on those settings.  If BOOTPROTO=ibft is simply another
> kind
> > of configuration path, it might be easy to modify the ifcfg-fedora
> > plugin in NetworkManager to handle that.
> 
> Erm, why not just write BOOTPROTO=none (what you call static is none
> AFAIK) or 
> BOOTPROTO=dhcp depending on the iBFT info, teaching nm-system-settings
> about 
> BOOTPROTO=ibft is of little use unless you plan to teach it to
> actually read 
> the info from the BIOS in that scenario, so that changes in the BIOS
> propagate 
> to the OS.

It is not possible, you have to read the network info from the iBFT on every startup.
Because it doesn't have to stay the same forever. And when you change the firmware setting, knowing that iBFT is supported, you expect to pick up the changes and act upon them.

/*
   File name: ibft.c
   Date:      2008/09/02
   Author:    Martin Sivak <msivak@xxxxxxxxxx>

   Copyright (C) 2008 Red Hat

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   in a file called COPYING along with this program; if not, write to
   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
   02139, USA.
*/


#include <stddef.h>
#include <stdio.h>
#include <string.h>

#include <fw_context.h>
#include "ibft.h"

struct boot_context ibft_context;
int ibft_ispresent = 0;
int ibft_initialized = 0;

int ibft_init(void)
{
  int ret;

  memset(&ibft_context, 0, sizeof(ibft_context));

  ret = fw_get_entry(&ibft_context, NULL);

  /* ret == 0 -> OK */
  ibft_ispresent = !ret;
  ibft_initialized = 1;

  return ibft_initialized;
}

/* Is iBFT available on this system */
int ibft_present()
{
  if(!ibft_initialized)
    ibft_init();

  return ibft_ispresent;
}

/* Is the iBFT network configured to use DHCP */
int ibft_iface_dhcp()
{
  if(!ibft_initialized)
    ibft_init();

  if(!ibft_present())
    return -1;

  return (ibft_context.dhcp!=NULL && strlen(ibft_context.dhcp) && strcmp(ibft_context.dhcp, "0.0.0.0"));
}

#define ibft_iface_charfunc(name, var) char* ibft_iface_##name()\
{\
  if(!ibft_initialized)\
    ibft_init();\
\
  if(!ibft_present())\
    return NULL;\
\
  if(ibft_context.var==NULL)\
    return NULL;\
\
  if(!strlen(ibft_context.var))\
    return NULL;\
\
  return ibft_context.var;\
}


/* Get the iBFT MAC address */
ibft_iface_charfunc(mac, mac)

/* Get the iBFT ip address */
ibft_iface_charfunc(ip, ipaddr)

/* Get the iBFT subnet mask */
ibft_iface_charfunc(mask, mask)

/* Get the iBFT gateway */
ibft_iface_charfunc(gw, gateway)

/* Get the iBFT iface name */
ibft_iface_charfunc(iface, iface)

/* Get the iBFT dns servers */
ibft_iface_charfunc(dns1, primary_dns)
ibft_iface_charfunc(dns2, secondary_dns)

/*
   File name: ibft.h
   Date:      2008/09/02
   Author:    Martin Sivak

   Copyright (C) 2008 Red Hat

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   in a file called COPYING along with this program; if not, write to
   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
   02139, USA.
*/


#ifndef __IBFT_H__
#define __IBFT_H__


int ibft_init();
int ibft_present();

int ibft_iface_dhcp();

char* ibft_iface_mac();
char* ibft_iface_ip();
char* ibft_iface_mask();
char* ibft_iface_gw();
char* ibft_iface_iface();
char* ibft_iface_dns1();
char* ibft_iface_dns2();


#endif

/* end of ibft.h */
_______________________________________________
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