diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-06-29 15:05:17 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-08-08 15:15:22 +0200 |
commit | e63831f1336beb25192e3a55143c46abe4a55210 (patch) | |
tree | f4f75128a75fff1ed8d2c63a24d509e38f9260eb /zebra | |
parent | zebra: Cleanup unguarded debug (diff) | |
download | frr-e63831f1336beb25192e3a55143c46abe4a55210.tar.xz frr-e63831f1336beb25192e3a55143c46abe4a55210.zip |
zebra: Add IF_ZEBRA_DATA_X define
There are 2 defines IF_ZEBRA_MULTICAST_X and
IF_ZEBRA_SHUTDOWN_X macros that do the same
thing. Combine into one.
Future commits will use the IF_ZEBRA_DATA_X macro
as well.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/interface.c | 59 | ||||
-rw-r--r-- | zebra/interface.h | 12 |
2 files changed, 33 insertions, 38 deletions
diff --git a/zebra/interface.c b/zebra/interface.c index de7db2d48..c66f103b3 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -147,8 +147,8 @@ static int if_zebra_new_hook(struct interface *ifp) zebra_if = XCALLOC(MTYPE_ZINFO, sizeof(struct zebra_if)); zebra_if->ifp = ifp; - zebra_if->multicast = IF_ZEBRA_MULTICAST_UNSPEC; - zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_OFF; + zebra_if->multicast = IF_ZEBRA_DATA_UNSPEC; + zebra_if->shutdown = IF_ZEBRA_DATA_OFF; zebra_if_nhg_dependents_init(zebra_if); @@ -583,9 +583,9 @@ void if_add_update(struct interface *ifp) if_data = ifp->info; assert(if_data); - if (if_data->multicast == IF_ZEBRA_MULTICAST_ON) + if (if_data->multicast == IF_ZEBRA_DATA_ON) if_set_flags(ifp, IFF_MULTICAST); - else if (if_data->multicast == IF_ZEBRA_MULTICAST_OFF) + else if (if_data->multicast == IF_ZEBRA_DATA_OFF) if_unset_flags(ifp, IFF_MULTICAST); zebra_ptm_if_set_ptm_state(ifp, if_data); @@ -595,7 +595,7 @@ void if_add_update(struct interface *ifp) if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) { SET_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE); - if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) { + if (if_data->shutdown == IF_ZEBRA_DATA_ON) { if (IS_ZEBRA_DEBUG_KERNEL) { zlog_debug( "interface %s vrf %s(%u) index %d is shutdown. Won't wake it up.", @@ -2908,7 +2908,7 @@ int if_multicast_set(struct interface *ifp) if_refresh(ifp); } if_data = ifp->info; - if_data->multicast = IF_ZEBRA_MULTICAST_ON; + if_data->multicast = IF_ZEBRA_DATA_ON; return 0; } @@ -2931,7 +2931,7 @@ DEFUN (multicast, if_refresh(ifp); } if_data = ifp->info; - if_data->multicast = IF_ZEBRA_MULTICAST_ON; + if_data->multicast = IF_ZEBRA_DATA_ON; return CMD_SUCCESS; } @@ -2949,7 +2949,7 @@ int if_multicast_unset(struct interface *ifp) if_refresh(ifp); } if_data = ifp->info; - if_data->multicast = IF_ZEBRA_MULTICAST_OFF; + if_data->multicast = IF_ZEBRA_DATA_OFF; return 0; } @@ -2973,7 +2973,7 @@ DEFUN (no_multicast, if_refresh(ifp); } if_data = ifp->info; - if_data->multicast = IF_ZEBRA_MULTICAST_OFF; + if_data->multicast = IF_ZEBRA_DATA_OFF; return CMD_SUCCESS; } @@ -3039,7 +3039,7 @@ int if_shutdown(struct interface *ifp) if_refresh(ifp); } if_data = ifp->info; - if_data->shutdown = IF_ZEBRA_SHUTDOWN_ON; + if_data->shutdown = IF_ZEBRA_DATA_ON; return 0; } @@ -3064,7 +3064,7 @@ DEFUN (shutdown_if, if_refresh(ifp); } if_data = ifp->info; - if_data->shutdown = IF_ZEBRA_SHUTDOWN_ON; + if_data->shutdown = IF_ZEBRA_DATA_ON; return CMD_SUCCESS; } @@ -3088,7 +3088,7 @@ int if_no_shutdown(struct interface *ifp) } if_data = ifp->info; - if_data->shutdown = IF_ZEBRA_SHUTDOWN_OFF; + if_data->shutdown = IF_ZEBRA_DATA_OFF; return 0; } @@ -3119,7 +3119,7 @@ DEFUN (no_shutdown_if, } if_data = ifp->info; - if_data->shutdown = IF_ZEBRA_SHUTDOWN_OFF; + if_data->shutdown = IF_ZEBRA_DATA_OFF; return CMD_SUCCESS; } @@ -3906,9 +3906,9 @@ int if_ip_address_install(struct interface *ifp, struct prefix *prefix, SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED); /* In case of this route need to install kernel. */ - if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) - && CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) - && !(if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)) { + if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) && + CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) && + !(if_data && if_data->shutdown == IF_ZEBRA_DATA_ON)) { /* Some system need to up the interface to set IP address. */ if (!if_is_up(ifp)) { if_set_flags(ifp, IFF_UP | IFF_RUNNING); @@ -4001,9 +4001,9 @@ static int ip_address_install(struct vty *vty, struct interface *ifp, SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED); /* In case of this route need to install kernel. */ - if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) - && CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) - && !(if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)) { + if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) && + CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) && + !(if_data && if_data->shutdown == IF_ZEBRA_DATA_ON)) { /* Some system need to up the interface to set IP address. */ if (!if_is_up(ifp)) { if_set_flags(ifp, IFF_UP | IFF_RUNNING); @@ -4264,9 +4264,9 @@ int if_ipv6_address_install(struct interface *ifp, struct prefix *prefix, SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED); /* In case of this route need to install kernel. */ - if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) - && CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) - && !(if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)) { + if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) && + CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) && + !(if_data && if_data->shutdown == IF_ZEBRA_DATA_ON)) { /* Some system need to up the interface to set IP address. */ if (!if_is_up(ifp)) { if_set_flags(ifp, IFF_UP | IFF_RUNNING); @@ -4337,9 +4337,9 @@ static int ipv6_address_install(struct vty *vty, struct interface *ifp, SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED); /* In case of this route need to install kernel. */ - if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) - && CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) - && !(if_data && if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON)) { + if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_QUEUED) && + CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE) && + !(if_data && if_data->shutdown == IF_ZEBRA_DATA_ON)) { /* Some system need to up the interface to set IP address. */ if (!if_is_up(ifp)) { if_set_flags(ifp, IFF_UP | IFF_RUNNING); @@ -4524,7 +4524,7 @@ static int if_config_write(struct vty *vty) if_vty_config_start(vty, ifp); if (if_data) { - if (if_data->shutdown == IF_ZEBRA_SHUTDOWN_ON) + if (if_data->shutdown == IF_ZEBRA_DATA_ON) vty_out(vty, " shutdown\n"); zebra_ptm_if_write(vty, if_data); @@ -4574,11 +4574,10 @@ static int if_config_write(struct vty *vty) } if (if_data) { - if (if_data->multicast - != IF_ZEBRA_MULTICAST_UNSPEC) + if (if_data->multicast != IF_ZEBRA_DATA_UNSPEC) vty_out(vty, " %smulticast\n", - if_data->multicast - == IF_ZEBRA_MULTICAST_ON + if_data->multicast == + IF_ZEBRA_DATA_ON ? "" : "no "); } diff --git a/zebra/interface.h b/zebra/interface.h index f3f41b90c..801078e83 100644 --- a/zebra/interface.h +++ b/zebra/interface.h @@ -36,14 +36,10 @@ extern "C" { #endif -/* For interface multicast configuration. */ -#define IF_ZEBRA_MULTICAST_UNSPEC 0 -#define IF_ZEBRA_MULTICAST_ON 1 -#define IF_ZEBRA_MULTICAST_OFF 2 - -/* For interface shutdown configuration. */ -#define IF_ZEBRA_SHUTDOWN_OFF 0 -#define IF_ZEBRA_SHUTDOWN_ON 1 +/* For interface configuration. */ +#define IF_ZEBRA_DATA_UNSPEC 0 +#define IF_ZEBRA_DATA_ON 1 +#define IF_ZEBRA_DATA_OFF 2 #define IF_VLAN_BITMAP_MAX 4096 |