Fwd: Static ip patch problems
Marty Connor <[email protected]> Thu, 9 Mar 2006 05:34:38 -0500
| Newsgroups | gmane.network.etherboot.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm forwarding this to Etherboot-Developers to keep everybody in the
loop.
I like the capability to use Etherboot with static IP addresses (and
generally being able to override defaults from DHCP), and if this can
be done cleanly, I would like to give people the option of creating
Etherboot images with static IP addresses for situations where people
want to manually specify the IP address for a workstation and not use
a dynamic protocol.
My rationale is that just as I can certainly manually specify the IP
address for my desktop and server machines, so should I be able to
manually specify the address for clients. Clearly there is the
opportunity for me to do something stupid and assign the same IP
address twice and cause a problem. This is not something new, and if
someone does this, they will have to fix it.
On the other hand, I don't think it's such a dangerous ability that
we should make it hard for people to achieve it, if that's what they
want.
Ricardo, I would like to debug this with you, and figure out why it
fails. I hope there are other people on the list who want to help
figure this out as well. First step is to look at the patch and see
what it does.
My initial, quick look suggests to me that when STATIC_ADDRESS is
turned on no DHCP information is used at all, and various expected
values are not filled in as they need to be.
I think if you turn on STATIC_ADDRESS you would then have to specify
an entire set of addresses and values that DHCP normally supplies. I
think what's happening with this patch is that some needed values may
not be getting filled in at all. (Like the SERVER IP address and
FILENAME). In particular, I'd check to make sure
DEFAULT_BOOTFILE=\"tftp://10.205.99.73/thinstation.nbi\"
Is not being used within the code that is #IFDEF'ed out by
STATIC_ADDRESS. That particular conditional looks a little drastic.
Remember that Etherboot forever has specifically not supported having
a static IP address, and there may be dependencies that are not
obvious. (actually, you say the file gets loaded, so this must still
work, but other things may not be getting init'ed that must be.)
Now, some workstations give an option to allow people to use DHCP but
to specify a fixed IP address for the workstation. This may also be
useful in cases where can't change their DHCP server, and where most
of the information it returns is OK, but they need to be able to
specify their own IP and perhaps some other parameters.
Anyway, let's take a look here and see what we can see. It's a good
opportunity to understand how Etherboot works, and if for only that
reason it's worthwhile. I'd like to see this as an option.
Marty
Begin forwarded message:
> From: "Ricardo Carrillo Cruz" <[email protected]>
> Date: March 9, 2006 3:40:43 AM EST
> To: "Marty Connor" <[email protected]>
> Subject: Re: [Etherboot-developers] Static ip patch problems
> X-Track: Weight 7, 66
>
>>
>> Hi there. Thanks for the information and the patch.
>
>
> Hi Marty,thanks for your interest
>
> Could you try sending the patches again as an attachment? They got
>> mangled by your mail program (or somewhere along the line), and are a
>> little hard to read.
>
>
> Ok,i'll attach them
>
> Can you also post a pointer to the original patch from David Aubin?
>> I'd enjoy seeing where and when it came to be.
>
>
> The original posts are:
>
> http://sourceforge.net/mailarchive/message.php?msg_id=8715442
> http://sourceforge.net/mailarchive/message.php?msg_id=8715443
> http://sourceforge.net/mailarchive/message.php?msg_id=8715444
>
> What version of Etherboot are you using, and how was the kernel
>> prepared? Before making suggestions, it would help to know more
>> about your environment. It could be something like not enough memory
>> in your workstation, or your kernel being tagged improperly.
>
>
> I'm using etherboot 5.4.1+thinstation 2.1.3. The rom is flashed
> into a
> 3c905c-tpo card. I am using atftp server.
>
> I take it that without your patch everything loads fine and all is
> well?
>>
>> A few more details please.
>
>
> With my modded source,i'm able to boot perfectly with normal
> DHCP.When i
> enable static addresses,the compile is fine.I flash it without
> problem.Iboot the client,and it begins to download the
> thinstation.nbi from the tftp.When finished,it gives me the mknbi
> related
> error i posted
>
> Thanks,
>>
>> Marty
>
>
> Regards
Config.diff
(application/octet-stream, 1.3 KB)
--- Config.orig 2006-03-07 10:32:43.000000000 +0100 +++ Config 2006-03-07 13:37:42.000000000 +0100 @@ -60,6 +60,8 @@ # Use BOOTP instead of DHCP. # -DRARP_NOT_BOOTP # Use RARP instead of BOOTP/DHCP. +# -DSTATIC_ADDRESS Use static ip insted of dynamic protocol +# -DSTATIC_CLIENT_IP=\Â"1.2.3.4\" # -DREQUIRE_VCI_ETHERBOOT # Require an encapsulated Vendor Class Identifier # of "Etherboot" in the DHCP reply @@ -379,10 +381,16 @@ # Disable DHCP support # CFLAGS+= -DNO_DHCP_SUPPORT +# Enable static ip +CFLAGS+= -DSTATIC_ADDRESS + +#Specify the client IP +CFLAGS+= -DSTATIC_CLIENT_IP=\"10.205.99.74\" + # Specify a default bootfile to be used if the DHCP server does not # provide the information. If you do not specify this option, then # DHCP offers that do not contain bootfiles will be ignored. -# CFLAGS+= -DDEFAULT_BOOTFILE=\"tftp:///tftpboot/kernel\" +CFLAGS+= -DDEFAULT_BOOTFILE=\"tftp://10.205.99.73/thinstation.nbi\" # Limit the delay on packet loss/congestion to a more bearable value. See # description above. If unset, do not limit the delay between resend. @@ -439,12 +447,12 @@ # CFLAGS+= -DNORELOCATE # you should normally not need to change these -HOST_CC= gcc +HOST_CC= gcc-3.4 CPP= gcc -E -Wp,-Wall RM= rm -f TOUCH= touch PERL= /usr/bin/perl -CC= gcc +CC= gcc-3.4 AS= as LD= ld SIZE= size
nic.diff
(application/octet-stream, 1.8 KB)
--- nic_orig.c 2006-03-07 10:38:52.000000000 +0100
+++ nic.c 2006-03-07 13:35:47.000000000 +0100
@@ -270,8 +270,12 @@
#ifdef RARP_NOT_BOOTP
static int rarp(void);
#else
+#ifdef STATIC_ADDRESS
+static void static_client_ip(void);
+#else
static int bootp(void);
#endif
+#endif
static unsigned short tcpudpchksum(struct iphdr *ip);
@@ -314,6 +318,9 @@
{
int server_found;
/* Find a server to get BOOTP reply from */
+#ifdef STATIC_ADDRESS
+ printf("Booting with static ip address...");
+#else
#ifdef RARP_NOT_BOOTP
printf("Searching for server (RARP)...");
#else
@@ -323,12 +330,17 @@
printf("Searching for server (BOOTP)...");
#endif
#endif
-
+#endif
+
+#ifdef STATIC_ADDRESS
+ static_client_ip();
+#else
#ifdef RARP_NOT_BOOTP
server_found = rarp();
#else
server_found = bootp();
#endif
+#endif
if (!server_found) {
printf("No Server found\n");
longjmp(restart_etherboot, -1);
@@ -788,7 +800,17 @@
}
#endif /* DOWNLOAD_PROTO_TFTP */
+#ifdef STATIC_ADDRESS
+void static_client_ip(void)
+{
+ in_addr client_addr;
+ inet_aton(STATIC_CLIENT_IP,&client_addr);
+ memcpy(&arptable[ARP_CLIENT].ipaddr,&client_addr.s_addr,sizeof(in_addr));
+}
+
+#else
#ifdef RARP_NOT_BOOTP
+
/**************************************************************************
RARP - Get my IP address and load information
**************************************************************************/
@@ -851,7 +873,6 @@
}
#else
-
/**************************************************************************
BOOTP - Get my IP address and load information
**************************************************************************/
@@ -1049,6 +1070,8 @@
}
#endif /* RARP_NOT_BOOTP */
+#endif
+
static uint16_t tcpudpchksum(struct iphdr *ip)
{
struct udp_pseudo_hdr pseudo;