aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ocaml/xenstored
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-12-15 16:50:36 +0000
committerIan Campbell <ian.campbell@citrix.com>2011-12-15 16:50:36 +0000
commit25c4397fb24d0253dccfdb8bbe12cf3fd0504103 (patch)
tree3129933424d631b4afe1267cbc2a6be05e0119f2 /tools/ocaml/xenstored
parentbe1a130a99285a5ae6937f890ba31be1f7a5a9dc (diff)
downloadxen-25c4397fb24d0253dccfdb8bbe12cf3fd0504103.tar.gz
xen-25c4397fb24d0253dccfdb8bbe12cf3fd0504103.tar.bz2
xen-25c4397fb24d0253dccfdb8bbe12cf3fd0504103.zip
oxenstored: handle unknown operations by returning an error to the client
Previous an unknown operation would be decoded as a Not_found exception which would bubble all the way up to the try ... with surrounding the call to main_loop where it would be logged and ignored. This would leave the guest hanging waiting for a response to the invalid request. Instead introduce a specific "Invalid" operation. Higher level functionality, such as Process.process_packet, already handles operations which are not understood with an error reply due to the final wildcard entry in Process.function_of_type but explicitly handle Invalid this way to make it clear what is going on. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/ocaml/xenstored')
-rw-r--r--tools/ocaml/xenstored/logging.ml1
-rw-r--r--tools/ocaml/xenstored/process.ml3
-rw-r--r--tools/ocaml/xenstored/xenstored.ml4
3 files changed, 4 insertions, 4 deletions
diff --git a/tools/ocaml/xenstored/logging.ml b/tools/ocaml/xenstored/logging.ml
index 84d7c82cba..7152b4ec6c 100644
--- a/tools/ocaml/xenstored/logging.ml
+++ b/tools/ocaml/xenstored/logging.ml
@@ -182,6 +182,7 @@ let string_of_access_type = function
| Xenbus.Xb.Op.Error -> "error "
| Xenbus.Xb.Op.Watchevent -> "w event "
+ | Xenbus.Xb.Op.Invalid -> "invalid "
(*
| x -> Xenbus.Xb.Op.to_string x
*)
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index c2aeaa94a4..a4ff741264 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -324,7 +324,8 @@ let function_of_type ty =
| Xenbus.Xb.Op.Resume -> reply_ack do_resume
| Xenbus.Xb.Op.Set_target -> reply_ack do_set_target
| Xenbus.Xb.Op.Restrict -> reply_ack do_restrict
- | _ -> reply_ack do_error
+ | Xenbus.Xb.Op.Invalid -> reply_ack do_error
+ | _ -> reply_ack do_error
let input_handle_error ~cons ~doms ~fct ~ty ~con ~t ~rid ~data =
let reply_error e =
diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml
index a08aa65d33..564dbeaddb 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -43,9 +43,7 @@ let process_connection_fds store cons domains rset wset =
debug "closing socket connection"
in
let process_fdset_with fds fct =
- List.iter (fun fd ->
- try try_fct fct (Connections.find cons fd)
- with Not_found -> ()) fds
+ List.iter (fun fd -> try_fct fct (Connections.find cons fd)) fds
in
process_fdset_with rset Process.do_input;
process_fdset_with wset Process.do_output