diff options
| author | Michael Brown | 2006-08-07 20:49:10 +0200 |
|---|---|---|
| committer | Michael Brown | 2006-08-07 20:49:10 +0200 |
| commit | 010288577f8b98ee87a37aade9dc521c618fc8ef (patch) | |
| tree | 25383cbc9b1870d761ffc3dab84aa89c71ee6572 /src/tests/dhcptest.c | |
| parent | Fix routing when a gateway exists. This should probably be split into (diff) | |
| download | ipxe-010288577f8b98ee87a37aade9dc521c618fc8ef.tar.gz ipxe-010288577f8b98ee87a37aade9dc521c618fc8ef.tar.xz ipxe-010288577f8b98ee87a37aade9dc521c618fc8ef.zip | |
Add very, very quick and dirty hello world test
Diffstat (limited to 'src/tests/dhcptest.c')
| -rw-r--r-- | src/tests/dhcptest.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/tests/dhcptest.c b/src/tests/dhcptest.c index ced38a5ae..4bb2e11ec 100644 --- a/src/tests/dhcptest.c +++ b/src/tests/dhcptest.c @@ -13,8 +13,7 @@ static int test_dhcp_aoe_boot ( struct net_device *netdev, return test_aoeboot ( netdev, aoename, drivenum ); } -static int test_dhcp_iscsi_boot ( struct net_device *netdev __unused, - char *iscsiname ) { +static int test_dhcp_iscsi_boot ( char *iscsiname ) { char *initiator_iqn = "iqn.1900-01.localdomain.localhost:initiator"; char *target_iqn; union { @@ -36,11 +35,35 @@ static int test_dhcp_iscsi_boot ( struct net_device *netdev __unused, return test_iscsiboot ( initiator_iqn, &target.st, target_iqn ); } +static int test_dhcp_hello ( char *helloname ) { + char *message; + union { + struct sockaddr_in sin; + struct sockaddr_tcpip st; + } target; + + memset ( &target, 0, sizeof ( target ) ); + target.sin.sin_family = AF_INET; + target.sin.sin_port = htons ( 80 ); + message = strchr ( helloname, ':' ); + *message++ = '\0'; + if ( ! message ) { + printf ( "Invalid hello path\n" ); + return -EINVAL; + } + inet_aton ( helloname, &target.sin.sin_addr ); + + test_hello ( &target.st, message ); + return 0; +} + static int test_dhcp_boot ( struct net_device *netdev, char *filename ) { if ( strncmp ( filename, "aoe:", 4 ) == 0 ) { return test_dhcp_aoe_boot ( netdev, &filename[4] ); } else if ( strncmp ( filename, "iscsi:", 6 ) == 0 ) { - return test_dhcp_iscsi_boot ( netdev, &filename[6] ); + return test_dhcp_iscsi_boot ( &filename[6] ); + } else if ( strncmp ( filename, "hello:", 6 ) == 0 ) { + return test_dhcp_hello ( &filename[6] ); } else { printf ( "Don't know how to boot %s\n", filename ); return -EPROTONOSUPPORT; |
