2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2021-04-18 20:53:19 +02:00
|
|
|
/* Opaque data for Zebra from other daemons.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2021 Donatas Abraitis <donatas.abraitis@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef FRR_ROUTE_OPAQUE_H
|
|
|
|
#define FRR_ROUTE_OPAQUE_H
|
|
|
|
|
2021-08-06 16:09:46 +02:00
|
|
|
#include "assert.h"
|
|
|
|
#include "zclient.h"
|
|
|
|
|
2021-09-21 03:11:18 +02:00
|
|
|
/* copied from bgpd/bgp_community.h */
|
|
|
|
#define COMMUNITY_SIZE 4
|
|
|
|
/* copied from bgpd/bgp_lcommunity.h */
|
|
|
|
#define LCOMMUNITY_SIZE 12
|
|
|
|
/* copied from bgpd/bgp_route.h */
|
|
|
|
#define BGP_MAX_SELECTION_REASON_STR_BUF 32
|
2021-04-18 20:53:19 +02:00
|
|
|
|
|
|
|
struct bgp_zebra_opaque {
|
2021-08-06 16:06:39 +02:00
|
|
|
char aspath[256];
|
2021-04-18 20:53:19 +02:00
|
|
|
|
|
|
|
/* Show at least 10 communities AA:BB */
|
|
|
|
char community[COMMUNITY_SIZE * 20];
|
|
|
|
|
|
|
|
/* Show at least 10 large-communities AA:BB:CC */
|
|
|
|
char lcommunity[LCOMMUNITY_SIZE * 30];
|
2021-08-06 18:54:57 +02:00
|
|
|
|
|
|
|
/* 32 bytes seems enough because of
|
|
|
|
* bgp_path_selection_confed_as_path which is
|
|
|
|
* `Confederation based AS Path`.
|
|
|
|
*/
|
|
|
|
char selection_reason[BGP_MAX_SELECTION_REASON_STR_BUF];
|
2021-04-18 20:53:19 +02:00
|
|
|
};
|
|
|
|
|
lib, ospfd, ospf6d, zebra: add OSPF opaque route attributes
Update ospfd and ospf6d to send opaque route attributes to
zebra. Those attributes are stored in the RIB and can be viewed
using the "show ip[v6] route" commands (other than that, they are
completely ignored by zebra).
Example:
```
debian# show ip route 192.168.1.0/24
Routing entry for 192.168.1.0/24
Known via "ospf", distance 110, metric 20, best
Last update 01:57:08 ago
* 10.0.1.2, via eth-rt2, weight 1
OSPF path type : External-2
OSPF tag : 0
debian#
debian# show ip route 192.168.1.0/24 json
{
"192.168.1.0\/24":[
{
"prefix":"192.168.1.0\/24",
"prefixLen":24,
"protocol":"ospf",
"vrfId":0,
"vrfName":"default",
"selected":true,
[snip]
"ospfPathType":"External-2",
"ospfTag":"0"
}
]
}
```
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 03:15:55 +02:00
|
|
|
struct ospf_zebra_opaque {
|
|
|
|
char path_type[32];
|
|
|
|
char area_id[INET_ADDRSTRLEN];
|
|
|
|
char tag[16];
|
|
|
|
};
|
|
|
|
|
2021-08-06 16:09:46 +02:00
|
|
|
static_assert(sizeof(struct bgp_zebra_opaque) <= ZAPI_MESSAGE_OPAQUE_LENGTH,
|
|
|
|
"BGP opaque data shouldn't be larger than zebra's buffer");
|
lib, ospfd, ospf6d, zebra: add OSPF opaque route attributes
Update ospfd and ospf6d to send opaque route attributes to
zebra. Those attributes are stored in the RIB and can be viewed
using the "show ip[v6] route" commands (other than that, they are
completely ignored by zebra).
Example:
```
debian# show ip route 192.168.1.0/24
Routing entry for 192.168.1.0/24
Known via "ospf", distance 110, metric 20, best
Last update 01:57:08 ago
* 10.0.1.2, via eth-rt2, weight 1
OSPF path type : External-2
OSPF tag : 0
debian#
debian# show ip route 192.168.1.0/24 json
{
"192.168.1.0\/24":[
{
"prefix":"192.168.1.0\/24",
"prefixLen":24,
"protocol":"ospf",
"vrfId":0,
"vrfName":"default",
"selected":true,
[snip]
"ospfPathType":"External-2",
"ospfTag":"0"
}
]
}
```
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2021-09-21 03:15:55 +02:00
|
|
|
static_assert(sizeof(struct ospf_zebra_opaque) <= ZAPI_MESSAGE_OPAQUE_LENGTH,
|
|
|
|
"OSPF opaque data shouldn't be larger than zebra's buffer");
|
2021-08-06 16:09:46 +02:00
|
|
|
|
2021-04-18 20:53:19 +02:00
|
|
|
#endif /* FRR_ROUTE_OPAQUE_H */
|