T( trace(T_PEER, "peer: creating new peer `%s'", spec->name); )
p->spec = *spec;
p->spec.name = (/*unconst*/ char *)SYM_NAME(p->byname);
+ if (spec->tag)
+ p->spec.tag = xstrdup(spec->tag);
p->ks = 0;
p->pings = 0;
p->ifname = 0;
if (fd >= 0) close(fd);
tidy_2:
am_remove(&byaddr, p->byaddr);
+ if (p->spec.tag) xfree(p->spec.tag);
tidy_1:
sym_remove(&byname, p->byname);
tidy_0:
const char *p_name(peer *p) { return (p->spec.name); }
+/* --- @p_tag@ --- *
+ *
+ * Arguments: @peer *p@ = pointer to a peer block
+ *
+ * Returns: A pointer to the peer's public key tag.
+ */
+
+const char *p_tag(peer *p)
+ { return (p->spec.tag ? p->spec.tag : p->spec.name); }
+
/* --- @p_spec@ --- *
*
* Arguments: @peer *p@ = pointer to a peer block
kx_free(&p->kx);
if (p->ifname)
xfree(p->ifname);
+ if (p->spec.tag)
+ xfree(p->spec.tag);
p->t->ops->destroy(p->t);
if (p->spec.t_ka)
sel_rmtimer(&p->tka);