# HG changeset patch # User jlarmour # Date 1051141537 0 # Node ID 699b9301a23529d5a67feb3b697e4d93fc1f76a9 # Parent e6231465742f7b65dde9d7dd1779c151aef393c4 * doc/tcpip.sgml: Fix some docbook errors only reported by certain Jade versions. diff --git a/packages/net/common/current/ChangeLog b/packages/net/common/current/ChangeLog --- a/packages/net/common/current/ChangeLog +++ b/packages/net/common/current/ChangeLog @@ -1,3 +1,8 @@ +2003-04-24 Jonathan Larmour + + * doc/tcpip.sgml: Fix some docbook errors only reported by certain + Jade versions. + 2003-04-12 Andrew Lunn * src/network_support.c (init_loopback_interface): Close the diff --git a/packages/net/common/current/doc/tcpip.sgml b/packages/net/common/current/doc/tcpip.sgml --- a/packages/net/common/current/doc/tcpip.sgml +++ b/packages/net/common/current/doc/tcpip.sgml @@ -418,9 +418,9 @@ it — or it comes pre-set from the TFTP The TFTP client and server are described in tftp_support.h; - -The TFTP client has and new and an older, depreciated, API. The -new API works for both IPv4 and IPv6 where as the depreciated API is + +The TFTP client has and new and an older, deprecated, API. The +new API works for both IPv4 and IPv6 where as the deprecated API is IPv4 only. @@ -449,7 +449,7 @@ the client connects to the default TFTP the specified port is used. -The depreciated API is: +The deprecated API is: int tftp_client_get(char *filename, struct sockaddr_in *server, char *buf, @@ -464,6 +464,7 @@ int tftp_client_put(char *filename, int mode, int *err); + The server should contain the address of the server to contact. If the sin_port member of the @@ -508,6 +509,7 @@ describing the filesystem is an argument int tftp_start(int port, struct tftpd_fileops *ops); + The first argument is the port to use for the server. If this port number is zero, the default TFTP port number will be used. The return value from tftpd_start is a handle which diff --git a/packages/net/common/current/tests/nc_test_framework.h b/packages/net/common/current/tests/nc_test_framework.h --- a/packages/net/common/current/tests/nc_test_framework.h +++ b/packages/net/common/current/tests/nc_test_framework.h @@ -73,9 +73,6 @@ typedef void *test_param_t; #define NC_TESTING_SLAVE_PORT 8770 #define NC_TESTING_MASTER_PORT 8771 -#define __string(s) #s -#define _string(s) __string(s) - // // The basic idea behind this test structure is that one end will run // in "slave" mode and the other in "master" mode. Typically, the slave diff --git a/packages/net/common/current/tests/ping_lo_test.c b/packages/net/common/current/tests/ping_lo_test.c --- a/packages/net/common/current/tests/ping_lo_test.c +++ b/packages/net/common/current/tests/ping_lo_test.c @@ -19,7 +19,7 @@ //#####DESCRIPTIONBEGIN#### // // Author(s): gthomas, sorin@netappi.com -// Contributors: gthomas, sorin@netappi.com, andrew.lunn@ascom.ch +// Contributors: gthomas, sorin@netappi.com, andrew.lunn@ascom.ch, jlarmour // Date: 2000-01-10 // Purpose: // Description: @@ -37,6 +37,13 @@ #include #endif +#include +#include + +#include +#include +#include + #include #ifndef CYGPKG_LIBC_STDIO @@ -128,7 +135,7 @@ show_icmp(unsigned char *pkt, int len, return (from->sin_addr.s_addr == to->sin_addr.s_addr); } -static void +static int ping_host(int s, struct sockaddr_in *host) { struct icmp *icmp = (struct icmp *)pkt1; @@ -177,6 +184,7 @@ ping_host(int s, struct sockaddr_in *hos } } diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); + return ok_recv; } static void @@ -185,7 +193,7 @@ ping_test_loopback( int lo ) struct protoent *p; struct timeval tv; struct sockaddr_in host; - int s; + int s, ok_recv; if ((p = getprotobyname("icmp")) == (struct protoent *)0) { perror("getprotobyname"); @@ -204,10 +212,14 @@ ping_test_loopback( int lo ) host.sin_len = sizeof(host); host.sin_addr.s_addr = htonl(INADDR_LOOPBACK + (0x100 * lo)); host.sin_port = 0; - ping_host(s, &host); + CYG_TEST_INFO("Pinging valid host"); + ok_recv = ping_host(s, &host); + // check acceptable ping level - loopback should have 0 loss + CYG_TEST_PASS_FAIL( ok_recv == NUM_PINGS, "Good packets acceptable" ); // Now try a bogus host - host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); - ping_host(s, &host); + host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + NLOOP + 10); + ok_recv = ping_host(s, &host); + CYG_TEST_PASS_FAIL( ok_recv == 0, "No packets should be received" ); } #ifdef CYGPKG_NET_INET6 @@ -358,7 +370,9 @@ void net_test(cyg_addrword_t p) { int i; - diag_printf("Start PING test\n"); + + CYG_TEST_INIT(); + CYG_TEST_INFO("Start loopback PING test"); init_all_network_interfaces(); #if NLOOP > 0 @@ -366,13 +380,14 @@ net_test(cyg_addrword_t p) ping_test_loopback( i ); for ( i = 0; i < NLOOP; i++ ) ping_test_loopback( i ); -#ifdef CYGPKG_NET_INET6 +# ifdef CYGPKG_NET_INET6 for ( i = 0; i < NLOOP; i++ ) ping6_test_loopback( i ); +# endif + CYG_TEST_FINISH( "Done pinging loopback" ); // FIXMEJIFL +#else + CYG_TEST_NA( "No loopback interfaces" ); #endif - CYG_TEST_PASS_FINISH( "Done pinging loopback" ); -#endif - CYG_TEST_NA( "No loopback devs" ); } void @@ -393,3 +408,5 @@ cyg_start(void) cyg_thread_resume(thread_handle); // Start it cyg_scheduler_start(); } + +// EOF ping_lo_test.c diff --git a/packages/net/common/current/tests/ping_test.c b/packages/net/common/current/tests/ping_test.c --- a/packages/net/common/current/tests/ping_test.c +++ b/packages/net/common/current/tests/ping_test.c @@ -40,6 +40,10 @@ #include #include +#include +#include +#include + #include #ifdef CYGBLD_DEVS_ETH_DEVICE_H // Get the device config if it exists @@ -163,7 +167,7 @@ show_icmp(unsigned char *pkt, int len, return (from->sin_addr.s_addr == to->sin_addr.s_addr); } -static void +static int ping_host(int s, struct sockaddr_in *host) { struct icmp *icmp = (struct icmp *)pkt1; @@ -217,6 +221,7 @@ ping_host(int s, struct sockaddr_in *hos } TNR_OFF(); diag_printf("Sent %d packets, received %d OK, %d bad\n", NUM_PINGS, ok_recv, bogus_recv); + return ok_recv; } #ifdef CYGPKG_NET_INET6 @@ -370,7 +375,7 @@ ping_test(struct bootp *bp) struct protoent *p; struct timeval tv; struct sockaddr_in host; - int s; + int s, ok_recv; if ((p = getprotobyname("icmp")) == (struct protoent *)0) { pexit("getprotobyname"); @@ -389,10 +394,17 @@ ping_test(struct bootp *bp) host.sin_len = sizeof(host); host.sin_addr = bp->bp_siaddr; host.sin_port = 0; - ping_host(s, &host); + CYG_TEST_INFO("Pinging valid host"); + ok_recv = ping_host(s, &host); + // check acceptable ping level - allow 10% loss + CYG_TEST_PASS_FAIL( ok_recv + (NUM_PINGS/10) >= NUM_PINGS, + "Good packets acceptable" ); // Now try a bogus host - host.sin_addr.s_addr = htonl(ntohl(host.sin_addr.s_addr) + 32); - ping_host(s, &host); + CYG_TEST_INFO("Pinging bogus host"); + host.sin_addr.s_addr = inet_addr("10.10.10.10"); + ok_recv = ping_host(s, &host); + // should be 0 packets + CYG_TEST_PASS_FAIL( ok_recv == 0, "No packets should be received" ); } void @@ -401,19 +413,24 @@ net_test(cyg_addrword_t p) #ifdef CYGPKG_NET_INET6 struct sockaddr_in6 ipv6router; #endif + int something_tested=0; - diag_printf("Start PING test\n"); + CYG_TEST_INIT(); + CYG_TEST_INFO("Start PING test"); + TNR_INIT(); init_all_network_interfaces(); #ifdef CYGHWR_NET_DRIVER_ETH0 if (eth0_up) { ping_test(ð0_bootp_data); } + something_tested++; #endif #ifdef CYGHWR_NET_DRIVER_ETH1 if (eth1_up) { ping_test(ð1_bootp_data); } + something_tested++; #endif #ifdef CYGPKG_NET_INET6 if (cyg_net_get_ipv6_advrouter(&ipv6router)) { @@ -423,7 +440,11 @@ net_test(cyg_addrword_t p) } #endif TNR_PRINT_ACTIVITY(); - CYG_TEST_PASS_FINISH("Ping test OK"); + if (!something_tested) { + CYG_TEST_NA("No interfaces found to be tested"); + } else { + CYG_TEST_FINISH("Ping test"); + } } void @@ -442,3 +463,5 @@ cyg_start(void) cyg_thread_resume(thread_handle); // Start it cyg_scheduler_start(); } + +// EOF ping_test.c