Mailing List Archive

IP details in COM32 module
Hi all

I'm trying to resolve a problem that's recently popped up by turning on
auxillary VLANs for our Linux workstations. The problem shows as DHCP
failling for anaconda (but always succeeds for PXE).

I tried adding 'ipappend 1' to the pxelinux config files but had no joy.

I'm thinking that if I write a COM32 module that adds "ip=1.2.3.4
gateway=1.2.3.1 netmask=255.255.255.0 dns= etc" to the end of the append
line my problem may be solved. Is there an API call of function to get
this info? I've seen the "resolve hostname" (AX=0010h) but it's what
I'm looking for.

Any ideas?

CC




NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.
_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:
> Hi all
>
> I'm trying to resolve a problem that's recently popped up by turning on
> auxillary VLANs for our Linux workstations. The problem shows as DHCP
> failling for anaconda (but always succeeds for PXE).
>
> I tried adding 'ipappend 1' to the pxelinux config files but had no joy.
>
> I'm thinking that if I write a COM32 module that adds "ip=1.2.3.4
> gateway=1.2.3.1 netmask=255.255.255.0 dns= etc" to the end of the append
> line my problem may be solved. Is there an API call of function to get
> this info? I've seen the "resolve hostname" (AX=0010h) but it's what
> I'm looking for.
>

There are two ways to do it.

API 000Fh "get ipappend strings" will give you the ip= string that
ipappend would add.

API 0009h can be used to call the PXE stack and get the entire DHCP packets.

In 3.50-pre* there are library wrappers for these -- they are called
syslinux_ipappend_strings (<syslinux/config.h>) and pxe_get_cached_info
(<syslinux/pxe.h>) repectively.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
"Coe, Colin C. (Unix Engineer)" <Colin.Coe@woodside.com.au> writes:

> I tried adding 'ipappend 1' to the pxelinux config files but had no
> joy.

Didn't it work as advertised? It should.

> I'm thinking that if I write a COM32 module that adds "ip=1.2.3.4
> gateway=1.2.3.1 netmask=255.255.255.0 dns= etc" to the end of the
> append line my problem may be solved.

See http://syslinux.zytor.com/archives/2007-April/008308.html for a
patch that does what you need (if I understand it correctly).
Basically, it lets you use macros in the kernel command line, which
expand to values read from the DHCP packet. So in your pxelinux
config file you would write something like

label example
linux vmlinuz-2.6.18
append ip=$YIADDR$ gateway=$ROUTERS$ netmask=$MASK$ dns=$DNS$

In the previous you can find another path, which probably does almost
the same. My patch is against 3.50-pre2, by I'd expect it to apply to
the current 3.50 release candidate. If it does not, I'm willing to
shake it into form.
--
Cheers,
Feri.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
> "Coe, Colin C. (Unix Engineer)" <Colin.Coe@woodside.com.au> writes:
>
> > I tried adding 'ipappend 1' to the pxelinux config files but had no
> > joy.
>
> Didn't it work as advertised? It should.
>
> > I'm thinking that if I write a COM32 module that adds "ip=1.2.3.4
> > gateway=1.2.3.1 netmask=255.255.255.0 dns= etc" to the end of the
> > append line my problem may be solved.
>
> See http://syslinux.zytor.com/archives/2007-April/008308.html
> for a patch that does what you need (if I understand it correctly).
> Basically, it lets you use macros in the kernel command line,
> which expand to values read from the DHCP packet. So in your
> pxelinux config file you would write something like
>
> label example
> linux vmlinuz-2.6.18
> append ip=$YIADDR$ gateway=$ROUTERS$ netmask=$MASK$ dns=$DNS$
>
> In the previous you can find another path, which probably
> does almost the same. My patch is against 3.50-pre2, by I'd
> expect it to apply to the current 3.50 release candidate. If
> it does not, I'm willing to shake it into form.
> --
> Cheers,
> Feri.
>
> _______________________________________________
> SYSLINUX mailing list
> Submissions to SYSLINUX@zytor.com
> Unsubscribe or set options at:
> http://www.zytor.com/mailman/listinfo/syslinux
> Please do not send private replies to mailing list traffic.

This looks exactly what I want. I tried applying the patch against
3.50pre18 but it doesn't apply cleanly. Any chance you could whack it
into shape?

Do you think this might be included in SYSLINUX proper soon?

When I say "ipappend 1" didn't work, what I mean is, Anaconda, the
RedHat installer, still tried to get a dhcp lease when I wanted it to
use the IP info specified from PXELINUX.


Thanks heaps

CC

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:
>
> This looks exactly what I want. I tried applying the patch against
> 3.50pre18 but it doesn't apply cleanly. Any chance you could whack it
> into shape?
>
> Do you think this might be included in SYSLINUX proper soon?
>

No, I don't want to put that in without creating an overall strategy for
macro handling. I'm still thinking about it, but it's definitely
post-3.50 material.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
> Coe, Colin C. (Unix Engineer) wrote:
> >
> > This looks exactly what I want. I tried applying the patch against
> > 3.50pre18 but it doesn't apply cleanly. Any chance you
> could whack it
> > into shape?
> >
> > Do you think this might be included in SYSLINUX proper soon?
> >
>
> No, I don't want to put that in without creating an overall
> strategy for macro handling. I'm still thinking about it,
> but it's definitely post-3.50 material.
>
> -hpa
>
> _______________________________________________
> SYSLINUX mailing list
> Submissions to SYSLINUX@zytor.com
> Unsubscribe or set options at:
> http://www.zytor.com/mailman/listinfo/syslinux
> Please do not send private replies to mailing list traffic.
>

Ok, thanks :)

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
"Coe, Colin C. (Unix Engineer)" <Colin.Coe@woodside.com.au> writes:

> This looks exactly what I want. I tried applying the patch against
> 3.50pre18 but it doesn't apply cleanly. Any chance you could whack it
> into shape?

Try the attached patch in the source directory with -p1. I think it
was made against current git head, but I'm slightly confused. git log
starts with Peter's 'vesacon_set_background: Need "volatile" asm'
patch, which is tagged 3.50-pre20 on the website, but git tag -l 3.50
lists pre1-5 only... I'm a git newbie, and would appreciate some
insight.
--
Thanks,
Feri.
Re: IP details in COM32 module [ In reply to ]
Ferenc Wagner wrote:
> "Coe, Colin C. (Unix Engineer)" <Colin.Coe@woodside.com.au> writes:
>
>> This looks exactly what I want. I tried applying the patch against
>> 3.50pre18 but it doesn't apply cleanly. Any chance you could whack it
>> into shape?
>
> Try the attached patch in the source directory with -p1. I think it
> was made against current git head, but I'm slightly confused. git log
> starts with Peter's 'vesacon_set_background: Need "volatile" asm'
> patch, which is tagged 3.50-pre20 on the website, but git tag -l 3.50
> lists pre1-5 only... I'm a git newbie, and would appreciate some
> insight.
>

Sounds like you need to pull tags. If you're using an old version of
git, I don't think it does that automatically. Also, the format of tags
was changed in a recent version of git, to allow tags to be packed with
the rest of the data.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
"H. Peter Anvin" <hpa@zytor.com> writes:

> Ferenc Wagner wrote:
>> "Coe, Colin C. (Unix Engineer)" <Colin.Coe@woodside.com.au> writes:
>>
>>> This looks exactly what I want. I tried applying the patch against
>>> 3.50pre18 but it doesn't apply cleanly. Any chance you could whack it
>>> into shape?
>>
>> Try the attached patch in the source directory with -p1. I think it
>> was made against current git head, but I'm slightly confused. git log
>> starts with Peter's 'vesacon_set_background: Need "volatile" asm'
>> patch, which is tagged 3.50-pre20 on the website, but git tag -l 3.50
>> lists pre1-5 only... I'm a git newbie, and would appreciate some
>> insight.
>>
>
> Sounds like you need to pull tags. If you're using an old version of
> git, I don't think it does that automatically. Also, the format of tags
> was changed in a recent version of git, to allow tags to be packed with
> the rest of the data.

git fetch --tags seems to do something to it. Thanks for the hint.
--
Feri.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
> Coe, Colin C. (Unix Engineer) wrote:
> > Hi all
> >
> > I'm trying to resolve a problem that's recently popped up
> by turning
> > on auxillary VLANs for our Linux workstations. The problem
> shows as
> > DHCP failling for anaconda (but always succeeds for PXE).
> >
> > I tried adding 'ipappend 1' to the pxelinux config files
> but had no joy.
> >
> > I'm thinking that if I write a COM32 module that adds "ip=1.2.3.4
> > gateway=1.2.3.1 netmask=255.255.255.0 dns= etc" to the end of the
> > append line my problem may be solved. Is there an API call of
> > function to get this info? I've seen the "resolve hostname"
> > (AX=0010h) but it's what I'm looking for.
> >
>
> There are two ways to do it.
>
> API 000Fh "get ipappend strings" will give you the ip= string
> that ipappend would add.
>
> API 0009h can be used to call the PXE stack and get the
> entire DHCP packets.
>
> In 3.50-pre* there are library wrappers for these -- they are
> called syslinux_ipappend_strings (<syslinux/config.h>) and
> pxe_get_cached_info
> (<syslinux/pxe.h>) repectively.
>
> -hpa
>

I know this is a newbie question, but how to I use pxe_get_cached_info?
I've search through the code and can't work out how to use it. I'd like
to use Ferenc Wagner's macros but I also don't want to rewrite my code
when an offical macro system is introduced.

Could I get an example of how to use pxe_get_cached_info?

Thanks

CC

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
>
> I know this is a newbie question, but how to I use
> pxe_get_cached_info? I've search through the code and can't
> work out how to use it. I'd like to use Ferenc Wagner's
> macros but I also don't want to rewrite my code when an
> offical macro system is introduced.
>
> Could I get an example of how to use pxe_get_cached_info?
>

Somewhat related, I've noticed that __com32.cs_bounce has a 32 character
limit. I'm needing to stuff 'junk' (far more than 32 chars) into this
variable.

-snip-
sprintf(junk, "ksdevice=eth0 hostname=%s ip=%s gateway=%s netmask=%s
dns=a.b.c.d", my_name, my_ip, my_gateway, my_netmask);
-snip-
sprintf(__com32.cs_bounce, "memdisk initrd=%s_%s.img %s", model, bios,
junk);
/* Populate the registers AX and BX then call INT22 */
memset(&reg, 0, sizeof(reg));
reg.eax.w[0] = 0x0003;
reg.ebx.w[0] = OFFS(__com32.cs_bounce);
reg.es = SEG(__com32.cs_bounce);
__intcall(0x22, &reg, &reg);
-snip-

Could someone advise of how I could or should do this?

CC

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
"Coe, Colin C. (Unix Engineer)" <Colin.Coe@woodside.com.au> writes:

>> API 000Fh "get ipappend strings" will give you the ip= string
>> that ipappend would add.
>>
>> API 0009h can be used to call the PXE stack and get the
>> entire DHCP packets.
>>
>> In 3.50-pre* there are library wrappers for these -- they are
>> called syslinux_ipappend_strings (<syslinux/config.h>) and
>> pxe_get_cached_info
>> (<syslinux/pxe.h>) repectively.
>
> I know this is a newbie question, but how to I use
> pxe_get_cached_info?

The stock linux.c32 module uses this library function to get the DHCP
packet, see com32/modules/linux.c. The stock version writes that into
a file as-is, while my patch enables config file string substitution
as well, base on the same data.

> I'd like to use Ferenc Wagner's macros but I also don't want to
> rewrite my code when an offical macro system is introduced.

You don't have to write any code if you apply the patch: you simply
gain new syntax to use in the config file. I hope the new patch
works, is didn't actually test it, only compiled...

> Could I get an example of how to use pxe_get_cached_info?

See com32/modules/linux.c. The patch just moves the call into a
separate function, not touching it otherwise.
--
Feri.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:
>
> Somewhat related, I've noticed that __com32.cs_bounce has a 32 character
> limit. I'm needing to stuff 'junk' (far more than 32 chars) into this
> variable.
>

How did you "notice" that? I have no idea where you got that concept from.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:
>
> Somewhat related, I've noticed that __com32.cs_bounce has a 32 character
> limit. I'm needing to stuff 'junk' (far more than 32 chars) into this
> variable.
>

How did you "notice" that? I have no idea where you got that concept from.

-hpa

_______________________________________________

After appending all the ip info I want to be passed to anaconda into __com32.cs_bounce, then printing __com32.cs_bounce only the first 32 chars are shown. Also looking in ./com32/include/com32.h in "extern struct com32_sys_args" I saw "uint32_t cs_bounce_size" so I figured 32 chars, from your responce I gather I'm way off base.

I very confused as to why this string gets truncated at the 32 char mark...

CC

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:
> After appending all the ip info I want to be passed to anaconda into __com32.cs_bounce, then printing __com32.cs_bounce only the first 32 chars are shown. Also looking in ./com32/include/com32.h in "extern struct com32_sys_args" I saw "uint32_t cs_bounce_size" so I figured 32 chars, from your responce I gather I'm way off base.

You did something like fputs(__com32.cs_bounce, stdout); I presume (or
printf, or what have you.)

This will be translated into a write() call to the console, which calls
back into syslinux; that will use... (wait for it) the bounce buffer
internally in the library.

> I very confused as to why this string gets truncated at the 32 char mark...

See above.

Pretty much, any libc function which does I/O will clobber the bounce
buffer, and many that don't. Consider it a very volatile,
single-threaded resource which is only supposed to be used right around
the intcall that invokes it.

In syslinux-3.50-pre* you can use the wrapper function
syslinux_run_command() to do that I believe you want to do; it's defined
in <syslinux/boot.h>.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
>
> Coe, Colin C. (Unix Engineer) wrote:
> > After appending all the ip info I want to be passed to
> anaconda into __com32.cs_bounce, then printing
> __com32.cs_bounce only the first 32 chars are shown. Also
> looking in ./com32/include/com32.h in "extern struct
> com32_sys_args" I saw "uint32_t cs_bounce_size" so I figured
> 32 chars, from your responce I gather I'm way off base.
>
> You did something like fputs(__com32.cs_bounce, stdout); I
> presume (or printf, or what have you.)
>
> This will be translated into a write() call to the console,
> which calls back into syslinux; that will use... (wait for
> it) the bounce buffer internally in the library.
>
> > I very confused as to why this string gets truncated at the
> 32 char mark...
>
> See above.
>
> Pretty much, any libc function which does I/O will clobber
> the bounce buffer, and many that don't. Consider it a very
> volatile, single-threaded resource which is only supposed to
> be used right around the intcall that invokes it.
>
> In syslinux-3.50-pre* you can use the wrapper function
> syslinux_run_command() to do that I believe you want to do;
> it's defined in <syslinux/boot.h>.Z
>
> -hpa

Apologies for going on with this but I still don't get what I need to
do.

The guts of what I'm trying to do is this:
- network boot is selected
- using dmi code, check model and BIOS versions
- parse file bios_rev.csv on TFTP server look for matching line
- if match found and BIOS version not right, boot DOS floppy image,
flash bios, rewrite first 2 bytes of HDD to ensure another network boot
- otherwise:
- get name of menu to netboot plus IP, gw, nm and dns from DHCP packet

- assemble these into one string and boot.
- eg 'rhel3 ksdevice=eth0 hostname=linuxwks ip=1.1.1.2
gateway=1.1.1.254 netwmask=255.255.255.0 dns=1.1.1.1'

My .csv file looks like this
--
xw9300,2.09
xw8400,2.21
--

My PXELINUX config file looks like
--
say Satellite (LWS)

default flash_bios
prompt 1
timeout 100

label flash_bios
kernel wel_boot.c32
append el3u8

label el3u8
kernel ks-rhel-x86_64-ws-3-u8/vmlinuz
append initrd=ks-rhel-x86_64-ws-3-u8/initrd.img
ks=http://sat_server/kickstart/ks/org/1x33bf2048269014bdb91b23c8c6411c37
/label/lws_el3u8 vga=1 load_ramdisk=1
--

So what I want to do is grab the relevent info from the DHCP lease (ip,
gateway, netmask, etc) and put it at the end of the append line in label
'el3u8'.

I've extracted the info I want but when I try and assemble it, I get a
hard hang.
--
/* BIOS is right, boot config in argv[1] */
char *details;
printf("BIOS revision OK, starting rebuild...\n");
/* Parse the 'flash_bios' append line */
for (i=1; i<argc; i++) {
sprintf(buff, "%s %s", buff, argv[i]);
}
sprintf(__com32.cs_bounce, "%s bootproto=static
ksdevice=eth0 ip=%s netmask=%s gateway=%s dns=%s domain=%s", buff,
my_ip, my_netmask, my_gateway, my_dns, my_domain);

printf("__com32.cs_bounce contains '%s'\n",
__com32.cs_bounce);

/* Populate the registers AX and BX then call INT22 */
memset(&reg, 0, sizeof(reg));
reg.eax.w[0] = 0x0003;
reg.ebx.w[0] = OFFS(__com32.cs_bounce);
reg.es = SEG(__com32.cs_bounce);
__intcall(0x22, &reg, &reg);

return ( reg.eflags.l & EFLAGS_CF ) ? -1 : 0;
}
--

The hard hang happens on the line doing the 'sprintf(__com32.cs_bounce',
I never see the line '__com32.cs_bounce contains ...'

Could someone please give me a point in the right direction?

TIA

CC

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:
> /* BIOS is right, boot config in argv[1] */
> char *details;
> printf("BIOS revision OK, starting rebuild...\n");
> /* Parse the 'flash_bios' append line */
> for (i=1; i<argc; i++) {
> sprintf(buff, "%s %s", buff, argv[i]);
> }

How is buff defined?

> sprintf(__com32.cs_bounce, "%s bootproto=static
> ksdevice=eth0 ip=%s netmask=%s gateway=%s dns=%s domain=%s", buff,
> my_ip, my_netmask, my_gateway, my_dns, my_domain);
>
> printf("__com32.cs_bounce contains '%s'\n",
> __com32.cs_bounce);
>
> /* Populate the registers AX and BX then call INT22 */
> memset(&reg, 0, sizeof(reg));
> reg.eax.w[0] = 0x0003;
> reg.ebx.w[0] = OFFS(__com32.cs_bounce);
> reg.es = SEG(__com32.cs_bounce);
> __intcall(0x22, &reg, &reg);

You can replace this section with something like:

#include <syslinux/boot.h>

char command[2048];

snprintf(command, sizeof command, "%s bootproto=static ksdevice=eth0
ip=%s netmask=%s gateway=%s dns=%s domain=%s", buff,
my_ip, my_netmask, my_gateway, my_dns, my_domain);

syslinux_run_command(command);

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
>
> Coe, Colin C. (Unix Engineer) wrote:
> > /* BIOS is right, boot config in argv[1] */
> > char *details;
> > printf("BIOS revision OK, starting rebuild...\n");
> > /* Parse the 'flash_bios' append line */
> > for (i=1; i<argc; i++) {
> > sprintf(buff, "%s %s", buff, argv[i]);
> > }
>
> How is buff defined?
>
> > sprintf(__com32.cs_bounce, "%s bootproto=static
> > ksdevice=eth0 ip=%s netmask=%s gateway=%s dns=%s domain=%s", buff,
> > my_ip, my_netmask, my_gateway, my_dns, my_domain);
> >
> > printf("__com32.cs_bounce contains '%s'\n",
> > __com32.cs_bounce);
> >
> > /* Populate the registers AX and BX then
> call INT22 */
> > memset(&reg, 0, sizeof(reg));
> > reg.eax.w[0] = 0x0003;
> > reg.ebx.w[0] = OFFS(__com32.cs_bounce);
> > reg.es = SEG(__com32.cs_bounce);
> > __intcall(0x22, &reg, &reg);
>
> You can replace this section with something like:
>
> #include <syslinux/boot.h>
>
> char command[2048];
>
> snprintf(command, sizeof command, "%s bootproto=static
> ksdevice=eth0 ip=%s netmask=%s gateway=%s dns=%s domain=%s",
> buff, my_ip, my_netmask, my_gateway, my_dns, my_domain);
>
> syslinux_run_command(command);
>
> -hpa

Hi hpa

buff is defined as 'char *buff'.

Many thanks for the pointer, the code no longer produces a hard hang.

I found a few other problems with my code as well. Things seem to work better when defined as 'char something[n]' rather than 'char *something' but I'm not sure why this would be the case.

I'm getting some inconsistant results and I want to do more testing before I post more questions.

Thanks again

CC

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
On Mon, Jun 11, 2007 at 06:10:02PM +0800, Coe, Colin C. (Unix Engineer) wrote:
> buff is defined as 'char *buff'.
>
> Many thanks for the pointer, the code no longer produces a hard hang.
>
> I found a few other problems with my code as well. Things seem to work better when defined as 'char something[n]' rather than 'char *something' but I'm not sure why this would be the case.

Yes, things usually go better when you define memory for them.
char something[n] defines an array of size n (the compiler allocates the
buffer, usually on the stack). char *something defines a pointer to an
area of memory. Unless you initialize it (like something = malloc(n) or
something = some_array), it points to a random area of memory, and
you're likely to corrupt data.

--
lfr
0/0
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:
> buff is defined as 'char *buff'.

And lemme guess, you never initialized it.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Thanks lfr, that helps to explain more of what I'm doing wrong.

Another problem I'm finding is that I'm not always seeing all of the
DHCP options. For example, my dhcp (ISC DHCP) config looks somewhat
like
--
group {
subnet 10.1.1.0 netmask 255.255.254.0 {
option domain-name "company.com.au";
option subnet-mask 255.255.254.0;
option broadcast-address 10.1.1.255;
option domain-name-servers 192.168.1.2, 192.168.1.3;
option routers 10.1.1.1;
option nis-domain "company.com.au";
}
# PXE-specific configuration directives...
next-server 192.168.1.4;
filename "linux-install/pxelinux.0";
snip
host linux96 {
hardware ethernet 00:1A:4B:53:58:79;
fixed-address 10.1.1.96;
option host-name "linux96";
}
snip
--

The code that parse the DHCP info looks like this (should look pretty
familiar):
--
unsigned int i;
for (i = 0; i < dhcp_params.length; i++) {
const struct option_val *o = dhcp_params.buffer;
printf("Counter: %d, %s: %s\n", i, o[i].desc, o[i].value);
}
--
Shouldn't all of the DHCP info get printed? Is there any reason that
the option 'host-name' isn't showing up in the list?

Alternatively, is there any way of doing a reverse DNS lookup on the
workstations IP address?

I'm pretty sure that this is my last hurdle.

TIA

CC

> -----Original Message-----
> From: syslinux-bounces@zytor.com
> [mailto:syslinux-bounces@zytor.com] On Behalf Of Luciano Rocha
> Sent: Monday, 11 June 2007 6:40 PM
> To: syslinux@zytor.com
> Subject: Re: [syslinux] IP details in COM32 module
>
> On Mon, Jun 11, 2007 at 06:10:02PM +0800, Coe, Colin C. (Unix
> Engineer) wrote:
> > buff is defined as 'char *buff'.
> >
> > Many thanks for the pointer, the code no longer produces a
> hard hang.
> >
> > I found a few other problems with my code as well. Things
> seem to work better when defined as 'char something[n]'
> rather than 'char *something' but I'm not sure why this would
> be the case.
>
> Yes, things usually go better when you define memory for them.
> char something[n] defines an array of size n (the compiler
> allocates the buffer, usually on the stack). char *something
> defines a pointer to an area of memory. Unless you initialize
> it (like something = malloc(n) or something = some_array), it
> points to a random area of memory, and you're likely to corrupt data.
>
> --
> lfr
> 0/0
>

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Hi all

Please ignore my last email, I see where my code was wrong now. I now
see all the DHCP options correctly.

I'll quietly go away now...

CC

> -----Original Message-----
> From: syslinux-bounces@zytor.com
> [mailto:syslinux-bounces@zytor.com] On Behalf Of Luciano Rocha
> Sent: Monday, 11 June 2007 6:40 PM
> To: syslinux@zytor.com
> Subject: Re: [syslinux] IP details in COM32 module
>
> On Mon, Jun 11, 2007 at 06:10:02PM +0800, Coe, Colin C. (Unix
> Engineer) wrote:
> > buff is defined as 'char *buff'.
> >
> > Many thanks for the pointer, the code no longer produces a
> hard hang.
> >
> > I found a few other problems with my code as well. Things
> seem to work better when defined as 'char something[n]'
> rather than 'char *something' but I'm not sure why this would
> be the case.
>
> Yes, things usually go better when you define memory for them.
> char something[n] defines an array of size n (the compiler
> allocates the buffer, usually on the stack). char *something
> defines a pointer to an area of memory. Unless you initialize
> it (like something = malloc(n) or something = some_array), it
> points to a random area of memory, and you're likely to corrupt data.
>
> --
> lfr
> 0/0
>

NOTICE: This email and any attachments are confidential.
They may contain legally privileged information or
copyright material. You must not read, copy, use or
disclose them without authorisation. If you are not an
intended recipient, please contact us at once by return
email and then delete both messages and all attachments.

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.
Re: IP details in COM32 module [ In reply to ]
Coe, Colin C. (Unix Engineer) wrote:

>
> The code that parse the DHCP info looks like this (should look pretty
> familiar):
> --
> unsigned int i;
> for (i = 0; i < dhcp_params.length; i++) {
> const struct option_val *o = dhcp_params.buffer;
> printf("Counter: %d, %s: %s\n", i, o[i].desc, o[i].value);
> }
> --
> Shouldn't all of the DHCP info get printed? Is there any reason that
> the option 'host-name' isn't showing up in the list?
>

DHCP, unlike BOOTP, doesn't by default send all the options, only the
options requested by the client -- at least in theory. This rather
conflicts with PXE's way of doing things, which is to can packets for
later examination. DHCP clients are supposed to be able to ask for more
information by sending a DHCPINFORM packets, but there are *many*
pitfalls to that strategy.

ISC DHCP can be made to send the additional information, fortunately, by
using a construct like:

http://syslinux.zytor.com/archives/2002-July/000708.html

> Alternatively, is there any way of doing a reverse DNS lookup on the
> workstations IP address?

There is, but you'd have to:

- Parse the DHCP response to get the DNS server entries.
- Send a DNS query packet for the appropriate lookup
(X.Y.Z.W -> W.Z.Y.X.in-addr.arpa)
- Parse the response.

Right now I don't have any wrapper functions for sending and receiving
raw UDP packets, although that probably would be a good idea to have.

-hpa

_______________________________________________
SYSLINUX mailing list
Submissions to SYSLINUX@zytor.com
Unsubscribe or set options at:
http://www.zytor.com/mailman/listinfo/syslinux
Please do not send private replies to mailing list traffic.