projects
/
openvswitch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
aa26396
)
dhcp: Make dhcp_option_to_string() act sensibly with null or empty options.
author
Ben Pfaff
<blp@nicira.com>
Wed, 30 Jul 2008 22:45:50 +0000
(15:45 -0700)
committer
Ben Pfaff
<blp@nicira.com>
Wed, 30 Jul 2008 22:46:38 +0000
(15:46 -0700)
Also, update ofp-switch-setup to parse the new syntax.
debian/ofp-switch-setup
patch
|
blob
|
history
lib/dhcp.c
patch
|
blob
|
history
diff --git
a/debian/ofp-switch-setup
b/debian/ofp-switch-setup
index 275ddfca86554401261a2ca34e02941d9e0b0562..aa318d72ec107f45bbab5044aa04dac03511c1be 100755
(executable)
--- a/
debian/ofp-switch-setup
+++ b/
debian/ofp-switch-setup
@@
-122,6
+122,8
@@
my (@states) =
$value =~ s/\\([0-7][0-7][0-7])/chr($1)/ge;
} else {
$value =~ s/^(0x[[:xdigit:]]+)$/hex($1)/e;
+ $value = '' if $value eq 'empty';
+ next if $value eq 'null'; # Shouldn't happen.
}
$options{$name} = $value;
}
diff --git
a/lib/dhcp.c
b/lib/dhcp.c
index 3c0ed82a6573ac5a8ba0c55adc53117cbb12c533..0d3cf5f619bacd96564c88d0ed712cfd5c962c98 100644
(file)
--- a/
lib/dhcp.c
+++ b/
lib/dhcp.c
@@
-419,6
+419,11
@@
dhcp_option_to_string(const struct dhcp_option *opt, int code, struct ds *ds)
}
ds_put_char(ds, '=');
+ if (!opt->data || !opt->n) {
+ ds_put_cstr(ds, opt->data ? "empty" : "null");
+ return ds_cstr(ds);
+ }
+
if (class->type == DHCP_ARG_STRING) {
ds_put_char(ds, '"');
}