This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: functions tftp_get & tftp_put broken ????


Hi Andrew,

here is a simplified test case derived from the tftp_client_test.c in
net/common/tests .  The redboot used is derived from the june 6 th download.
The file hello.srec is 1043008 bytes, tftp server is SolarWinds tftp server
on an Nt (previous tests with the may version of the library on linux and
freebsd where ok). the redboot command fconfig sets up the tftp server to
the NT's ip address. Redboot's ip address did not use bootp but a fixed ip.
The freebsd config used the fixed ip option

many thanks

Henri

example output on code linked with may  library :
Start TFTP test ,
BOOTP[eth0] op: REPLY
       htype: Ethernet
        hlen: 6
        hops: 0
         xid: 0x0
        secs: 0
       flags: 0x0
       hw_addr: 08:88:12:34:56:78
     client IP: 192.168.0.21
         my IP: 192.168.0.21
     server IP: 192.168.0.4
    gateway IP: 192.168.0.4
  options:
        subnet mask: 255.255.255.0
       IP broadcast: 192.168.0.255
            gateway: 192.168.0.4
Trying tftp_get hello.srec      192.168.0.4...
res = 1043008, err = 0


example output on june library
Start TFTP test ,
BOOTP[eth0] op: REPLY
       htype: Ethernet
        hlen: 6
        hops: 0
         xid: 0x0
        secs: 0
       flags: 0x0
       hw_addr: 08:88:12:34:56:78
     client IP: 192.168.0.21
         my IP: 192.168.0.21
     server IP: 192.168.0.4
    gateway IP: 192.168.0.4
  options:
        subnet mask: 255.255.255.0
       IP broadcast: 192.168.0.255
            gateway: 192.168.0.4
Trying tftp_get hello.srec      192.168.0.4...
res = -1, err = 9




// TFTP test code

#include <network.h>
#include <tftp_support.h>

// Note: the TFTP client calls need at least (SEGSIZE==512)+4
// additional bytes of workspace, thus the padding.
#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL+0x1000)
static char stack[STACK_SIZE];
static cyg_thread thread_data;
static cyg_handle_t thread_handle;
extern void
cyg_test_exit(void);
static char buf[1200*1024];   /* for transfers up to 1.2meg */

#define GETFILE "hello.srec"
static void
tftp_test(struct bootp *bp)
{
    int res,  err ;
    struct sockaddr_in host;

    memset((char *)&host, 0, sizeof(host));
    host.sin_len = sizeof(host);
    host.sin_family = AF_INET;
    host.sin_addr = bp->bp_siaddr;
    host.sin_port = 0;
    diag_printf("Trying tftp_get %s %16s...\n", GETFILE,
inet_ntoa(host.sin_addr));
 res = tftp_get( GETFILE, &host, buf, sizeof(buf), TFTP_OCTET, &err);
    diag_printf("res = %d, err = %d\n", res, err);
}

void
net_test(cyg_addrword_t param)
{
     diag_printf("Start TFTP test , \n");

     init_all_network_interfaces();
#ifdef CYGHWR_NET_DRIVER_ETH0
     if (eth0_up) {
         tftp_test(&eth0_bootp_data);
   }
#endif
    cyg_test_exit();
}
void
cyg_start(void)
{
    // Create a main thread, so we can run the scheduler and have time
'pass'
    cyg_thread_create(10,                // Priority - just a number
                      net_test,          // entry
                      0,                 // entry parameter
                      "Network test",    // Name
                      &stack[0],         // Stack
                      STACK_SIZE,        // Size
                      &thread_handle,    // Handle
                      &thread_data       // Thread data structure
            );
    cyg_thread_resume(thread_handle);  // Start it
    cyg_scheduler_start();
}

----- Original Message -----
From: "Andrew Lunn" <andrew.lunn@ascom.ch>
To: "HG" <henri@broadbandnetdevices.com>
Cc: <ecos-discuss@sources.redhat.com>
Sent: Friday, June 20, 2003 6:27 AM
Subject: Re: [ECOS] functions tftp_get & tftp_put broken ????


> On Thu, Jun 19, 2003 at 05:02:24PM -0400, HG wrote:
> > Hi All,
> >
> > the test program tftp_client_test.c that was working for an ecos
download
> > from early may, stopped working for an ecos download dated june 6. The
test
> > file size for the tftp_get is about 1 meg. The exact same .ecc file and
> > application was used, only the repository was changed.
> >
> > the recently updated tftp_get code calls ret = inet_ntop(...) that
returns
> > null
> > thus creating the error number 9 (network error).
> > The test case is for a fixed ip address ,
> > the freebsd stack and the tftp server configured as part of the redboot
> > config
> > stored in flash
>
>
> Hi Henri.
>
> Its probably me that broke it. Please can you give me exact details of
> how to reproduce the problem. A test case would be great.
>
>     Andrew
>


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]