Mercurial > flash_v2
comparison packages/net/common/current/tests/tftp_server_test.c @ 957:db3e0a2fda2f
2003-04-12 Andrew Lunn <andrew.lunn@ascom.ch>
* src/network_support.c (init_loopback_interface): Close the
socket when things go wrong otherwise we leak sockets.
* src/tftp_server.c (tftpd_server): Added support for IPv6 as well
as IPv4. Extended the multithreading support so that it works
correctly when there are multiple servers on multiple ports.
* doc/tcpip.sgml: Documentation for the changes made to the tftp
server.
2003-04-10 Andrew Lunn <andrew.lunn@ascom.ch>
* src/network_support.c (init_all_network_interfaces): Wait upto 4
seconds for a router solicit message to be received. Once we have
received the message we know we have a valid IPv6 address.
* src/tftp_client.c: Added support for IPv6. This requires two new
functions, tftp_client_{get|put} which are protocol version
independent.
* tests/tftp_client_test.c (tftp_test): Added tests which use IPv6
addresses.
2003-04-07 Andrew Lunn <andrew.lunn@ascom.ch>
* src/getaddrinfo.c (getaddrinfo): Correctly deal with node when
its not NULL. Its OK for the address to not parse for an address
family when AF_UNSPEC is passed in hints. Also get the socktype
correct when wildcarding for services that use UDP.
* tests/addr_test.c: Added more test cases which test IP addresses
in number format as node.
2003-04-05 Andrew Lunn <andrew.lunn@ascom.ch>
* cdl/net.cdl: Added addr_tests to the HW tests.
* tests/addr_test.c (net_test): void function not int.
* tests/ping_test.c (net_test): Added IPv6 ping test. This pings
the router which answers our router solicit message.
* src/ipv6_routing_thread.c (cyg_rs): Print out the router
advertisement message. Cleaned up the debug messages so they can
be disabled.
* src/ipv6_routing_thread.c (cyg_net_get_ipv6_advrouter): New
function to return the address of the router.
* include/network.h: Added prototype for above and
ipv6_start_routing_thread which did not have a prototype.
* src/ipv6_routing_thread.c (cyg_rs): Only wait 2 seconds before
sending the first solicit request rather than 10.
* src/dhcp_prot.c (do_dhcp_down_net): clear the if_laddrreq
before using it. If the request fails finish the IPv4 code rather
than returning,.
2003-04-02 Andrew Lunn <andrew.lunn@ascom.ch>
* tests/ping_lo_test.c: Added IPv6 ping test.
* src/getproto.c: Added the protocol ipv6-icmp.
| author | asl |
|---|---|
| date | Wed, 23 Apr 2003 08:52:08 +0000 |
| parents | e0c0827131d1 |
| children |
comparison
equal
deleted
inserted
replaced
| 956:d9b26cfc0657 | 957:db3e0a2fda2f |
|---|---|
| 79 } | 79 } |
| 80 | 80 |
| 81 static void | 81 static void |
| 82 tftp_test(struct bootp *bp) | 82 tftp_test(struct bootp *bp) |
| 83 { | 83 { |
| 84 int server_id, res; | 84 int res; |
| 85 int server1_id = 0; | |
| 86 int server2_id = 0; | |
| 87 int server3_id = 0; | |
| 88 | |
| 85 extern struct tftpd_fileops dummy_fileops; | 89 extern struct tftpd_fileops dummy_fileops; |
| 86 server_id = tftpd_start(0, &dummy_fileops); | 90 |
| 87 if (server_id > 0) { | 91 server1_id = tftpd_start(0, &dummy_fileops); |
| 88 diag_printf("TFTP server created - id: %x\n", server_id); | 92 if (server1_id > 0) { |
| 89 // Only let the server run for 5 minutes | 93 diag_printf("TFTP server created - id: %x\n", server1_id); |
| 90 cyg_thread_delay(2*100); // let the tftpd start up first | |
| 91 TNR_ON(); | |
| 92 cyg_thread_delay(5*60*100); | |
| 93 TNR_OFF(); | |
| 94 res = tftpd_stop(server_id); | |
| 95 diag_printf("TFTP server stopped - res: %d\n", res); | |
| 96 } else { | 94 } else { |
| 97 diag_printf("Couldn't create a server!\n"); | 95 diag_printf("Couldn't create first server!\n"); |
| 98 } | 96 } |
| 99 } | 97 |
| 98 #ifdef CYGSEM_NET_TFTPD_MULTITHREADED | |
| 99 server2_id = tftpd_start(0, &dummy_fileops); | |
| 100 if (server2_id > 0) { | |
| 101 diag_printf("Second TFTP server created - id: %x\n", server2_id); | |
| 102 } else { | |
| 103 diag_printf("Couldn't create a second server!\n"); | |
| 104 } | |
| 105 #if CYGNUM_NET_TFTPD_MULTITHREADED_PORTS > 1 | |
| 106 server3_id = tftpd_start(1025, &dummy_fileops); | |
| 107 if (server3_id > 0) { | |
| 108 diag_printf("Third TFTP server created - id: %x\n", server3_id); | |
| 109 } else { | |
| 110 diag_printf("Couldn't create a third server!\n"); | |
| 111 } | |
| 112 #endif //CYGNUM_NET_TFTPD_MULTITHREADED_PORTS > 1 | |
| 113 #else //CYGSEM_NET_TFTPD_MULTITHREADED | |
| 114 server2_id = tftpd_start(1025, &dummy_fileops); | |
| 115 if (server2_id > 0) { | |
| 116 diag_printf("Second TFTP server created - id: %x\n", server2_id); | |
| 117 } else { | |
| 118 diag_printf("Couldn't create a second server!\n"); | |
| 119 } | |
| 120 #endif //!CYGSEM_NET_TFTPD_MULTITHREADED | |
| 121 | |
| 122 // Only let the server run for 5 minutes | |
| 123 cyg_thread_delay(2*100); // let the tftpd start up first | |
| 124 TNR_ON(); | |
| 125 cyg_thread_delay(5*60*100); | |
| 126 TNR_OFF(); | |
| 127 | |
| 128 if (server1_id > 0) { | |
| 129 res = tftpd_stop(server1_id); | |
| 130 diag_printf("TFTP server - id: %x stopped - res: %d\n", server1_id, res); | |
| 131 } | |
| 132 if (server2_id > 0) { | |
| 133 res = tftpd_stop(server2_id); | |
| 134 diag_printf("TFTP server - id: %x stopped - res: %d\n", server2_id, res); | |
| 135 } | |
| 136 if (server3_id > 0) { | |
| 137 res = tftpd_stop(server2_id); | |
| 138 diag_printf("TFTP server - id: %x stopped - res: %d\n", server2_id, res); | |
| 139 } | |
| 140 } | |
| 100 | 141 |
| 101 void | 142 void |
| 102 net_test(cyg_addrword_t param) | 143 net_test(cyg_addrword_t param) |
| 103 { | 144 { |
| 104 diag_printf("Start TFTP server test\n"); | 145 diag_printf("Start TFTP server test\n"); |
