git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
For SNAT, don't store the pre-fragment L2 header before actions are applied.
[sliver-openvswitch.git]
/
tests
/
test-dhcp-client.c
diff --git
a/tests/test-dhcp-client.c
b/tests/test-dhcp-client.c
index
3ed6eb6
..
f8a1f42
100644
(file)
--- a/
tests/test-dhcp-client.c
+++ b/
tests/test-dhcp-client.c
@@
-53,6
+53,9
@@
static struct in_addr request_ip;
* vendor class string is included. */
static const char *vendor_class;
* vendor class string is included. */
static const char *vendor_class;
+/* --no-resolv-conf: Update /etc/resolv.conf to match DHCP reply? */
+static bool update_resolv_conf = true;
+
static void parse_options(int argc, char *argv[]);
static void usage(void);
static void release(void *cli_);
static void parse_options(int argc, char *argv[]);
static void usage(void);
static void release(void *cli_);
@@
-72,22
+75,28
@@
main(int argc, char *argv[])
argc -= optind;
argv += optind;
if (argc != 1) {
argc -= optind;
argv += optind;
if (argc != 1) {
- fatal(0, "exactly one non-option argument required; "
- "use --help for help");
+
ofp_
fatal(0, "exactly one non-option argument required; "
+
"use --help for help");
}
error = dhclient_create(argv[0], modify_dhcp_request, NULL, NULL, &cli);
if (error) {
}
error = dhclient_create(argv[0], modify_dhcp_request, NULL, NULL, &cli);
if (error) {
- fatal(error, "dhclient_create failed");
+
ofp_
fatal(error, "dhclient_create failed");
}
dhclient_init(cli, request_ip.s_addr);
}
dhclient_init(cli, request_ip.s_addr);
- fatal_signal_add_hook(release, cli);
+ fatal_signal_add_hook(release, cli
, true
);
for (;;) {
fatal_signal_block();
dhclient_run(cli);
for (;;) {
fatal_signal_block();
dhclient_run(cli);
- fatal_signal_unblock();
+ if (dhclient_changed(cli)) {
+ dhclient_configure_netdev(cli);
+ if (update_resolv_conf) {
+ dhclient_update_resolv_conf(cli);
+ }
+ }
dhclient_wait(cli);
dhclient_wait(cli);
+ fatal_signal_unblock();
poll_block();
}
}
poll_block();
}
}
@@
-97,6
+106,9
@@
release(void *cli_)
{
struct dhclient *cli = cli_;
dhclient_release(cli);
{
struct dhclient *cli = cli_;
dhclient_release(cli);
+ if (dhclient_changed(cli)) {
+ dhclient_configure_netdev(cli);
+ }
}
static void
}
static void
@@
-112,11
+124,13
@@
parse_options(int argc, char *argv[])
{
enum {
OPT_REQUEST_IP = UCHAR_MAX + 1,
{
enum {
OPT_REQUEST_IP = UCHAR_MAX + 1,
- OPT_VENDOR_CLASS
+ OPT_VENDOR_CLASS,
+ OPT_NO_RESOLV_CONF
};
static struct option long_options[] = {
{"request-ip", required_argument, 0, OPT_REQUEST_IP },
{"vendor-class", required_argument, 0, OPT_VENDOR_CLASS },
};
static struct option long_options[] = {
{"request-ip", required_argument, 0, OPT_REQUEST_IP },
{"vendor-class", required_argument, 0, OPT_VENDOR_CLASS },
+ {"no-resolv-conf", no_argument, 0, OPT_NO_RESOLV_CONF},
{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
{"verbose", optional_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'V'},
@@
-135,7
+149,8
@@
parse_options(int argc, char *argv[])
switch (c) {
case OPT_REQUEST_IP:
if (!inet_aton(optarg, &request_ip)) {
switch (c) {
case OPT_REQUEST_IP:
if (!inet_aton(optarg, &request_ip)) {
- fatal(0, "--request-ip argument is not a valid IP address");
+ ofp_fatal(0,
+ "--request-ip argument is not a valid IP address");
}
break;
}
break;
@@
-143,11
+158,16
@@
parse_options(int argc, char *argv[])
vendor_class = optarg;
break;
vendor_class = optarg;
break;
+ case OPT_NO_RESOLV_CONF:
+ update_resolv_conf = false;
+ break;
+
case 'h':
usage();
case 'V':
case 'h':
usage();
case 'V':
- printf("%s "VERSION" compiled "__DATE__" "__TIME__"\n", argv[0]);
+ printf("%s %s compiled "__DATE__" "__TIME__"\n",
+ program_name, VERSION BUILDNR);
exit(EXIT_SUCCESS);
case 'v':
exit(EXIT_SUCCESS);
case 'v':
@@
-175,12
+195,12
@@
usage(void)
" do not request a specific IP)\n"
" --vendor-class=STRING use STRING as vendor class (default:\n"
" none); use OpenFlow to imitate secchan\n"
" do not request a specific IP)\n"
" --vendor-class=STRING use STRING as vendor class (default:\n"
" none); use OpenFlow to imitate secchan\n"
- "\nOther options:\n"
- " -v, --verbose=MODULE[:FACILITY[:LEVEL]] set logging levels\n"
- " -v, --verbose set maximum verbosity level\n"
- " -h, --help display this help message\n"
- " -V, --version display version information\n",
+ " --no-resolv-conf do not update /etc/resolv.conf\n",
program_name, program_name);
program_name, program_name);
+ vlog_usage();
+ printf("\nOther options:\n"
+ " -h, --help display this help message\n"
+ " -V, --version display version information\n");
exit(EXIT_SUCCESS);
}
exit(EXIT_SUCCESS);
}