Re: [Etherboot-developers] Patch for TFTP-multicast released
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: <ebi...@ln...> - 2002-07-04 04:27:28
|
ke...@us... (Ken Yap) writes:
> >or what my dhcpd.conf says
> > filename "x-tftm://172.16.75.1/vmlinuz.ltsp";
> >this morning, 10:39 GMT.
>
> Hmm, also a redundant specification for TFTM. The server should be taken
> from siaddr, not the URI.
The URL spec allows for it, and I started this trend.
>
> Also I want it so that by default the current syntax implies TFTP so
> that it's backward compatible. That is, if I continue to use filename
> "lts/vmlinux.ltsp" I get TFTP, no surprises.
Skimming the code tftp is the default if you don't have a url.
I guess the big concern at this point is how to make it work
with a minimum of code size. The size of the filename in the DHCP
packet should not be a big concern.
The question is what is the natural way to extend DHCP to direct
a client to boot from other protocols. URLs seem a natural extension,
as does extending the next-server option.
So I suggest we just test for protocol:/// in all cases. We should require
at least the double slash. And the tripple slash probably works, in
most cases.
For minimum code size probably the best solution is to have a table, of protocol
name, and handler.
struct proto {
char *name;
int (*load)(const char *rest, int (*fnc)(unsigned char *, unsigned int, unsigned int, int))
};
static struct proto protos[] = {
#ifdef DOWNLOAD_PROTO_SLAM
{ "x-slam", url_slam },
#endif
#ifdef DOWNLOAD_PROTO_NFS
{ "nfs", nfs },
#endif
#ifdef DOWNLOAD_PROTO_DISK
{ "file", url_disk },
#endif
{ 0, 0 }
};
int loadkernel(const char *fname)
{
struct proto *proto;
for(proto = &protos[0]; proto->name; proto++) {
int len;
len = strlen(proto->name);
if ((memcmp(fname, proto->name, len) == 0) &&
(memcmp(fname + len, ":///", 4) == 0)) {
fname += len + 4;
return proto->load(fname, load_block);
}
}
return tftp(fname, load_block);
}
Given that more people are used to urls than parsing the weird dhcp
history it might be worth the little bit of extra code to parse an ip
address if that is present.
Thoughts?
Eric
|