[PATCH] patch to speed up bootpc queries

2002-01-03 Thread Phil

Hi,

When rcS_fai tries to get bootp parameters, it does a query on every
interface the machine has. This can take a lot of time for nothing.

the following patch tries the defaut interface first, and break the loop
after the first successfull query. (use the attached file to avoid
copy-paste diff problems)


-8--
--- /usr/lib/fai/nfsroot/usr/share/fai/subroutines~ Fri Nov 16 17:56:16 2001
+++ /usr/lib/fai/nfsroot/usr/share/fai/subroutines  Thu Jan  3 16:00:23 2002
@@ -228,11 +228,14 @@

 local device
 local bootlog=/tmp/bootp.log
+# test the default interface first!
+testdev=`route -n | awk '/^0.0.0.0/ { print $8}'` $netdevices
 # define all bootpc information as variables
-for device in $netdevices; do
+for device in $testdev; do
echo Sending BOOTP request using device $device
echo * --- network device $device ---  $bootlog
bootpc --dev $device --timeoutwait $timeout --returniffail  $bootlog 21
+   if [ $? -eq 0 ]; then break; fi
 done

 [ -n $verbose -a -f $bootlog ]  echo Reading $bootlog
-8--

-- 
Philippe Biondi pbi@ cartel-info.fr   Cartel Informatique
Security Consultant/RD http://www.cartel-info.fr
Phone: +33 1 44 06 97 94Fax: +33 1 44 06 97 99
PGP KeyID:3D9A43E2  FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2




--- /usr/lib/fai/nfsroot/usr/share/fai/subroutines~ Fri Nov 16 17:56:16 2001
+++ /usr/lib/fai/nfsroot/usr/share/fai/subroutines  Thu Jan  3 16:00:23 2002
@@ -228,11 +228,14 @@
 
 local device
 local bootlog=/tmp/bootp.log
+# test the default interface first!
+testdev=`route -n | awk '/^0.0.0.0/ { print $8}'` $netdevices
 # define all bootpc information as variables
-for device in $netdevices; do
+for device in $testdev; do
echo Sending BOOTP request using device $device
echo * --- network device $device ---  $bootlog
bootpc --dev $device --timeoutwait $timeout --returniffail  $bootlog 21
+   if [ $? -eq 0 ]; then break; fi
 done
 
 [ -n $verbose -a -f $bootlog ]  echo Reading $bootlog



Re: [PATCH] patch to speed up bootpc queries

2002-01-03 Thread Thomas Lange

 On Thu, 3 Jan 2002 16:11:23 +0100 (CET), Phil [EMAIL PROTECTED] said:

 Hi, When rcS_fai tries to get bootp parameters, it does a query
 on every interface the machine has. This can take a lot of time
 for nothing.

This could be made much simpler. If the variable $netdevices is
defined, then only this list of interfaces is used and not all
available ethernet devices. Define this variable in /etc/fai.conf (the
next fai version will use /etc/fai/fai.conf) and rebuild the nfsroot
or copy trhis file to $NFSROOT/etc/fai.conf. Here's an example

/etc/fai.conf:
netdevices=eth0

-- 
 Thomas



Re: [PATCH] patch to speed up bootpc queries

2002-01-03 Thread Phil

On Thu, 3 Jan 2002, Thomas Lange wrote:

  On Thu, 3 Jan 2002 16:11:23 +0100 (CET), Phil [EMAIL PROTECTED] said:

  Hi, When rcS_fai tries to get bootp parameters, it does a query
  on every interface the machine has. This can take a lot of time
  for nothing.

 This could be made much simpler. If the variable $netdevices is
 defined, then only this list of interfaces is used and not all
 available ethernet devices. Define this variable in /etc/fai.conf (the
 next fai version will use /etc/fai/fai.conf) and rebuild the nfsroot
 or copy trhis file to $NFSROOT/etc/fai.conf. Here's an example

 /etc/fai.conf:
 netdevices=eth0

This is not so easy as you can't be sure about which interface will become
eth0 or eth1. For example, the machine I'm using has a dual eepro100. I've
pluged the wire on LAN1 and it became eth1 (and LAN2 is eth0).
So if I want to carry on using LAN1, I must put netdevices=eth1. But I
won't be able to install machines with only one NIC.

Moreover, I don't see why every NIC in $netdevices should query a bootp
server. One answered query should be enough.

I agree we should test if the query is correctly answerd (ie with T17?
options) to stop asking bootp servers.
I also agree that, with my patch, you can query twice on the same NIC.

Am I broken ? ;)


-- 
Philippe Biondi pbi@ cartel-info.fr   Cartel Informatique
Security Consultant/RD http://www.cartel-info.fr
Phone: +33 1 44 06 97 94Fax: +33 1 44 06 97 99
PGP KeyID:3D9A43E2  FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2





Re: [PATCH] patch to speed up bootpc queries

2002-01-03 Thread Phil

On Thu, 3 Jan 2002, Geert Stappers wrote:

 Moreover,
 I don't see why every NIC in $netdevices should query a bootp server.
 One answered query should be enough.

 Even a single NIC computer does three(3) BOOTP-requests:
 - BootROM where to get my kernel-image request
 - Kernel where to get my NFS root request
 - FAI where is the FAI info request
I was only talking about the last item.


 On a multi NIC computer, FAI has to check every netdevice,
 because the BOOTP server could anywhere.
Why should FAI keep on doing requests on other interfaces when it gets a
reply on one ?


-- 
Philippe Biondi pbi@ cartel-info.fr   Cartel Informatique
Security Consultant/RD http://www.cartel-info.fr
Phone: +33 1 44 06 97 94Fax: +33 1 44 06 97 99
PGP KeyID:3D9A43E2  FingerPrint:C40A772533730E39330DC0985EE8FF5F3D9A43E2





Re: [PATCH] patch to speed up bootpc queries

2002-01-03 Thread Geert Stappers

At 0:51 +0100 1/4/02, Phil wrote:
On Thu, 3 Jan 2002, Geert Stappers wrote:

 Moreover,
 I don't see why every NIC in $netdevices should query a bootp server.
 One answered query should be enough.

 Even a single NIC computer does three(3) BOOTP-requests:
 - BootROM where to get my kernel-image request
 - Kernel where to get my NFS root request
 - FAI where is the FAI info request
I was only talking about the last item.


 On a multi NIC computer, FAI has to check every netdevice,
 because the BOOTP server could anywhere.
Why should FAI keep on doing requests on other interfaces when it gets a
reply on one ?

Why worry about about a extra BOOTP request,
when we have a complete installation to do
on mostly single NIC computers?


Geert