0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

includes still broken

This commit is contained in:
Katerina Kubecova 2024-01-04 11:46:34 +01:00
parent a214035951
commit fca9fca3d9
3 changed files with 8 additions and 17 deletions

View File

@ -86,17 +86,14 @@ void cbor_add_ipv6(struct cbor_writer *writer, uint32_t addr[4])
}
void cbor_add_ipv4_prefix(struct cbor_writer *writer, uint32_t addr, uint32_t prefix)
void cbor_add_ipv4_prefix(struct cbor_writer *writer, net_addr_ip4 *n)
{
write_item(writer, 6, 52); // 6 is TAG, 52 is tag number for ipv4
cbor_open_block_with_length(writer, 2);
cbor_add_int(writer, prefix);
cbor_add_int(writer, n->pxlen);
write_item(writer, 2, 4); // bytestring of length 4
for (int i = 3; i>=0; i--)
{
writer->cbor[writer->pt] = (addr>>(i*8)) & 0xff;
writer->pt++;
}
put_ip4(&writer->cbor[writer->pt], n->prefix);
writer->pt += 4;
}

View File

@ -31,10 +31,10 @@ void cbor_add_ipv4(struct cbor_writer *writer, uint32_t addr);
void cbor_add_ipv6(struct cbor_writer *writer, uint32_t addr[4]);
void cbor_add_ipv4_prefix(struct cbor_writer *writer, uint32_t addr, uint32_t prefix);
void cbor_add_ipv4_prefix(struct cbor_writer *writer, net_addr_ip4 *n);
void cbor_add_ipv6_prefix(struct cbor_writer *writer, uint32_t addr[4], uint32_t prefix);
void cbor_add_ipv6_prefix(struct cbor_writer *writer, net_addr_ip6 *n);
void cbor_add_uint(struct cbor_writer *writer, uint64_t item);

View File

@ -58,16 +58,10 @@ void cbor_add_net(struct cbor_writer *writer, const net_addr *N) {
switch (n->n.type)
{
case NET_IP4:
cbor_add_ipv4_prefix(writer, n->ip4.prefix, n->ip4.pxlen);
cbor_add_ipv4_prefix(writer, &n->ip4);
return;
case NET_IP6:
cbor_add_ipv6_prefix(writer, n->ip6.prefix.addr, n->ip6.pxlen);
return;
case NET_VPN4:
cbor_add_ipv4_prefix(writer, n->vpn4.prefix, n->vpn4.pxlen);
return;
case NET_VPN6:
cbor_add_ipv6_prefix(writer, n->vpn6.prefix.addr, n->vpn6.pxlen);
cbor_add_ipv6_prefix(writer, &n->ip6);
return;
default:
bug("net type unsupported by cbor (yet).");