mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-09 12:48:43 +00:00
includes still broken
This commit is contained in:
parent
a214035951
commit
fca9fca3d9
11
nest/cbor.c
11
nest/cbor.c
@ -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
|
write_item(writer, 6, 52); // 6 is TAG, 52 is tag number for ipv4
|
||||||
cbor_open_block_with_length(writer, 2);
|
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
|
write_item(writer, 2, 4); // bytestring of length 4
|
||||||
for (int i = 3; i>=0; i--)
|
put_ip4(&writer->cbor[writer->pt], n->prefix);
|
||||||
{
|
writer->pt += 4;
|
||||||
writer->cbor[writer->pt] = (addr>>(i*8)) & 0xff;
|
|
||||||
writer->pt++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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_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);
|
void cbor_add_uint(struct cbor_writer *writer, uint64_t item);
|
||||||
|
@ -58,16 +58,10 @@ void cbor_add_net(struct cbor_writer *writer, const net_addr *N) {
|
|||||||
switch (n->n.type)
|
switch (n->n.type)
|
||||||
{
|
{
|
||||||
case NET_IP4:
|
case NET_IP4:
|
||||||
cbor_add_ipv4_prefix(writer, n->ip4.prefix, n->ip4.pxlen);
|
cbor_add_ipv4_prefix(writer, &n->ip4);
|
||||||
return;
|
return;
|
||||||
case NET_IP6:
|
case NET_IP6:
|
||||||
cbor_add_ipv6_prefix(writer, n->ip6.prefix.addr, n->ip6.pxlen);
|
cbor_add_ipv6_prefix(writer, &n->ip6);
|
||||||
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);
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
bug("net type unsupported by cbor (yet).");
|
bug("net type unsupported by cbor (yet).");
|
||||||
|
Loading…
Reference in New Issue
Block a user