-/* $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
{
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));
}
}
- 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;
}
}
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;
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));
}
-/* $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
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);