aboutsummaryrefslogtreecommitdiff
path: root/lib/libnet/netload.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libnet/netload.c')
-rw-r--r--lib/libnet/netload.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/libnet/netload.c b/lib/libnet/netload.c
index 6429405..848609d 100644
--- a/lib/libnet/netload.c
+++ b/lib/libnet/netload.c
@@ -386,14 +386,11 @@ static void seed_rng(uint8_t mac[])
srand(seed);
}
-int
-netboot(int argc, char *argv[])
+int netload(char *buffer, int len, char *ret_buffer, int huge_load,
+ int block_size, char *args_fs, int alen)
{
char buf[256];
int rc;
- int len = strtol(argv[2], 0, 16);
- char *buffer = (char *) strtol(argv[1], 0, 16);
- char *ret_buffer = (char *) strtol(argv[3], 0, 16);
filename_ip_t fn_ip;
int fd_device;
tftp_err_t tftp_err;
@@ -403,8 +400,6 @@ netboot(int argc, char *argv[])
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
- int huge_load = strtol(argv[4], 0, 10);
- int32_t block_size = strtol(argv[5], 0, 10);
uint8_t own_mac[6];
puts("\n Initializing NIC");
@@ -458,8 +453,16 @@ netboot(int argc, char *argv[])
seed_rng(own_mac);
- if (argc > 6) {
- parse_args(argv[6], &obp_tftp_args);
+ if (alen > 0) {
+ char args[256];
+ if (alen > sizeof(args) - 1) {
+ puts("ERROR: Parameter string is too long.");
+ return -7;
+ }
+ /* Convert forth string into NUL-terminated C-string */
+ strncpy(args, args_fs, alen);
+ args[alen] = 0;
+ parse_args(args, &obp_tftp_args);
if(obp_tftp_args.bootp_retries - rc < DEFAULT_BOOT_RETRIES)
obp_tftp_args.bootp_retries = DEFAULT_BOOT_RETRIES;
else