case IMSG_KROUTE_ADD: if (idx != PFD_PIPE_ROUTE) fatal("route request not from RDE", 0); if (kroute_add(rfd, imsg.data)) fatal("kroute bytes left", 0); break; case IMSG_KROUTE_CHANGE: if (idx != PFD_PIPE_ROUTE) fatal("route request not from RDE", 0); if (kroute_change(rfd, imsg.data)) fatal("kroute bytes left", 0); case IMSG_KROUTE_DELETE: if (idx != PFD_PIPE_ROUTE) fatal("route request not from RDE", 0); if (kroute_delete(rfd, imsg.data)) fatal("kroute bytes left", 0); break;
dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_config *conf){	struct imsg		 imsg;	struct buf		*wbuf;	struct mrtdump_config	*m;	ssize_t			 len;	int			 n;	if (imsg_get(ibuf, &imsg) > 0) {		switch (imsg.hdr.type) {		case IMSG_MRT_MSG:		case IMSG_MRT_END:			LIST_FOREACH(m, conf, list) {				if (m->id != imsg.hdr.peerid)					continue;				if (mrt_state(m, imsg.hdr.type, ibuf) == 0)					break;				if (m->msgbuf.sock == -1)					break;				len = imsg.hdr.len - IMSG_HEADER_SIZE;				wbuf = buf_open(len);				if (wbuf == NULL)					fatal("buf_open error", 0);				if (buf_add(wbuf, imsg.data, len) == -1)					fatal("buf_add error", 0);				if ((n = buf_close(&m->msgbuf, wbuf)) == -1)					fatal("buf_close error", 0);				break;			}			break;		default:			break;		}		imsg_free(&imsg);	}	return (0);}