WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] When a domain is introduced to xenstored, check whether

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] When a domain is introduced to xenstored, check whether this has already
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Oct 2005 18:16:11 +0000
Delivery-date: Mon, 10 Oct 2005 18:13:46 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User emellor@ewan
# Node ID bea563754fe6e4137464688bc585eef34deb7949
# Parent  7a48bfd1aba65db064b7ca64cf2bae67a45d5f98
When a domain is introduced to xenstored, check whether this has already
happened, and only return EINVAL if the event channel details have changed.
This allows Xend to introduce domains when it starts without having to be
concerned about whether xenstored has restarted at the same time.  This
behaviour used to be subsumed by the bind_interdomain semantics for existing
channels, but in the simplification of that interface, the check must now move
to userspace.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 7a48bfd1aba6 -r bea563754fe6 tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Mon Oct 10 17:59:57 2005
+++ b/tools/xenstore/xenstored_domain.c Mon Oct 10 18:04:03 2005
@@ -52,6 +52,14 @@
 
        /* Event channel port */
        u16 port;
+
+       /* The remote end of the event channel, used only to validate
+          repeated domain introductions. */
+       u16 remote_port;
+
+       /* The mfn associated with the event channel, used only to validate
+          repeated domain introductions. */
+       unsigned long mfn;
 
        /* Domain path in store. */
        char *path;
@@ -322,45 +330,13 @@
        domain->port = rc;
        domain->conn = new_connection(writechn, readchn);
        domain->conn->domain = domain;
+
+       domain->remote_port = port;
+       domain->mfn = mfn;
+
        return domain;
 }
 
-/* domid, mfn, evtchn, path */
-void do_introduce(struct connection *conn, struct buffered_data *in)
-{
-       struct domain *domain;
-       char *vec[4];
-
-       if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec)) {
-               send_error(conn, EINVAL);
-               return;
-       }
-
-       if (conn->id != 0 || !conn->can_write) {
-               send_error(conn, EACCES);
-               return;
-       }
-
-       /* Sanity check args. */
-       if ((atoi(vec[2]) <= 0) || !is_valid_nodename(vec[3])) {
-               send_error(conn, EINVAL);
-               return;
-       }
-       /* Hang domain off "in" until we're finished. */
-       domain = new_domain(in, atoi(vec[0]), atol(vec[1]), atol(vec[2]),
-                           vec[3]);
-       if (!domain) {
-               send_error(conn, errno);
-               return;
-       }
-
-       /* Now domain belongs to its connection. */
-       talloc_steal(domain->conn, domain);
-
-       fire_watches(conn, "@introduceDomain", false);
-
-       send_ack(conn, XS_INTRODUCE);
-}
 
 static struct domain *find_domain_by_domid(domid_t domid)
 {
@@ -371,6 +347,67 @@
                        return i;
        }
        return NULL;
+}
+
+
+/* domid, mfn, evtchn, path */
+void do_introduce(struct connection *conn, struct buffered_data *in)
+{
+       struct domain *domain;
+       char *vec[4];
+       domid_t domid;
+       unsigned long mfn;
+       u16 port;
+       const char *path;
+
+       if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec)) {
+               send_error(conn, EINVAL);
+               return;
+       }
+
+       if (conn->id != 0 || !conn->can_write) {
+               send_error(conn, EACCES);
+               return;
+       }
+
+       domid = atoi(vec[0]);
+       mfn = atol(vec[1]);
+       port = atoi(vec[2]);
+       path = vec[3];
+
+       /* Sanity check args. */
+       if ((port <= 0) || !is_valid_nodename(path)) {
+               send_error(conn, EINVAL);
+               return;
+       }
+
+       domain = find_domain_by_domid(domid);
+
+       if (domain == NULL) {
+               /* Hang domain off "in" until we're finished. */
+               domain = new_domain(in, domid, mfn, port, path);
+               if (!domain) {
+                       send_error(conn, errno);
+                       return;
+               }
+
+               /* Now domain belongs to its connection. */
+               talloc_steal(domain->conn, domain);
+
+               fire_watches(conn, "@introduceDomain", false);
+       }
+       else {
+               /* Check that the given details match the ones we have
+                  previously recorded. */
+               if (port != domain->remote_port ||
+                   mfn != domain->mfn ||
+                   strcmp(path, domain->path) != 0) {
+                       send_error(conn, EINVAL);
+                       return;
+               }
+       }
+
+       send_ack(conn, XS_INTRODUCE);
 }
 
 /* domid */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] When a domain is introduced to xenstored, check whether this has already, Xen patchbot -unstable <=