memcpy(&rib.nexthop, &p->aspath->nexthop->true_nexthop, sizeof(rib.nexthop));
if (p->aspath->nexthop != NULL) memcpy(&rib.nexthop, &p->aspath->nexthop->true_nexthop, sizeof(rib.nexthop)); else {  bzero(&rib.nexthop, sizeof(rib.nexthop)); rib.nexthop.af = p->prefix->af; }
rde_dump_rib_as(struct prefix *p, pid_t pid){	struct ctl_show_rib	 rib;	struct buf		*wbuf;	rib.lastchange = p->lastchange;	rib.local_pref = p->aspath->flags.lpref;	rib.med = p->aspath->flags.med;	rib.prefix_cnt = p->aspath->prefix_cnt;	rib.active_cnt = p->aspath->active_cnt;	memcpy(&rib.nexthop, &p->aspath->nexthop->true_nexthop,	    sizeof(rib.nexthop));	pt_getaddr(p->prefix, &rib.prefix);	rib.prefixlen = p->prefix->prefixlen;	rib.origin = p->aspath->flags.origin;	rib.flags = 0;	if (p->prefix->active == p)		rib.flags |= F_RIB_ACTIVE;	if (p->peer->conf.ebgp == 0)		rib.flags |= F_RIB_INTERNAL;	if (p->aspath->nexthop->state == NEXTHOP_REACH)		rib.flags |= F_RIB_ELIGIBLE;	if (p->aspath->nexthop->flags & NEXTHOP_ANNOUNCE)		rib.flags |= F_RIB_ANNOUNCE;	rib.aspath_len = aspath_length(p->aspath->flags.aspath);	if ((wbuf = imsg_create_pid(&ibuf_se, IMSG_CTL_SHOW_RIB, pid,	    sizeof(rib) + rib.aspath_len)) == NULL)		return;	if (imsg_add(wbuf, &rib, sizeof(rib)) == -1 ||	    imsg_add(wbuf, aspath_dump(p->aspath->flags.aspath),	    rib.aspath_len) == -1)		return;	if (imsg_close(&ibuf_se, wbuf) == -1)		return;}