-/* $OpenBSD: mrt.c,v 1.103 2020/01/09 11:55:25 claudio Exp $ */
+/* $OpenBSD: mrt.c,v 1.104 2021/06/24 10:04:05 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
return (-1);
/* aspath */
- pdata = aspath_prepend(a->aspath, rde_local_as(), 0, &plen);
+ plen = aspath_length(a->aspath);
+ pdata = aspath_dump(a->aspath);
+
if (!v2)
pdata = aspath_deflate(pdata, &plen, &neednewpath);
if (attr_writebuf(buf, ATTR_WELL_KNOWN, ATTR_ASPATH, pdata,
plen) == -1) {
- free(pdata);
+ if (!v2)
+ free(pdata);
return (-1);
}
- free(pdata);
+ if (!v2)
+ free(pdata);
if (nexthop && nexthop->aid == AID_INET) {
/* nexthop, already network byte order */
-/* $OpenBSD: rde_attr.c,v 1.124 2021/01/16 13:14:54 claudio Exp $ */
+/* $OpenBSD: rde_attr.c,v 1.125 2021/06/24 10:04:05 claudio Exp $ */
/*
* Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
/*
* convert a 4 byte aspath to a 2 byte one.
- * data is freed by aspath_deflate
*/
u_char *
aspath_deflate(u_char *data, u_int16_t *len, int *flagnew)
}
}
- free(data);
*len = nlen;
return (ndata);
}