summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-07-13 08:46:08 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-07-13 08:46:08 +0000
commit8a8712c7f1bbcb18badb2a08600972503c645d99 (patch)
tree58df6bf361c4caa6ced21f0208d9b685a7b016d9
parent8046750182b1276e50e904c7a33295d341202104 (diff)
When we nack a domain service because we don't support the requested major
version, provide a major version that we do support.
-rw-r--r--usr.sbin/ldomd/ds.c15
-rw-r--r--usr.sbin/ldomd/ds.h4
2 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/ldomd/ds.c b/usr.sbin/ldomd/ds.c
index 38330af281e..2211f358143 100644
--- a/usr.sbin/ldomd/ds.c
+++ b/usr.sbin/ldomd/ds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ds.c,v 1.7 2018/07/13 07:29:08 kettenis Exp $ */
+/* $OpenBSD: ds.c,v 1.8 2018/07/13 08:46:07 kettenis Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -444,6 +444,7 @@ ds_rx_msg(struct ldc_conn *lc, void *data, size_t len)
{
struct ds_reg_req *dr = data;
struct ds_conn_svc *dcs;
+ uint16_t major = 0;
DPRINTF(("DS_REG_REQ %s %d.%d 0x%016llx\n", dr->svc_id,
dr->major_vers, dr->minor_vers, dr->svc_handle));
@@ -459,7 +460,13 @@ ds_rx_msg(struct ldc_conn *lc, void *data, size_t len)
}
}
- ds_reg_nack(lc, dr->svc_handle);
+ TAILQ_FOREACH(dcs, &dc->services, link) {
+ if (strcmp(dr->svc_id, dcs->service->ds_svc_id) == 0 &&
+ dcs->service->ds_major_vers > major)
+ major = dcs->service->ds_major_vers;
+ }
+
+ ds_reg_nack(lc, dr->svc_handle, major);
break;
}
@@ -521,7 +528,7 @@ ds_reg_ack(struct ldc_conn *lc, uint64_t svc_handle, uint16_t minor)
}
void
-ds_reg_nack(struct ldc_conn *lc, uint64_t svc_handle)
+ds_reg_nack(struct ldc_conn *lc, uint64_t svc_handle, uint16_t major)
{
struct ds_reg_nack dn;
@@ -531,7 +538,7 @@ ds_reg_nack(struct ldc_conn *lc, uint64_t svc_handle)
dn.payload_len = sizeof(dn) - 8;
dn.svc_handle = svc_handle;
dn.result = DS_REG_VER_NACK;
- dn.major_vers = 0;
+ dn.major_vers = major;
ds_send_msg(lc, &dn, sizeof(dn));
}
diff --git a/usr.sbin/ldomd/ds.h b/usr.sbin/ldomd/ds.h
index ab3249a414b..56ab46889de 100644
--- a/usr.sbin/ldomd/ds.h
+++ b/usr.sbin/ldomd/ds.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ds.h,v 1.3 2018/07/13 07:29:08 kettenis Exp $ */
+/* $OpenBSD: ds.h,v 1.4 2018/07/13 08:46:07 kettenis Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -200,7 +200,7 @@ void ds_rx_msg(struct ldc_conn *, void *, size_t);
void ds_init_ack(struct ldc_conn *);
void ds_reg_ack(struct ldc_conn *, uint64_t, uint16_t);
-void ds_reg_nack(struct ldc_conn *, uint64_t);
+void ds_reg_nack(struct ldc_conn *, uint64_t, uint16_t);
void ds_unreg_ack(struct ldc_conn *, uint64_t);
void ds_unreg_nack(struct ldc_conn *, uint64_t);