diff -aurp open-iscsi-6.2.0.695/usr/idbm.c open-iscsi-6.2.0.695.work/usr/idbm.c --- open-iscsi-6.2.0.695/usr/idbm.c 2006-10-13 13:06:54.000000000 -0500 +++ open-iscsi-6.2.0.695.work/usr/idbm.c 2006-10-13 13:07:14.000000000 -0500 @@ -978,15 +978,14 @@ idbm_new_discovery(idbm_t *db, char *ip, discovery_rec_t *drec; node_rec_t *nrec; - /* sync default configuration */ - idbm_sync_config(db, 1); - /* allocate new discovery record and initialize with defaults */ drec = malloc(sizeof(discovery_rec_t)); if (!drec) { log_error("out of memory on discovery record allocation"); return NULL; } + drec->type = type; + if (drec->type == DISCOVERY_TYPE_SENDTARGETS) { memcpy(drec, &db->drec_st, sizeof(discovery_rec_t)); } else if (drec->type == DISCOVERY_TYPE_SLP) { @@ -1005,7 +1004,6 @@ idbm_new_discovery(idbm_t *db, char *ip, memcpy(nrec, &db->nrec, sizeof(node_rec_t)); /* update discovery record */ - drec->type = type; if (drec->type == DISCOVERY_TYPE_SENDTARGETS) { strncpy(drec->u.sendtargets.address, ip, NI_MAXHOST); drec->u.sendtargets.port = port; @@ -1155,6 +1153,9 @@ idbm_delete_node(idbm_t *db, node_rec_t void idbm_sendtargets_defaults(idbm_t *db, struct iscsi_sendtargets_config *cfg) { + /* sync default configuration */ + idbm_sync_config(db, 1); + memcpy(cfg, &db->drec_st.u.sendtargets, sizeof(struct iscsi_sendtargets_config)); }