mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-30 03:00:24 +00:00
staticd: convert typedef to enum
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
7a41218be4
commit
9ccaa12da6
@ -122,7 +122,7 @@ struct nexthop_iter {
|
|||||||
static int nexthop_iter_cb(const struct lyd_node *dnode, void *arg)
|
static int nexthop_iter_cb(const struct lyd_node *dnode, void *arg)
|
||||||
{
|
{
|
||||||
struct nexthop_iter *iter = arg;
|
struct nexthop_iter *iter = arg;
|
||||||
int nh_type;
|
enum static_nh_type nh_type;
|
||||||
|
|
||||||
nh_type = yang_dnode_get_enum(dnode, "./nh-type");
|
nh_type = yang_dnode_get_enum(dnode, "./nh-type");
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ static bool static_nexthop_create(struct nb_cb_create_args *args)
|
|||||||
struct static_path *pn;
|
struct static_path *pn;
|
||||||
struct ipaddr ipaddr;
|
struct ipaddr ipaddr;
|
||||||
struct static_nexthop *nh;
|
struct static_nexthop *nh;
|
||||||
int nh_type;
|
enum static_nh_type nh_type;
|
||||||
const char *ifname;
|
const char *ifname;
|
||||||
const char *nh_vrf;
|
const char *nh_vrf;
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ static int static_nexthop_mpls_label_modify(struct nb_cb_modify_args *args)
|
|||||||
static int static_nexthop_onlink_modify(struct nb_cb_modify_args *args)
|
static int static_nexthop_onlink_modify(struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
struct static_nexthop *nh;
|
struct static_nexthop *nh;
|
||||||
static_types nh_type;
|
enum static_nh_type nh_type;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
@ -352,7 +352,7 @@ static int static_nexthop_color_destroy(struct nb_cb_destroy_args *args)
|
|||||||
static int static_nexthop_bh_type_modify(struct nb_cb_modify_args *args)
|
static int static_nexthop_bh_type_modify(struct nb_cb_modify_args *args)
|
||||||
{
|
{
|
||||||
struct static_nexthop *nh;
|
struct static_nexthop *nh;
|
||||||
static_types nh_type;
|
enum static_nh_type nh_type;
|
||||||
|
|
||||||
switch (args->event) {
|
switch (args->event) {
|
||||||
case NB_EV_VALIDATE:
|
case NB_EV_VALIDATE:
|
||||||
|
@ -186,7 +186,8 @@ void static_del_route(struct route_node *rn)
|
|||||||
route_unlock_node(rn);
|
route_unlock_node(rn);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool static_add_nexthop_validate(const char *nh_vrf_name, static_types type,
|
bool static_add_nexthop_validate(const char *nh_vrf_name,
|
||||||
|
enum static_nh_type type,
|
||||||
struct ipaddr *ipaddr)
|
struct ipaddr *ipaddr)
|
||||||
{
|
{
|
||||||
struct vrf *vrf;
|
struct vrf *vrf;
|
||||||
@ -257,7 +258,7 @@ void static_del_path(struct static_path *pn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct static_nexthop *static_add_nexthop(struct static_path *pn,
|
struct static_nexthop *static_add_nexthop(struct static_path *pn,
|
||||||
static_types type,
|
enum static_nh_type type,
|
||||||
struct ipaddr *ipaddr,
|
struct ipaddr *ipaddr,
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
const char *nh_vrf, uint32_t color)
|
const char *nh_vrf, uint32_t color)
|
||||||
@ -772,7 +773,7 @@ void static_ifindex_update(struct interface *ifp, bool up)
|
|||||||
static_ifindex_update_af(ifp, up, AFI_IP6, SAFI_MULTICAST);
|
static_ifindex_update_af(ifp, up, AFI_IP6, SAFI_MULTICAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
void static_get_nh_type(static_types stype, char *type, size_t size)
|
void static_get_nh_type(enum static_nh_type stype, char *type, size_t size)
|
||||||
{
|
{
|
||||||
switch (stype) {
|
switch (stype) {
|
||||||
case STATIC_IFNAME:
|
case STATIC_IFNAME:
|
||||||
|
@ -47,14 +47,14 @@ enum static_blackhole_type {
|
|||||||
* The order for below macros should be in sync with
|
* The order for below macros should be in sync with
|
||||||
* yang model typedef nexthop-type
|
* yang model typedef nexthop-type
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
enum static_nh_type {
|
||||||
STATIC_IFNAME = 1,
|
STATIC_IFNAME = 1,
|
||||||
STATIC_IPV4_GATEWAY,
|
STATIC_IPV4_GATEWAY,
|
||||||
STATIC_IPV4_GATEWAY_IFNAME,
|
STATIC_IPV4_GATEWAY_IFNAME,
|
||||||
STATIC_IPV6_GATEWAY,
|
STATIC_IPV6_GATEWAY,
|
||||||
STATIC_IPV6_GATEWAY_IFNAME,
|
STATIC_IPV6_GATEWAY_IFNAME,
|
||||||
STATIC_BLACKHOLE,
|
STATIC_BLACKHOLE,
|
||||||
} static_types;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Route Creation gives us:
|
* Route Creation gives us:
|
||||||
@ -123,7 +123,7 @@ struct static_nexthop {
|
|||||||
enum static_install_states state;
|
enum static_install_states state;
|
||||||
|
|
||||||
/* Flag for this static route's type. */
|
/* Flag for this static route's type. */
|
||||||
static_types type;
|
enum static_nh_type type;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Nexthop value.
|
* Nexthop value.
|
||||||
@ -169,7 +169,7 @@ extern struct zebra_privs_t static_privs;
|
|||||||
void static_fixup_vrf_ids(struct static_vrf *svrf);
|
void static_fixup_vrf_ids(struct static_vrf *svrf);
|
||||||
|
|
||||||
extern struct static_nexthop *
|
extern struct static_nexthop *
|
||||||
static_add_nexthop(struct static_path *pn, static_types type,
|
static_add_nexthop(struct static_path *pn, enum static_nh_type type,
|
||||||
struct ipaddr *ipaddr, const char *ifname,
|
struct ipaddr *ipaddr, const char *ifname,
|
||||||
const char *nh_vrf, uint32_t color);
|
const char *nh_vrf, uint32_t color);
|
||||||
extern void static_install_nexthop(struct static_nexthop *nh);
|
extern void static_install_nexthop(struct static_nexthop *nh);
|
||||||
@ -194,9 +194,10 @@ extern struct static_path *static_add_path(struct route_node *rn,
|
|||||||
uint32_t table_id, uint8_t distance);
|
uint32_t table_id, uint8_t distance);
|
||||||
extern void static_del_path(struct static_path *pn);
|
extern void static_del_path(struct static_path *pn);
|
||||||
|
|
||||||
extern void static_get_nh_type(static_types stype, char *type, size_t size);
|
extern void static_get_nh_type(enum static_nh_type stype, char *type,
|
||||||
|
size_t size);
|
||||||
extern bool static_add_nexthop_validate(const char *nh_vrf_name,
|
extern bool static_add_nexthop_validate(const char *nh_vrf_name,
|
||||||
static_types type,
|
enum static_nh_type type,
|
||||||
struct ipaddr *ipaddr);
|
struct ipaddr *ipaddr);
|
||||||
extern struct stable_info *static_get_stable_info(struct route_node *rn);
|
extern struct stable_info *static_get_stable_info(struct route_node *rn);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ static int static_route_leak(struct vty *vty, const char *svrf,
|
|||||||
int ret;
|
int ret;
|
||||||
struct prefix p, src;
|
struct prefix p, src;
|
||||||
struct in_addr mask;
|
struct in_addr mask;
|
||||||
uint8_t type;
|
enum static_nh_type type;
|
||||||
const char *bh_type;
|
const char *bh_type;
|
||||||
char xpath_prefix[XPATH_MAXLEN];
|
char xpath_prefix[XPATH_MAXLEN];
|
||||||
char xpath_nexthop[XPATH_MAXLEN];
|
char xpath_nexthop[XPATH_MAXLEN];
|
||||||
|
Loading…
Reference in New Issue
Block a user