Skip to contentSkip to conversation

net: Increase the size of the net_boot_file_name buffer

PATCH New Jacob Stiffler 5 participants 10 messages Sep 30, 2015 – Oct 29, 2015 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

---
 include/net.h | 2 +-
 net/net.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/net.h +1 -1
index f1671e3..197d2c6 100644
@@ -512,7 +512,7 @@ enum proto_t {
 	TFTPSRV, TFTPPUT, LINKLOCAL
 };
 
-extern char	net_boot_file_name[128];/* Boot File name */
+extern char	net_boot_file_name[1024];/* Boot File name */
 /* The actual transferred size of the bootfile (in bytes) */
 extern u32	net_boot_file_size;
 /* Boot file size in blocks as reported by the DHCP server */
net/net.c +1 -1
index a115ce2..7116ef3 100644
@@ -164,7 +164,7 @@ ushort		net_our_vlan = 0xFFFF;
 ushort		net_native_vlan = 0xFFFF;
 
 /* Boot File name */
-char net_boot_file_name[128];
+char net_boot_file_name[1024];
 /* The actual transferred size of the bootfile (in bytes) */
 u32 net_boot_file_size;
 /* Boot file size in blocks as reported by the DHCP server */
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

Dear Jacob,

Quoted 5 lines · In message <[email protected]> you wrote:

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

According to RFC 2131, the boot file name has a fixed size of 128 octets.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Drun'? 'm not drun'! You woudn' dare call m' drun' if I was sober!
                                     - Terry Pratchett, _Men at Arms_
#2 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

Quoted 10 lines · Wolfgang Denk

Dear Jacob,

Quoted 5 lines · In message <[email protected]> you wrote:

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

According to RFC 2131, the boot file name has a fixed size of 128 octets.

Wolfgang,

Yes. However, the global "net_boot_file_name" is not only used for BOOTP, but also for NFS and TFTP.

"net_boot_file_name" appears to be temporary storage to supply the file path to arbitrary protocols from the command line arguments.

The "file" field in the bootp message is fixed at 128 octets in the "bootp_hdr" structure.

The contents of "net_boot_file_name" are read or written using the standard "strncopy()" or the similar "copy_filename()", so there should be any issue with respect to memory leaks.

Thank you,
Jacob Stiffler

Quoted 4 lines

Best regards,

Wolfgang Denk

#3 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

Dear Jacob,

Quoted 6 lines · In message <[email protected]> you wrote:

Yes. However, the global "net_boot_file_name" is not only used for BOOTP, but also for NFS and TFTP.

"net_boot_file_name" appears to be temporary storage to supply the file path to arbitrary protocols from the command line arguments.

I see.

Quoted 6 lines

The "file" field in the bootp message is fixed at 128 octets in the "bootp_hdr" structure.

The contents of "net_boot_file_name" are read or written using the standard "strncopy()" or the similar "copy_filename()", so there should be any issue with respect to memory leaks.

I guess you mean there should NOT be any issue?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Anarchy may not be the best form of government, but it's better  than
no government at all.
#4 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

Quoted 10 lines · Wolfgang Denk

Dear Jacob,

Quoted 5 lines · In message <[email protected]> you wrote:

Yes. However, the global "net_boot_file_name" is not only used for BOOTP, but also for NFS and TFTP.

"net_boot_file_name" appears to be temporary storage to supply the file path to arbitrary protocols from the command line arguments.

I see.

Quoted 7 lines
Quoted 6 lines

The "file" field in the bootp message is fixed at 128 octets in the "bootp_hdr" structure.

The contents of "net_boot_file_name" are read or written using the standard "strncopy()" or the similar "copy_filename()", so there should be any issue with respect to memory leaks.

I guess you mean there should NOT be any issue?

Yes, sorry. There should not be any issue with respect to memory leaks.

Thank you,
Jacob Stiffler

Quoted 4 lines

Best regards,

Wolfgang Denk

#5 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

Quoted 18 lines
Quoted 16 lines · Stefan Bruens
Quoted 11 lines · On Thursday 01 October 2015 16:27:11 Wolfgang Denk wrote:

Dear Jacob,

Quoted 5 lines · In message <[email protected]> you wrote:

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

According to RFC 2131, the boot file name has a fixed size of 128 octets.

You can also put the file name into Option 67, which results in a length limit of 255 octets (DHCP option length limit).

Quoted 6 lines
Quoted 2 lines

I sent patches with several DHCP enhancements, including Option 67 support, to the ML a few weeks ago.

Has those patches been applied? otherwise it would be good to rebase it and send them again as we are close of release and merge window will soon open.

The intent of this patch is not to increase the size of the path for bootp, but to increase the size of the path for nfs and tftp. The "net_boot_file_name" is a common global variable used for all network commands which load files into memory, and is basically temporary storage.

#6 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

In reply to Wolfgang Denk
Quoted 11 lines · On Thursday 01 October 2015 16:27:11 Wolfgang Denk wrote:

Dear Jacob,

Quoted 5 lines · In message <[email protected]> you wrote:

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

According to RFC 2131, the boot file name has a fixed size of 128 octets.

You can also put the file name into Option 67, which results in a length limit of 255 octets (DHCP option length limit).

I sent patches with several DHCP enhancements, including Option 67 support, to the ML a few weeks ago.

Kind regards,

Stefan

Signature · 3 lines
Stefan Br?ns  /  Bergstra?e 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019
work: +49 2405 49936-424
#7 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

Quoted 10 lines · Stefan Bruens
Quoted 9 lines · On Thursday 01 October 2015 16:27:11 Wolfgang Denk wrote:

Dear Jacob,

Quoted 5 lines · In message <[email protected]> you wrote:

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

Quoted 8 lines
Quoted 2 lines

According to RFC 2131, the boot file name has a fixed size of 128 octets.

You can also put the file name into Option 67, which results in a length limit of 255 octets (DHCP option length limit).

I sent patches with several DHCP enhancements, including Option 67 support, to the ML a few weeks ago.

Has those patches been applied? otherwise it would be good to rebase it and send them again as we are close of release and merge window will soon open.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750
#8 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

In reply to Jacob Stiffler

Hi Jacob,

Quoted 7 lines · Jacob Stiffler

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

#9 lore raw

PATCH 1/1 net: Increase the size of the net_boot_file_name buffer

In reply to Jacob Stiffler
Quoted 7 lines · Jacob Stiffler

The net_boot_file_name buffer is used as storage for the bootfilename command line argument to network boot commands such as tftp and nfs.

Increase the size of this buffer to 1024 bytes as the current size of 128 bytes is restrictive for arbitrary paths on the server.

Applied to u-boot-net/master, thanks!
-Joe