RTEMS - FreeBSD TFTP test problem.

Thomas Kim thomas73.kim at gmail.com
Mon Jun 30 07:06:24 UTC 2014


Dear Sir,

I still have a problem using TFTP.
I am digging RTEMS network stack due to TFTP problem.

My testing environment are two cases.

1. DHCP IP configuration using  "RTEMS_USE_BOOTP" predefine option.
   - Access Point IP : 192.168.10.1
   - Target Board IP : 192.168.10.22
   - My Notebook IP : 192.168.10.25

2. Static IP configuration.
   - Target Board IP : 192.168.137.100
   - My Notebook IP : 192.168.137.1

I tested two demos telnetd and tftptest in network example code.
------------------------------------------------------------------------
IP config type    Telnet server         TFTP
------------------------------------------------------------------------
DHCP config         Test OK           Problem 1.
Static config          Test OK          Problem 2.
------------------------------------------------------------------------

I added printk() log message in network stack as like below;

< in_pcb.c >
int
in_pcbladdr(struct inpcb *inp, struct mbuf *nam, struct sockaddr_in
**plocal_sin)
{
.....
if (inp->inp_laddr.s_addr == INADDR_ANY) {
register struct route *ro;

ia = (struct in_ifaddr *)0;
/*
 * If route is known or can be allocated now,
 * our src addr is taken from the i/f, else punt.
 */
ro = &inp->inp_route;
#if 1 // Added by Thomas Kim
if (ro->ro_rt != NULL)
printk("  if_name=%s\n", ro->ro_rt->rt_ifp->if_name);
#endif
....
}

< ip_output.c >

int
ip_output(struct mbuf *m0, struct mbuf *opt, struct route *ro, int flags,
struct ip_moptions *imo)
{
.....
if (ro->ro_rt == NULL) { dst->sin_family = AF_INET;
dst->sin_len = sizeof(*dst);
dst->sin_addr = ip->ip_dst;
}
#if 1 // Added by Thomas Kim
printk("dst.s_addr=0x%08x\n", dst->sin_addr.s_addr);
#endif
  ....
}

I attached my modified init.c source in tftpTest directory for running
RTEMS shell.

** Problem 1 :*
   TFTP server program is running my notebook(IP:192.168.10.25). also, TFTP
server folder have README file name.
   After I enter "cat /TFTP/192.168.10.25/README" on target terminal, log
message is below;
    - "if_name=lan"  ==> OK. It is ethernet interface
    - "dst.s_addr=0xC0A80A01".  ==> Problem. It is wrong IP address.
   It mean that target is tring to connect access point(192.168.10.1).

** Problem 2 : *
   TFTP server program is running my notebook(IP:192.168.137.1).
   After I enter 'cat /TFTP/192.168.137.1/README" on target terminal, log
message is below;
    - "if_name=lo"  ==> Problem. It is not ethernet interface. It is local
loopback.
    - "dst.s_addr=0x7F000001". ==> Problem. loopback IP is 127.0.0.1

I am guessing that there is a bug in RTEMS network stack for using TFTP.

Please advise me.

Best Regards,
Thomas Kim



2014-06-16 18:42 GMT+09:00 Thomas Kim <thomas73.kim at gmail.com>:

> Dear Sir,
>
> I am sorry.
> At this time, I didn't use BOOTP option. therefore, I used static ethernet
> IP configuration.
>
> My ethernet configuration is below;
>
> extern int _rtems_smsc9220_driver_attach (struct rtems_bsdnet_ifconfig
> *config, int attach) ;
>
> struct rtems_bsdnet_ifconfig lan9220_ifconfig =
> {
> "lan0",                   /* name */
>  _rtems_smsc9220_driver_attach,/* attach funtion */
> NULL,                        /* next interface */
> #if defined(RTEMS_USE_BOOTP)
> NULL,
> NULL,
> #else
> "192.168.137.100",           /* ip address */
>  "255.255.255.0",             /* ip netmask */
> #endif
> NULL,                 /* hardware address */
>   0,                           /* ignore broadcast */
>   0,                           /* mtu */
>   0,                           /* rbuf count */
>   0,                           /* xbuf count */
>   0,                           /* port */
>   0,                           /* irno */
>   0,                           /* bpar */
>   0                            /* drv ctrl */
> };
>
> struct rtems_bsdnet_config rtems_bsdnet_config = {
>   &lan9220_ifconfig,                /* Loop back interface only */
> #if defined(RTEMS_USE_BOOTP)
>   rtems_bsdnet_do_dhcp,                /* do not use bootp */
> #else
>   NULL,
> #endif
>   20,                   /* Default network task priority */
>   256*1024,            /* Default mbuf capacity */
>   256*1024,            /* Default mbuf cluster capacity */
> #if defined(RTEMS_USE_BOOTP)
>   NULL,
>   NULL,
>   NULL,
>   NULL,
>   { NULL },
>                         /* NTP server(s) */
>   { "64.4.10.33",       /* time.windows.com (Microsoft) */
>     "210.98.16.100" },  /* time.kriss.re.kr (KRISS) */
> #else
>   "rtems",             /* Host name */
>   "nodomain.com",      /* Domain name */
>   "192.168.137.1",     /* Gateway */
>   "127.0.0.1",         /* Log host */
>   {"61.41.153.2",      /* Name server(s) */
>    "1.214.68.2" },
>                        /* NTP server(s) */
>   { "64.4.10.33",      /* time.windows.com (Microsoft) */
>     "210.98.16.100" }, /* time.kriss.re.kr (KRISS) */
> #endif
>   0,                   /* sb_efficiency */
>   0,                   /* udp_tx_buf_size */
>   0,                   /* udp_rx_buf_size */
>   0,                   /* tcp_tx_buf_size */
>   0                    /* tcp_rx_buf_size */
>
> };
>
> Best Regards,
>
>
>
> 2014-06-16 18:38 GMT+09:00 Thomas Kim <thomas73.kim at gmail.com>:
>
>> Dear Sir,
>>
>> I have still a problem for using TFTP test code.
>>
>> As I check in rtems_tftp_open_works() function, I guess that BOOTP should
>> be enabled for running TFTP.
>> At this time, if_address, ip_netmask and hardware_address of struct
>> rtems_bsdnet_ifconfig are NULL.
>>
>> I don't know TFTP operation is related with BOOTP.
>>
>> Please advise me.
>>
>> Best Regards,
>>
>>
>>
>> 2014-05-15 15:42 GMT+09:00 Thomas Kim <thomas73.kim at gmail.com>:
>>
>>> Dear Sir,
>>>
>>> I am testing RTEMS FreeBSD networking using
>>> network-demos-network-demos-4.10.2.
>>>
>>> At this time, testing code about dnstest, http  are OK.
>>>
>>> When I try to test tftpTest, there is below problem.
>>>
>>> Function flow for TFTP request is below;
>>>   - rtems_tftp_open()
>>>   - rtems_tftp_open_worker()
>>>   - sendto()
>>>   - udp_output()
>>>   - ip_output() ==> My problem is here !!!
>>>
>>> Normal case using TCP, if_output() function entry in ip_output is
>>> ether_output().
>>> But, abnormal case using UDP, if_output() function entry is looutout().
>>> It mean that UDP is tring to use loopback interface.
>>>
>>> I don't know the reason about this problem.
>>>
>>> Please could you let me know how to resolve this ?
>>>
>>> Best Regards.
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140630/1aa5033b/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init.c
Type: text/x-csrc
Size: 2457 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20140630/1aa5033b/attachment-0002.bin>


More information about the users mailing list