From: Radek Pazdera rpazdera@redhat.com
This patch series contains several small updates of multicast tests. The older recipe and command sequences were adapted to recent changes in NetTestParser.
A couple of minor bugs and typing errors was fixed as well.
Radek Pazdera (5): multicast: Moved IGMP parameters to separate file multicast: Adding igmp options to TestMulticast.py multicast: recv_block_source reporting fix multicast: Convert recipe_eval to newer convention multicast: Fix endianess bug
Tests/TestMulticast.py | 5 + .../cmd_sequences/multicast/block_source.xml | 10 +- example_recipes/cmd_sequences/multicast/if.xml | 38 ++-- example_recipes/cmd_sequences/multicast/loop.xml | 36 ++-- .../cmd_sequences/multicast/max_groups.xml | 9 +- .../cmd_sequences/multicast/membership.xml | 18 +- example_recipes/cmd_sequences/multicast/simple.xml | 19 +- .../cmd_sequences/multicast/source_membership.xml | 38 ++-- example_recipes/cmd_sequences/multicast/ttl.xml | 54 ++-- example_recipes/rpazdera-multicast.xml | 22 ++- test_tools/multicast/igmp_utils.h | 2 +- test_tools/multicast/multicast_utils.h | 2 +- .../multicast/offline/sockopt_block_source.c | 32 +-- test_tools/multicast/offline/sockopt_if.c | 10 +- test_tools/multicast/offline/sockopt_membership.c | 18 +- .../multicast/offline/sockopt_source_membership.c | 30 +- test_tools/multicast/parameters.h | 287 -------------------- test_tools/multicast/parameters_igmp.h | 154 +++++++++++ test_tools/multicast/parameters_multicast.h | 192 +++++++++++++ test_tools/multicast/server/recv_block_source.c | 15 +- 20 files changed, 534 insertions(+), 457 deletions(-) delete mode 100644 test_tools/multicast/parameters.h create mode 100644 test_tools/multicast/parameters_igmp.h create mode 100644 test_tools/multicast/parameters_multicast.h
From: Radek Pazdera rpazdera@redhat.com
The original parameters.h was getting too heavy, there was more macros than code. The file was split it into
* parameters_igmp.h * parameters_multicast.h
Also some code cleanup was done.
Signed-off-by: Radek Pazdera rpazdera@redhat.com --- test_tools/multicast/igmp_utils.h | 2 +- test_tools/multicast/multicast_utils.h | 2 +- test_tools/multicast/parameters.h | 287 --------------------------- test_tools/multicast/parameters_igmp.h | 154 ++++++++++++++ test_tools/multicast/parameters_multicast.h | 192 ++++++++++++++++++ 5 files changed, 348 insertions(+), 289 deletions(-) delete mode 100644 test_tools/multicast/parameters.h create mode 100644 test_tools/multicast/parameters_igmp.h create mode 100644 test_tools/multicast/parameters_multicast.h
diff --git a/test_tools/multicast/igmp_utils.h b/test_tools/multicast/igmp_utils.h index 901d01f..125232b 100644 --- a/test_tools/multicast/igmp_utils.h +++ b/test_tools/multicast/igmp_utils.h @@ -43,7 +43,7 @@ #include <linux/igmp.h>
#define IGMP -#include "parameters.h" +#include "parameters_igmp.h"
int __verbosity = 0;
diff --git a/test_tools/multicast/multicast_utils.h b/test_tools/multicast/multicast_utils.h index 25d0c38..70fcf59 100644 --- a/test_tools/multicast/multicast_utils.h +++ b/test_tools/multicast/multicast_utils.h @@ -43,7 +43,7 @@ #error "At least one of SEND/RECEIVE macros must be defined!" #endif
-#include "parameters.h" +#include "parameters_multicast.h"
#define MESSAGE "Hello world!"
diff --git a/test_tools/multicast/parameters.h b/test_tools/multicast/parameters.h deleted file mode 100644 index a9fda9d..0000000 --- a/test_tools/multicast/parameters.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - * parameters.h - common code for parsing sender/receiver parameters - * Copyright (C) 2012 Red Hat Inc. - * - * Author: Radek Pazdera (rpazdera@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - * 02110-1301, USA. - */ - -#ifndef __PARAMETERS_H__ -#define __PARAMETERS_H__ - -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#include <netinet/in.h> -#include <sys/types.h> -#include <sys/socket.h> - -#include <signal.h> -#include <time.h> - -#include <getopt.h> -#include <stdlib.h> -#include <unistd.h> - -extern int __verbosity; - -#ifdef IGMP -enum __igmp_query_types { - IGMP_GENERAL_QUERY = 1, - IGMP_GROUP_SPECIFIC_QUERY = 2, - IGMP_GROUP_AND_SOURCE_SPECIFIC_QUERY = 3 -}; -#endif - -/** Structure that carries test parameters */ -struct parameters -{ - int duration; /* seconds */ - - struct in_addr multiaddr; - short port; - struct in_addr interface; - -#if defined(RECEIVE) || defined(IGMP) - struct in_addr sourceaddr; -#endif - -#ifdef SEND - double delay; - int ttl; - int loop; -#endif - -#ifdef IGMP - short query_type; - struct in_addr destaddr; - int max_resp_time; -#endif -}; - -/** Initialize parameters struct with default values. */ -void default_parameters(struct parameters* params) -{ - params->duration = 10; - params->port = 0; - memset(¶ms->multiaddr, 0, sizeof(struct in_addr)); - memset(¶ms->interface, 0, sizeof(struct in_addr)); - -#if defined(RECEIVE) || defined(IGMP) - memset(¶ms->sourceaddr, 0, sizeof(struct in_addr)); -#endif - -#ifdef SEND - params->delay = 0.1; - params->ttl = 1; - params->loop = 1; -#endif - -#ifdef IGMP - params->query_type = IGMP_GENERAL_QUERY; - memset(¶ms->destaddr, 0, sizeof(struct in_addr)); - params->max_resp_time = 10; -#endif -} - -void usage(char *program_name, int retval) -{ - printf("usage: %s\n", program_name); - printf(" -h | --help print this\n"); - printf(" -i | --interface a.b.c.d local interface to use for communication\n"); - printf(" -v | --verbose print additional information during the runtime\n"); - - printf("\n"); - - printf(" -d | --duration x test duration\n"); - -#ifdef SEND - printf(" -f | --delay x delay between messages\n"); -#endif - - printf("\n"); - - printf(" -a | --address a.b.c.d multicast group address\n"); - -#if defined(SEND) || defined(IGMP) - printf(" -s | --source_address a.b.c.d source address\n"); -#endif - -#ifdef IGMP - printf(" -z | --dest_address a.b.c.d destination address\n"); -#endif - -#if defined(SEND) || defined(RECEIVE) - printf(" -p | --port x port number\n"); -#endif - - printf("\n"); - -#ifdef IGMP - printf(" -q | --query_type query type\n"); - printf(" -r | --max_resp_time x maximum response time\n"); -#endif - -#ifdef SEND - printf(" -t | --ttl x time to live for IP packet\n"); - printf(" -l | --loop x loopback multicast communication\n"); -#endif - - exit(retval); -} - -/** Generic function for parsing arguments */ -void parse_args(int argc, char** argv, struct parameters* args) -{ -#ifdef SEND - #define __send_opts "f:t:l:p:" -#else - #define __send_opts "" -#endif - -#if defined(RECEIVE) || defined(IGMP) - #define __recv_opts "s:p:" -#else - #define __recv_opts "" -#endif - -#ifdef IGMP - #define __igmp_opts "q:z:r:" -#else - #define __igmp_opts "" -#endif - -#ifdef IGMP - int dest_was_set = 0; -#endif - - static const char* opts = "d:a:i:v" __send_opts __recv_opts - __igmp_opts; - - - static struct option long_options[] = - { - {"help", required_argument, NULL, 'h'}, - {"interface", required_argument, NULL, 'i'}, - {"verbose", no_argument, NULL, 'v'}, - {"duration", required_argument, NULL, 'd'}, - {"multicast_address", required_argument, NULL, 'a'}, - -#if defined(RECEIVE) || defined(IGMP) - {"source_address", required_argument, NULL, 's'}, -#endif - -#ifdef SEND - {"delay", required_argument, NULL, 'f'}, - {"ttl", required_argument, NULL, 't'}, - {"loop", required_argument, NULL, 'l'}, -#endif - -#if defined(SEND) || defined(RECEIVE) - {"port", required_argument, NULL, 'p'}, -#endif - -#ifdef IGMP - {"query_type", required_argument, NULL, 'q'}, - {"dest_address", required_argument, NULL, 'z'}, - {"max_resp_time", required_argument, NULL, 'r'}, - -#endif - {0, 0, NULL, 0} - }; - - default_parameters(args); - - int opt; - int option_index = 0; - while((opt = getopt_long(argc, argv, opts, long_options, - &option_index)) != -1) { - switch (opt) { - case 'd': - args->duration = atoi(optarg); - break; - case 'a': - inet_pton(AF_INET, optarg, &(args->multiaddr)); - break; - case 'p': - args->port = atoi(optarg); - break; - case 'h': - usage(argv[1], EXIT_SUCCESS); - break; - case 'i': - inet_pton(AF_INET, optarg, &(args->interface)); - break; - case 'v': - __verbosity = 1; - break; -#if defined(RECEIVE) || defined(IGMP) - case 's': - inet_pton(AF_INET, optarg, &(args->sourceaddr)); - break; -#endif - -#ifdef SEND - case 'f': - args->delay = atof(optarg); - break; - case 't': - args->ttl = atoi(optarg); - break; - case 'l': - args->loop = atoi(optarg); - break; -#endif - -#ifdef IGMP - case 'q': - args->query_type = atoi(optarg); - /*if (strcmp(optarg, "general") == 0) { - args->query_type = IGMP_GENERAL_QUERY; - } else if (strcmp(optarg, "group_specific") == 0) { - args->query_type = IGMP_GROUP_SPECIFIC_QUERY; - } else if (strcmp(optarg, "group_and_source_specific") == 0) { - args->query_type = IGMP_GROUP_AND_SOURCE_SPECIFIC_QUERY; - } else { - fprintf(stderr, "%s: undefined query type\n", - argv[0]); - exit(EXIT_FAILURE); - }*/ - break; - case 'z': - inet_pton(AF_INET, optarg, &(args->destaddr)); - dest_was_set = 1; - break; - case 'r': - args->max_resp_time = atoi(optarg); - break; -#endif - default: /* '?' */ - fprintf(stderr, "%s: invalid test options\n", argv[0]); - usage(argv[0], EXIT_FAILURE); - } - } - -#ifdef IGMP - if (!dest_was_set) - args->destaddr = args->multiaddr; -#endif - -} - -#endif diff --git a/test_tools/multicast/parameters_igmp.h b/test_tools/multicast/parameters_igmp.h new file mode 100644 index 0000000..31a9c87 --- /dev/null +++ b/test_tools/multicast/parameters_igmp.h @@ -0,0 +1,154 @@ +/* + * parameters_igmp.h - common code for parsing sender/receiver parameters + * Copyright (C) 2012 Red Hat Inc. + * + * Author: Radek Pazdera (rpazdera@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#ifndef __PARAMETERS_IGMP_H__ +#define __PARAMETERS_IGMP_H__ + +#include <stdio.h> +#include <string.h> +#include <errno.h> + +#include <netinet/in.h> +#include <sys/types.h> +#include <sys/socket.h> + +#include <signal.h> +#include <time.h> + +#include <getopt.h> +#include <stdlib.h> +#include <unistd.h> + +extern int __verbosity; + +enum __igmp_query_types { + IGMP_GENERAL_QUERY = 1, + IGMP_GROUP_SPECIFIC_QUERY = 2, + IGMP_GROUP_AND_SOURCE_SPECIFIC_QUERY = 3 +}; + +/** Structure that carries test parameters */ +struct parameters +{ + struct in_addr multiaddr; + struct in_addr interface; + + short query_type; + struct in_addr sourceaddr; + struct in_addr destaddr; + int max_resp_time; +}; + +/** Initialize parameters struct with default values. */ +void default_parameters(struct parameters* params) +{ + memset(¶ms->multiaddr, 0, sizeof(struct in_addr)); + memset(¶ms->interface, 0, sizeof(struct in_addr)); + + params->query_type = IGMP_GENERAL_QUERY; + memset(¶ms->sourceaddr, 0, sizeof(struct in_addr)); + memset(¶ms->destaddr, 0, sizeof(struct in_addr)); + params->max_resp_time = 0; +} + +void usage(char *program_name, int retval) +{ + printf("usage: %s\n", program_name); + printf(" -h | --help print this\n"); + printf(" -v | --verbose print additional information during the runtime\n"); + printf(" -i | --interface a.b.c.d local interface to use for communication\n"); + + printf("\n"); + + printf(" -a | --multicast_address a.b.c.d multicast group address (v2 and v3 only)\n"); + printf(" -s | --source_address a.b.c.d multicast source (v3 only)\n"); + printf(" -d | --dest_address a.b.c.d destination address of the IP packet\n"); + + printf("\n"); + + printf(" -q | --query_type query type [1,2,3]\n"); + printf(" -r | --max_resp_time x maximum response time\n"); + exit(retval); +} + +/** Generic function for parsing arguments */ +void parse_args(int argc, char** argv, struct parameters* args) +{ + int dest_was_set = 0; + + static const char* opts = "i:a:q:s:d:r:hv"; + static struct option long_options[] = + { + {"interface", required_argument, NULL, 'i'}, + {"multicast_address", required_argument, NULL, 'a'}, + {"query_type", required_argument, NULL, 'q'}, + {"source_address", required_argument, NULL, 's'}, + {"dest_address", required_argument, NULL, 'd'}, + {"max_resp_time", required_argument, NULL, 'r'}, + {"help", no_argument, NULL, 'h'}, + {"verbose", no_argument, NULL, 'v'}, + {0, 0, NULL, 0} + }; + + default_parameters(args); + + int opt; + int option_index = 0; + while((opt = getopt_long(argc, argv, opts, long_options, + &option_index)) != -1) { + switch (opt) { + case 'i': + inet_pton(AF_INET, optarg, &(args->interface)); + break; + case 'a': + inet_pton(AF_INET, optarg, &(args->multiaddr)); + break; + case 'q': + args->query_type = atoi(optarg); + break; + case 's': + inet_pton(AF_INET, optarg, &(args->sourceaddr)); + break; + case 'd': + inet_pton(AF_INET, optarg, &(args->destaddr)); + dest_was_set = 1; + break; + case 'r': + args->max_resp_time = atoi(optarg); + break; + case 'h': + usage(argv[0], EXIT_SUCCESS); + break; + case 'v': + __verbosity = 1; + break; + default: /* '?' */ + fprintf(stderr, "%s: invalid options\n", argv[0]); + usage(argv[0], EXIT_FAILURE); + } + } + + if (!dest_was_set) + args->destaddr = args->multiaddr; +} + +#endif diff --git a/test_tools/multicast/parameters_multicast.h b/test_tools/multicast/parameters_multicast.h new file mode 100644 index 0000000..ecaaf79 --- /dev/null +++ b/test_tools/multicast/parameters_multicast.h @@ -0,0 +1,192 @@ +/* + * parameters_multicast.h - common code for parsing sender/receiver + * parameters + * Copyright (C) 2012 Red Hat Inc. + * + * Author: Radek Pazdera (rpazdera@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#ifndef __PARAMETERS_MULTICAST_H__ +#define __PARAMETERS_MULTICAST_H__ + +#include <stdio.h> +#include <string.h> +#include <errno.h> + +#include <netinet/in.h> +#include <sys/types.h> +#include <sys/socket.h> + +#include <signal.h> +#include <time.h> + +#include <getopt.h> +#include <stdlib.h> +#include <unistd.h> + +extern int __verbosity; + +/** Structure that carries test parameters */ +struct parameters +{ + struct in_addr multiaddr; + struct in_addr interface; + + int duration; /* seconds */ + short port; + +#ifdef RECEIVE + struct in_addr sourceaddr; +#endif + +#ifdef SEND + double delay; + int ttl; + int loop; +#endif +}; + +/** Initialize parameters struct with default values. */ +void default_parameters(struct parameters* params) +{ + params->duration = 0; + params->port = 0; + memset(¶ms->multiaddr, 0, sizeof(struct in_addr)); + memset(¶ms->interface, 0, sizeof(struct in_addr)); +#ifdef RECEIVE + memset(¶ms->sourceaddr, 0, sizeof(struct in_addr)); +#endif +#ifdef SEND + params->delay = 0.1; + params->ttl = 1; + params->loop = 1; +#endif +} + +void usage(char *program_name, int retval) +{ + printf("usage: %s\n", program_name); + printf(" -h | --help print this\n"); + printf(" -v | --verbose print additional information during the runtime\n"); + printf(" -i | --interface a.b.c.d local interface to use for communication\n"); + printf(" -d | --duration x test duration\n"); + + printf("\n"); + + printf(" -a | --multicast_address a.b.c.d multicast group address\n"); +#ifdef RECEIVE + printf(" -s | --source_address a.b.c.d multicast source (for SSM)\n"); +#endif + printf(" -p | --port x port number\n"); +#ifdef SEND + printf("\n"); + + printf(" -t | --ttl x time to live for IP packet\n"); + printf(" -l | --loop x loopback multicast communication\n"); + printf(" -f | --delay x delay between messages\n"); +#endif + + exit(retval); +} + +/** Generic function for parsing arguments */ +void parse_args(int argc, char** argv, struct parameters* args) +{ +#ifdef SEND + #define __send_opts "f:t:l:" +#else + #define __send_opts "" +#endif + +#ifdef RECEIVE + #define __recv_opts "s:" +#else + #define __recv_opts "" +#endif + + static const char* opts = __send_opts __recv_opts "d:a:p:i:hv"; + + + static struct option long_options[] = + { +#ifdef SEND + {"delay", required_argument, NULL, 'f'}, + {"ttl", required_argument, NULL, 't'}, + {"loop", required_argument, NULL, 'l'}, +#endif +#ifdef RECEIVE + {"source_address", required_argument, NULL, 's'}, +#endif + {"duration", required_argument, NULL, 'd'}, + {"multicast_address", required_argument, NULL, 'a'}, + {"port", required_argument, NULL, 'p'}, + {"interface", required_argument, NULL, 'i'}, + {"help", no_argument, NULL, 'h'}, + {"verbose", no_argument, NULL, 'v'}, + {0, 0, NULL, 0} + }; + + default_parameters(args); + + int opt; + int option_index = 0; + while((opt = getopt_long(argc, argv, opts, long_options, + &option_index)) != -1) { + switch (opt) { +#ifdef SEND + case 'f': + args->delay = atof(optarg); + break; + case 't': + args->ttl = atoi(optarg); + break; + case 'l': + args->loop = atoi(optarg); + break; +#endif +#ifdef RECEIVE + case 's': + inet_pton(AF_INET, optarg, &(args->sourceaddr)); + break; +#endif + case 'd': + args->duration = atoi(optarg); + break; + case 'a': + inet_pton(AF_INET, optarg, &(args->multiaddr)); + break; + case 'p': + args->port = atoi(optarg); + break; + case 'i': + inet_pton(AF_INET, optarg, &(args->interface)); + break; + case 'h': + usage(argv[0], EXIT_SUCCESS); + break; + case 'v': + __verbosity = 1; + break; + default: /* '?' */ + fprintf(stderr, "%s: invalid options\n", argv[0]); + usage(argv[0], EXIT_FAILURE); + } + } +} + +#endif
From: Radek Pazdera rpazdera@redhat.com
There are some new test options after splitting multicast and igmp parameters, so take them in account.
Signed-off-by: Radek Pazdera rpazdera@redhat.com --- Tests/TestMulticast.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Tests/TestMulticast.py b/Tests/TestMulticast.py index 4710f89..5e2df5b 100644 --- a/Tests/TestMulticast.py +++ b/Tests/TestMulticast.py @@ -55,6 +55,11 @@ class TestMulticast(TestGeneric): # receiver-specific opts["source_address"] = self._remove_mask(self.get_opt("source"))
+ # igmp-specific + opts["query_type"] = self.get_opt("query_type") + opts["dest_address"] = self.get_opt("dest_address") + opts["max_resp_time"] = self.get_opt("max_resp_time") + cmd = "./{0} ".format(setup)
for optname, optval in opts.iteritems():
From: Radek Pazdera rpazdera@redhat.com
Small fix in recv_block_source setup. The 'packets_sent' report was printed twice, which lead to correct, but inaccurate stats.
Signed-off-by: Radek Pazdera rpazdera@redhat.com --- test_tools/multicast/server/recv_block_source.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/test_tools/multicast/server/recv_block_source.c b/test_tools/multicast/server/recv_block_source.c index 6e2f462..9edcb80 100644 --- a/test_tools/multicast/server/recv_block_source.c +++ b/test_tools/multicast/server/recv_block_source.c @@ -32,7 +32,9 @@ int main(int argc, char** argv)
int sockfd = init_in_socket(params.multiaddr, params.port);
- int num_recv = 0; + int num_good = 0; + int num_bad = 0; + struct ip_mreq mreq; mreq.imr_multiaddr = params.multiaddr; mreq.imr_interface = params.interface; @@ -49,8 +51,7 @@ int main(int argc, char** argv) return -1; }
- num_recv = wait_for_data(sockfd, params.duration/3, 0); - printf("packets_received=%d\n", num_recv); + num_good += wait_for_data(sockfd, params.duration/3, 0);
if (setsockopt(sockfd, IPPROTO_IP, IP_BLOCK_SOURCE, &(mreqs), sizeof(mreqs)) < 0) @@ -59,8 +60,7 @@ int main(int argc, char** argv) return -1; }
- num_recv = wait_for_data(sockfd, params.duration/3, 0); - printf("packets_received_while_blocking=%d\n", num_recv); + num_bad += wait_for_data(sockfd, params.duration/3, 0);
if (setsockopt(sockfd, IPPROTO_IP, IP_UNBLOCK_SOURCE, &(mreqs), sizeof(mreqs)) < 0) @@ -69,8 +69,9 @@ int main(int argc, char** argv) return -1; }
- num_recv = wait_for_data(sockfd, params.duration/3, 0); - printf("packets_received=%d\n", num_recv); + num_good += wait_for_data(sockfd, params.duration/3, 0); + printf("packets_received=%d\n", num_good); + printf("packets_received_while_blocking=%d\n", num_bad);
return EXIT_SUCCESS; }
From: Radek Pazdera rpazdera@redhat.com
Signed-off-by: Radek Pazdera rpazdera@redhat.com --- .../cmd_sequences/multicast/block_source.xml | 10 ++-- example_recipes/cmd_sequences/multicast/if.xml | 38 +++++++------- example_recipes/cmd_sequences/multicast/loop.xml | 36 +++++++------- .../cmd_sequences/multicast/max_groups.xml | 9 ++-- .../cmd_sequences/multicast/membership.xml | 18 +++--- example_recipes/cmd_sequences/multicast/simple.xml | 19 +++---- .../cmd_sequences/multicast/source_membership.xml | 38 +++++++------- example_recipes/cmd_sequences/multicast/ttl.xml | 54 ++++++++++---------- example_recipes/rpazdera-multicast.xml | 22 +++++++- 9 files changed, 129 insertions(+), 115 deletions(-)
diff --git a/example_recipes/cmd_sequences/multicast/block_source.xml b/example_recipes/cmd_sequences/multicast/block_source.xml index a9a3712..72d0fd2 100644 --- a/example_recipes/cmd_sequences/multicast/block_source.xml +++ b/example_recipes/cmd_sequences/multicast/block_source.xml @@ -25,7 +25,7 @@ <option name="duration" value="10" /> <option name="delay" value="0.1" /> <option name="ttl" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
@@ -35,8 +35,8 @@ <option name="address" value="238.0.0.1" /> <option name="port" value="1337" /> <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> - <option type="recipe_eval" name="source" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(2,1)}" /> + <option name="source" value="{ip(1,1)}" />
<option name="condition" value="packets_received > 0" /> <option name="condition" value="packets_received_while_blocking == 0" /> @@ -56,7 +56,7 @@ <option name="duration" value="10" /> <option name="delay" value="0.1" /> <option name="ttl" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
@@ -66,7 +66,7 @@ <option name="address" value="238.0.0.1" /> <option name="port" value="1337" /> <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(2,1)}" /> <option name="source" value="127.0.0.200" />
<option name="condition" value="packets_received > 0" /> diff --git a/example_recipes/cmd_sequences/multicast/if.xml b/example_recipes/cmd_sequences/multicast/if.xml index c7fec3f..a81557c 100644 --- a/example_recipes/cmd_sequences/multicast/if.xml +++ b/example_recipes/cmd_sequences/multicast/if.xml @@ -1,4 +1,4 @@ -<!-- Offline IP_MULTICAST_IF test --> +<!-- IP_MULTICAST_IF test --> <!-- Requires: 2 hosts - [1] with one interface - [2] with one interface @@ -23,22 +23,22 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> - <option name="ttl" value="0" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> + <option name="ttl" value="1" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(2,1)}" />
<option name="condition" value="packets_received > 0" /> </options> @@ -52,21 +52,21 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="ttl" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> <option name="interface" value="127.0.0.1" />
<option name="condition" value="packets_received == 0" /> diff --git a/example_recipes/cmd_sequences/multicast/loop.xml b/example_recipes/cmd_sequences/multicast/loop.xml index 7b155e1..ceac21c 100644 --- a/example_recipes/cmd_sequences/multicast/loop.xml +++ b/example_recipes/cmd_sequences/multicast/loop.xml @@ -16,22 +16,22 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="loop" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="1" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(1,1)}" />
<option name="condition" value="packets_received > 0" /> </options> @@ -45,22 +45,22 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="loop" value="0" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="1" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(1,1)}" />
<option name="condition" value="packets_received == 0" /> </options> diff --git a/example_recipes/cmd_sequences/multicast/max_groups.xml b/example_recipes/cmd_sequences/multicast/max_groups.xml index 2141678..a2d1a25 100644 --- a/example_recipes/cmd_sequences/multicast/max_groups.xml +++ b/example_recipes/cmd_sequences/multicast/max_groups.xml @@ -6,20 +6,19 @@ <command type="test" value="Multicast" machine_id="1" timeout="30"> <options> <option name="setup" value="max_groups" /> - <option name="interface" value="{$host1if1}" /> + <option name="interface" value="{ip(1,1)}" /> <option name="condition" value="max_groups > 0" /> </options> </command>
<!-- Change default max_memberhsips --> - <command type="exec" value="echo '5' > /proc/sys/net/ipv4/igmp_max_memberships" machine_id="1" /> + + <command type="system_config" option="/proc/sys/net/ipv4/igmp_max_memberships" value="5" machine_id="1" /> <command type="test" value="Multicast" machine_id="1" timeout="30"> <options> <option name="setup" value="max_groups" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> <option name="condition" value="max_groups == 5" /> </options> </command> - <command type="exec" value="echo '20' > /proc/sys/net/ipv4/igmp_max_memberships" machine_id="1" /> - </command_sequence> diff --git a/example_recipes/cmd_sequences/multicast/membership.xml b/example_recipes/cmd_sequences/multicast/membership.xml index fd9c166..3136e2f 100644 --- a/example_recipes/cmd_sequences/multicast/membership.xml +++ b/example_recipes/cmd_sequences/multicast/membership.xml @@ -22,22 +22,22 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="ttl" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_membership" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(2,1)}" />
<option name="condition" value="packets_received > 0" /> <option name="condition" value="packets_received_after_drop == 0" /> diff --git a/example_recipes/cmd_sequences/multicast/simple.xml b/example_recipes/cmd_sequences/multicast/simple.xml index 236558b..7455201 100644 --- a/example_recipes/cmd_sequences/multicast/simple.xml +++ b/example_recipes/cmd_sequences/multicast/simple.xml @@ -8,22 +8,21 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <!-- <option name="interface" value="192.168.122.179" /> --> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(2,1)}" />
<option name="condition" value="packets_received > 0" /> </options> diff --git a/example_recipes/cmd_sequences/multicast/source_membership.xml b/example_recipes/cmd_sequences/multicast/source_membership.xml index aeb525b..ffda96f 100644 --- a/example_recipes/cmd_sequences/multicast/source_membership.xml +++ b/example_recipes/cmd_sequences/multicast/source_membership.xml @@ -25,23 +25,23 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="ttl" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_source_membership" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> - <option type="recipe_eval" name="source" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(2,1)}" /> + <option name="source" value="{ip(1,1)}" />
<option name="condition" value="packets_received > 0" /> <option name="condition" value="packets_received_after_drop == 0" /> @@ -56,22 +56,22 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="ttl" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_source_membership" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(2,1)}" /> <option name="source" value="127.0.0.200" />
<option name="condition" value="packets_received == 0" /> diff --git a/example_recipes/cmd_sequences/multicast/ttl.xml b/example_recipes/cmd_sequences/multicast/ttl.xml index ae55228..d0fe197 100644 --- a/example_recipes/cmd_sequences/multicast/ttl.xml +++ b/example_recipes/cmd_sequences/multicast/ttl.xml @@ -19,23 +19,23 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="ttl" value="0" /> <option name="loop" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="1" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(1,1)}" />
<option name="condition" value="packets_received > 0" /> </options> @@ -58,22 +58,22 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="ttl" value="0" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(2,1)}" />
<option name="condition" value="packets_received > 0" /> </options> @@ -87,22 +87,22 @@ <command type="test" value="Multicast" machine_id="1" timeout="30" bg_id="1"> <options> <option name="setup" value="send_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option name="delay" value="0.1" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="delay" value="{$send_delay}" /> <option name="ttl" value="1" /> - <option type="recipe_eval" name="interface" value="['machines'][1]['netconfig'][1]['addresses'][0]" /> + <option name="interface" value="{ip(1,1)}" /> </options> </command>
<command type="test" value="Multicast" machine_id="2" timeout="30"> <options> <option name="setup" value="recv_simple" /> - <option name="address" value="238.0.0.1" /> - <option name="port" value="1337" /> - <option name="duration" value="10" /> - <option type="recipe_eval" name="interface" value="['machines'][2]['netconfig'][1]['addresses'][0]" /> + <option name="address" value="{$multicast_group}" /> + <option name="port" value="{$port}" /> + <option name="duration" value="{$test_duration}" /> + <option name="interface" value="{ip(2,1)}" />
<option name="condition" value="packets_received > 0" /> </options> diff --git a/example_recipes/rpazdera-multicast.xml b/example_recipes/rpazdera-multicast.xml index 9a90168..192e462 100644 --- a/example_recipes/rpazdera-multicast.xml +++ b/example_recipes/rpazdera-multicast.xml @@ -10,10 +10,14 @@ <netconfig> <netdevice id="1" type="eth" phys_id="1"> <addresses> - <address value="192.168.122.237/24" /> + <address value="192.168.122.225/24" /> + </addresses> + </netdevice> + <netdevice id="2" type="eth" phys_id="2"> + <addresses> + <address value="192.168.122.239/24" /> </addresses> </netdevice> - <netdevice id="2" type="eth" phys_id="2" /> </netconfig> </machine> <machine id="2"> @@ -24,13 +28,25 @@ <netconfig> <netdevice id="1" type="eth" phys_id="1"> <addresses> - <address value="192.168.122.179/24" /> + <address value="192.168.122.200/24" /> </addresses> </netdevice> </netconfig> </machine> </machines>
+ <define> + <alias name="multicast_group" value="239.1.2.3" /> + <alias name="port" value="1337" /> + <alias name="test_duration" value="10" /> + <alias name="send_delay" value="0.1" /> + <alias name="nonexistent_ip" value="127.0.0.200" /> + </define> + + <command_sequence source="cmd_sequences/multicast/max_groups.xml" /> + <command_sequence source="cmd_sequences/multicast/block_source.xml" /> + <command_sequence source="cmd_sequences/multicast/source_membership.xml" /> + <command_sequence source="cmd_sequences/multicast/membership.xml" /> <command_sequence source="cmd_sequences/multicast/if.xml" /> <command_sequence source="cmd_sequences/multicast/ttl.xml" /> <command_sequence source="cmd_sequences/multicast/loop.xml" />
From: Radek Pazdera rpazdera@redhat.com
There was a bug with IP addresses in socket conformance tests that occured on big endian machines.
Reported-By: Hangbin Liu hliu@redhat.com Signed-off-by: Radek Pazdera rpazdera@redhat.com --- .../multicast/offline/sockopt_block_source.c | 32 +++++++++---------- test_tools/multicast/offline/sockopt_if.c | 8 ++-- test_tools/multicast/offline/sockopt_membership.c | 18 +++++----- .../multicast/offline/sockopt_source_membership.c | 30 +++++++++--------- 4 files changed, 43 insertions(+), 45 deletions(-)
diff --git a/test_tools/multicast/offline/sockopt_block_source.c b/test_tools/multicast/offline/sockopt_block_source.c index f79bb48..c60c151 100644 --- a/test_tools/multicast/offline/sockopt_block_source.c +++ b/test_tools/multicast/offline/sockopt_block_source.c @@ -27,20 +27,18 @@ void test_block_source() { struct ip_mreq_source mreq;
- mreq.imr_multiaddr.s_addr = 0x0100007f; - mreq.imr_interface.s_addr = 0x0100007f; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("127.0.0.1"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_BLOCK_SOURCE Bad multicast address", IP_BLOCK_SOURCE, &mreq, sizeof(mreq), EINVAL);
- - mreq.imr_multiaddr.s_addr = 0xdeadbeef; - mreq.imr_interface.s_addr = 0xffffffff; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreq.imr_interface.s_addr = inet_addr("255.255.255.255"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_BLOCK_SOURCE Bad interface", IP_BLOCK_SOURCE, &mreq, sizeof(mreq), ENODEV);
- test_setsockopt_error("IP_BLOCK_SOURCE Bad optlen", IP_BLOCK_SOURCE, &mreq, 2, EINVAL); } @@ -49,21 +47,21 @@ void test_unblock_source() { struct ip_mreq_source mreq;
- mreq.imr_multiaddr.s_addr = 0x0100007f; - mreq.imr_interface.s_addr = 0x0100007f; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("127.0.0.1"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_UNBLOCK_SOURCE Bad multicast address", IP_UNBLOCK_SOURCE, &mreq, sizeof(mreq), EINVAL);
- mreq.imr_multiaddr.s_addr = 0xdeadbeef; - mreq.imr_interface.s_addr = 0x0100007f; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_UNBLOCK_SOURCE Not a member", IP_UNBLOCK_SOURCE, &mreq, sizeof(mreq), EINVAL);
- mreq.imr_multiaddr.s_addr = 0xdeadbeef; - mreq.imr_interface.s_addr = 0xffffffff; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreq.imr_interface.s_addr = inet_addr("255.255.255.255"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_UNBLOCK_SOURCE No device found", IP_UNBLOCK_SOURCE, &mreq, sizeof(mreq), ENODEV);
diff --git a/test_tools/multicast/offline/sockopt_if.c b/test_tools/multicast/offline/sockopt_if.c index ff5bd51..2396629 100644 --- a/test_tools/multicast/offline/sockopt_if.c +++ b/test_tools/multicast/offline/sockopt_if.c @@ -32,19 +32,19 @@ void test_if() test_getsockopt("IP_MULTICAST_IF default value", IP_MULTICAST_IF, &address, size);
- inet_pton(AF_INET, "127.0.0.1", &address); + address.s_addr = inet_addr("127.0.0.1"); test_sockopt_value("IP_MULTICAST_IF set to 127.0.0.1", IP_MULTICAST_IF, &address, size);
struct ip_mreqn mreqn; - mreqn.imr_multiaddr.s_addr = 0xdeadbeef; + mreqn.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); mreqn.imr_address.s_addr = INADDR_ANY; mreqn.imr_ifindex = 0;
test_sockopt_value("IP_MULTICAST_IF set to INADDR_ANY", IP_MULTICAST_IF, &mreqn, sizeof(mreqn));
- mreqn.imr_address.s_addr = 0x0100007f; + mreqn.imr_address.s_addr = inet_addr("127.0.0.1"); test_sockopt_value("IP_MULTICAST_IF set to 127.0.0.1", IP_MULTICAST_IF, &mreqn, sizeof(mreqn));
@@ -53,7 +53,7 @@ void test_if() test_setsockopt_error("IP_MULTICAST_IF bad optlen", IP_MULTICAST_IF, &address, 3, EINVAL);
- inet_pton(AF_INET, "238.0.10.0", &address); + address.s_addr = inet_addr("238.0.10.0"); test_setsockopt_error("IP_MULTICAST_IF address 238.0.10.0", IP_MULTICAST_IF, &address, sizeof(address), EADDRNOTAVAIL); diff --git a/test_tools/multicast/offline/sockopt_membership.c b/test_tools/multicast/offline/sockopt_membership.c index b8612f7..4f8adc3 100644 --- a/test_tools/multicast/offline/sockopt_membership.c +++ b/test_tools/multicast/offline/sockopt_membership.c @@ -26,7 +26,7 @@ void test_add_membership() { struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = 0x0100007f; + mreq.imr_multiaddr.s_addr = inet_addr("127.0.0.1"); struct ip_mreqn mreqn;
test_setsockopt_error("IP_ADD_MEMBERSHIP Bad multicast address", @@ -35,8 +35,8 @@ void test_add_membership() test_setsockopt_error("IP_ADD_MEMBERSHIP Bad optlen", IP_ADD_MEMBERSHIP, &mreq, 5, EINVAL);
- mreqn.imr_multiaddr.s_addr = 0xdeadbeef; - mreqn.imr_address.s_addr = 0xffffffff; + mreqn.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreqn.imr_address.s_addr = inet_addr("255.255.255.255"); mreqn.imr_ifindex = 500; test_setsockopt_error("IP_ADD_MEMBERSHIP No device found", IP_ADD_MEMBERSHIP, &mreqn, sizeof(mreqn), ENODEV); @@ -45,8 +45,8 @@ void test_add_membership() void test_drop_membership() { struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = 0x0100007f; - mreq.imr_interface.s_addr = 0x0100007f; + mreq.imr_multiaddr.s_addr = inet_addr("127.0.0.1"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); struct ip_mreqn mreqn;
test_setsockopt_error("IP_DROP_MEMBERSHIP Bad optlen", @@ -54,13 +54,13 @@ void test_drop_membership() test_setsockopt_error("IP_DROP_MEMBERSHIP Bad multicast address", IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq), EADDRNOTAVAIL);
- mreq.imr_multiaddr.s_addr = 0xdeadbeef; - mreq.imr_interface.s_addr = 0x0100007f; + mreq.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); test_setsockopt_error("IP_DROP_MEMBERSHIP Not a member", IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq), EADDRNOTAVAIL);
- mreqn.imr_multiaddr.s_addr = 0xdeadbeef; - mreqn.imr_address.s_addr = 0xffffffff; + mreqn.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreqn.imr_address.s_addr = inet_addr("255.255.255.255"); mreqn.imr_ifindex = 500; test_setsockopt_error("IP_DROP_MEMBERSHIP No device found", IP_DROP_MEMBERSHIP, &mreqn, sizeof(mreqn), ENODEV); diff --git a/test_tools/multicast/offline/sockopt_source_membership.c b/test_tools/multicast/offline/sockopt_source_membership.c index a43b43c..d589dcd 100644 --- a/test_tools/multicast/offline/sockopt_source_membership.c +++ b/test_tools/multicast/offline/sockopt_source_membership.c @@ -29,16 +29,16 @@ void test_add_source_membership() { struct ip_mreq_source mreq;
- mreq.imr_multiaddr.s_addr = 0x0100007f; - mreq.imr_interface.s_addr = 0x0100007f; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("127.0.0.1"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_ADD_SOURCE_MEMBERSHIP Bad multicast address", IP_ADD_SOURCE_MEMBERSHIP, &mreq, sizeof(mreq), EINVAL);
- mreq.imr_multiaddr.s_addr = 0xdeadbeef; - mreq.imr_interface.s_addr = 0xffffffff; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreq.imr_interface.s_addr = inet_addr("255.255.255.255"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_ADD_SOURCE_MEMBERSHIP Bad interface", IP_ADD_SOURCE_MEMBERSHIP, &mreq, sizeof(mreq), ENODEV);
@@ -51,21 +51,21 @@ void test_drop_source_membership() { struct ip_mreq_source mreq;
- mreq.imr_multiaddr.s_addr = 0x0100007f; - mreq.imr_interface.s_addr = 0x0100007f; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("127.0.0.1"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_DROP_SOURCE_MEMBERSHIP Bad multicast address", IP_DROP_SOURCE_MEMBERSHIP, &mreq, sizeof(mreq), EINVAL);
- mreq.imr_multiaddr.s_addr = 0xdeadbeef; - mreq.imr_interface.s_addr = 0x0100007f; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreq.imr_interface.s_addr = inet_addr("127.0.0.1"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_DROP_SOURCE_MEMBERSHIP Not a member", IP_DROP_SOURCE_MEMBERSHIP, &mreq, sizeof(mreq), EINVAL);
- mreq.imr_multiaddr.s_addr = 0xdeadbeef; - mreq.imr_interface.s_addr = 0xffffffff; - mreq.imr_sourceaddr.s_addr = 0x12345678; + mreq.imr_multiaddr.s_addr = inet_addr("239.1.2.3"); + mreq.imr_interface.s_addr = inet_addr("255.255.255.255"); + mreq.imr_sourceaddr.s_addr = inet_addr("192.168.0.1"); test_setsockopt_error("IP_DROP_SOURCE_MEMBERSHIP No device found", IP_DROP_SOURCE_MEMBERSHIP, &mreq, sizeof(mreq), ENODEV);
This set and previous 2 patches applied. Thanks Radek!
Fri, May 25, 2012 at 06:01:53PM CEST, rpazdera@redhat.com wrote:
From: Radek Pazdera rpazdera@redhat.com
This patch series contains several small updates of multicast tests. The older recipe and command sequences were adapted to recent changes in NetTestParser.
A couple of minor bugs and typing errors was fixed as well.
Radek Pazdera (5): multicast: Moved IGMP parameters to separate file multicast: Adding igmp options to TestMulticast.py multicast: recv_block_source reporting fix multicast: Convert recipe_eval to newer convention multicast: Fix endianess bug
Tests/TestMulticast.py | 5 + .../cmd_sequences/multicast/block_source.xml | 10 +- example_recipes/cmd_sequences/multicast/if.xml | 38 ++-- example_recipes/cmd_sequences/multicast/loop.xml | 36 ++-- .../cmd_sequences/multicast/max_groups.xml | 9 +- .../cmd_sequences/multicast/membership.xml | 18 +- example_recipes/cmd_sequences/multicast/simple.xml | 19 +- .../cmd_sequences/multicast/source_membership.xml | 38 ++-- example_recipes/cmd_sequences/multicast/ttl.xml | 54 ++-- example_recipes/rpazdera-multicast.xml | 22 ++- test_tools/multicast/igmp_utils.h | 2 +- test_tools/multicast/multicast_utils.h | 2 +- .../multicast/offline/sockopt_block_source.c | 32 +-- test_tools/multicast/offline/sockopt_if.c | 10 +- test_tools/multicast/offline/sockopt_membership.c | 18 +- .../multicast/offline/sockopt_source_membership.c | 30 +- test_tools/multicast/parameters.h | 287 -------------------- test_tools/multicast/parameters_igmp.h | 154 +++++++++++ test_tools/multicast/parameters_multicast.h | 192 +++++++++++++ test_tools/multicast/server/recv_block_source.c | 15 +- 20 files changed, 534 insertions(+), 457 deletions(-) delete mode 100644 test_tools/multicast/parameters.h create mode 100644 test_tools/multicast/parameters_igmp.h create mode 100644 test_tools/multicast/parameters_multicast.h
-- 1.7.7.6
LNST-developers mailing list LNST-developers@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/lnst-developers
lnst-developers@lists.fedorahosted.org