From 65b3352c5bd4f83eb2d8e0f1cef58cb5a2ec5caa Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 24 Jan 2024 18:23:51 -0500 Subject: [PATCH] *: Remove int return for zapi functions The code never uses the return code for Zapi functions. Let's remove it. Signed-off-by: Donald Sharp --- babeld/babel_interface.c | 13 +--- babeld/babel_interface.h | 12 +-- babeld/babel_zebra.c | 9 +-- bfdd/ptm_adapter.c | 13 +--- bgpd/bgp_zebra.c | 163 ++++++++++++++++----------------------- bgpd/rfapi/vnc_zebra.c | 15 ++-- eigrpd/eigrp_zebra.c | 42 ++++------ isisd/isis_zebra.c | 93 ++++++++-------------- ldpd/ldp_zebra.c | 64 ++++++--------- lib/bfd.c | 18 ++--- lib/zclient.c | 54 ++++++------- lib/zclient.h | 10 +-- nhrpd/netlink_arp.c | 11 ++- nhrpd/nhrp_interface.c | 14 ++-- nhrpd/nhrp_route.c | 18 ++--- nhrpd/nhrpd.h | 18 ++--- ospf6d/ospf6_zebra.c | 30 +++---- ospfd/ospf_zebra.c | 69 +++++++---------- pathd/path_zebra.c | 31 +++----- pbrd/pbr_zebra.c | 23 ++---- pimd/pim_mlag.c | 38 ++++----- pimd/pim_mlag.h | 6 +- pimd/pim_zebra.c | 27 +++---- ripd/rip_interface.c | 10 +-- ripd/rip_interface.h | 16 ++-- ripd/rip_zebra.c | 8 +- ripngd/ripng_interface.c | 10 +-- ripngd/ripng_zebra.c | 19 +++-- ripngd/ripngd.h | 12 +-- sharpd/sharp_zebra.c | 53 +++++-------- staticd/static_zebra.c | 15 ++-- vrrpd/vrrp_zebra.c | 23 ++---- 32 files changed, 375 insertions(+), 582 deletions(-) diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index c4349b509e88..57cab9a34e4d 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -88,8 +88,7 @@ babel_ifp_destroy(struct interface *ifp) return 0; } -int -babel_interface_address_add (ZAPI_CALLBACK_ARGS) +void babel_interface_address_add(ZAPI_CALLBACK_ARGS) { babel_interface_nfo *babel_ifp; struct connected *ifc; @@ -101,7 +100,7 @@ babel_interface_address_add (ZAPI_CALLBACK_ARGS) zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; prefix = ifc->address; @@ -120,12 +119,9 @@ babel_interface_address_add (ZAPI_CALLBACK_ARGS) send_request(ifc->ifp, NULL, 0); send_update(ifc->ifp, 0, NULL, 0); - - return 0; } -int -babel_interface_address_delete (ZAPI_CALLBACK_ARGS) +void babel_interface_address_delete(ZAPI_CALLBACK_ARGS) { babel_interface_nfo *babel_ifp; struct connected *ifc; @@ -137,7 +133,7 @@ babel_interface_address_delete (ZAPI_CALLBACK_ARGS) zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; prefix = ifc->address; @@ -156,7 +152,6 @@ babel_interface_address_delete (ZAPI_CALLBACK_ARGS) send_update(ifc->ifp, 0, NULL, 0); connected_free(&ifc); - return 0; } /* Lookup function. */ diff --git a/babeld/babel_interface.h b/babeld/babel_interface.h index a585e23afc70..ab14020a36ed 100644 --- a/babeld/babel_interface.h +++ b/babeld/babel_interface.h @@ -96,12 +96,12 @@ struct buffered_update { void babel_if_init(void); /* Callback functions for zebra client */ -int babel_interface_up (int, struct zclient *, zebra_size_t, vrf_id_t); -int babel_interface_down (int, struct zclient *, zebra_size_t, vrf_id_t); -int babel_interface_add (int, struct zclient *, zebra_size_t, vrf_id_t); -int babel_interface_delete (int, struct zclient *, zebra_size_t, vrf_id_t); -int babel_interface_address_add (int, struct zclient *, zebra_size_t, vrf_id_t); -int babel_interface_address_delete (int, struct zclient *, zebra_size_t, vrf_id_t); +void babel_interface_up(ZAPI_CALLBACK_ARGS); +void babel_interface_down(ZAPI_CALLBACK_ARGS); +void babel_interface_add(ZAPI_CALLBACK_ARGS); +void babel_interface_delete(ZAPI_CALLBACK_ARGS); +void babel_interface_address_add(ZAPI_CALLBACK_ARGS); +void babel_interface_address_delete(ZAPI_CALLBACK_ARGS); int babel_ifp_create(struct interface *ifp); int babel_ifp_up(struct interface *ifp); diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c index bead9f27ef16..f3085752a788 100644 --- a/babeld/babel_zebra.c +++ b/babeld/babel_zebra.c @@ -38,25 +38,22 @@ static const struct { }; /* Zebra route add and delete treatment. */ -static int -babel_zebra_read_route (ZAPI_CALLBACK_ARGS) +static void babel_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; /* we completely ignore srcdest routes for now. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) - return 0; + return; if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) { babel_route_add(&api); } else { babel_route_delete(&api); } - - return 0; } /* [Babel Command] */ diff --git a/bfdd/ptm_adapter.c b/bfdd/ptm_adapter.c index b5ab2ef1d0db..e8710ea84e2f 100644 --- a/bfdd/ptm_adapter.c +++ b/bfdd/ptm_adapter.c @@ -589,7 +589,7 @@ static void bfdd_client_deregister(struct stream *msg) zlog_err("ptm-del-client: failed to deregister client"); } -static int bfdd_replay(ZAPI_CALLBACK_ARGS) +static void bfdd_replay(ZAPI_CALLBACK_ARGS) { struct stream *msg = zclient->ibuf; uint32_t rcmd; @@ -614,14 +614,11 @@ static int bfdd_replay(ZAPI_CALLBACK_ARGS) default: if (bglobal.debug_zebra) zlog_debug("ptm-replay: invalid message type %u", rcmd); - return -1; + return; } - return 0; - stream_failure: zlog_err("ptm-replay: failed to find command"); - return -1; } static void bfdd_zebra_connected(struct zclient *zc) @@ -779,13 +776,13 @@ static void bfdd_sessions_enable_address(struct connected *ifc) } } -static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS) +static void bfdd_interface_address_update(ZAPI_CALLBACK_ARGS) { struct connected *ifc; ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; if (bglobal.debug_zebra) zlog_debug("zclient: %s local address %pFX (VRF %u)", @@ -797,8 +794,6 @@ static int bfdd_interface_address_update(ZAPI_CALLBACK_ARGS) bfdd_sessions_enable_address(ifc); else connected_free(&ifc); - - return 0; } static int bfd_ifp_create(struct interface *ifp) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 0db0ac487380..1296f7c50a59 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -86,7 +86,7 @@ static inline bool bgp_install_info_to_zebra(struct bgp *bgp) int zclient_num_connects; /* Router-id update message from zebra. */ -static int bgp_router_id_update(ZAPI_CALLBACK_ARGS) +static void bgp_router_id_update(ZAPI_CALLBACK_ARGS) { struct prefix router_id; @@ -97,7 +97,6 @@ static int bgp_router_id_update(ZAPI_CALLBACK_ARGS) &router_id); bgp_router_id_zebra_bump(vrf_id, &router_id); - return 0; } /* Set or clear interface on which unnumbered neighbor is configured. This @@ -123,10 +122,9 @@ static void bgp_update_interface_nbrs(struct bgp *bgp, struct interface *ifp, } } -static int bgp_read_fec_update(ZAPI_CALLBACK_ARGS) +static void bgp_read_fec_update(ZAPI_CALLBACK_ARGS) { bgp_parse_fec_update(); - return 0; } static void bgp_start_interface_nbrs(struct bgp *bgp, struct interface *ifp) @@ -285,7 +283,7 @@ static int bgp_ifp_down(struct interface *ifp) return 0; } -static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) +static void bgp_interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *ifc; struct bgp *bgp; @@ -300,14 +298,14 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; if (bgp_debug_zebra(ifc->address)) zlog_debug("Rx Intf address add VRF %u IF %s addr %pFX", vrf_id, ifc->ifp->name, ifc->address); if (!bgp) - return 0; + return; if (if_is_operative(ifc->ifp)) { bgp_connected_add(bgp, ifc); @@ -362,11 +360,9 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) } } } - - return 0; } -static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) +static void bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct listnode *node, *nnode; struct connected *ifc; @@ -379,7 +375,7 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; if (bgp_debug_zebra(ifc->address)) zlog_debug("Rx Intf address del VRF %u IF %s addr %pFX", vrf_id, @@ -419,11 +415,9 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) } connected_free(&ifc); - - return 0; } -static int bgp_interface_nbr_address_add(ZAPI_CALLBACK_ARGS) +static void bgp_interface_nbr_address_add(ZAPI_CALLBACK_ARGS) { struct nbr_connected *ifc = NULL; struct bgp *bgp; @@ -431,7 +425,7 @@ static int bgp_interface_nbr_address_add(ZAPI_CALLBACK_ARGS) ifc = zebra_interface_nbr_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; if (bgp_debug_zebra(ifc->address)) zlog_debug("Rx Intf neighbor add VRF %u IF %s addr %pFX", @@ -442,11 +436,9 @@ static int bgp_interface_nbr_address_add(ZAPI_CALLBACK_ARGS) if (bgp) bgp_nbr_connected_add(bgp, ifc); } - - return 0; } -static int bgp_interface_nbr_address_delete(ZAPI_CALLBACK_ARGS) +static void bgp_interface_nbr_address_delete(ZAPI_CALLBACK_ARGS) { struct nbr_connected *ifc = NULL; struct bgp *bgp; @@ -454,7 +446,7 @@ static int bgp_interface_nbr_address_delete(ZAPI_CALLBACK_ARGS) ifc = zebra_interface_nbr_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; if (bgp_debug_zebra(ifc->address)) zlog_debug("Rx Intf neighbor del VRF %u IF %s addr %pFX", @@ -467,12 +459,10 @@ static int bgp_interface_nbr_address_delete(ZAPI_CALLBACK_ARGS) } nbr_connected_free(ifc); - - return 0; } /* Zebra route add and delete treatment. */ -static int zebra_read_route(ZAPI_CALLBACK_ARGS) +static void zebra_read_route(ZAPI_CALLBACK_ARGS) { enum nexthop_types_t nhtype; enum blackhole_type bhtype = BLACKHOLE_UNSPEC; @@ -484,19 +474,19 @@ static int zebra_read_route(ZAPI_CALLBACK_ARGS) bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) - return 0; + return; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; /* we completely ignore srcdest routes for now. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) - return 0; + return; /* ignore link-local address. */ if (api.prefix.family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&api.prefix.u.prefix6)) - return 0; + return; ifindex = api.nexthops[0].ifindex; nhtype = api.nexthops[0].type; @@ -551,8 +541,6 @@ static int zebra_read_route(ZAPI_CALLBACK_ARGS) &api.prefix); } } - - return 0; } struct interface *if_lookup_by_ipv4(struct in_addr *addr, vrf_id_t vrf_id) @@ -2350,7 +2338,7 @@ int bgp_zebra_dup_addr_detection(struct bgp *bgp) return zclient_send_message(zclient); } -static int rule_notify_owner(ZAPI_CALLBACK_ARGS) +static void rule_notify_owner(ZAPI_CALLBACK_ARGS) { uint32_t seqno, priority, unique; enum zapi_rule_notify_owner note; @@ -2360,7 +2348,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS) if (!zapi_rule_notify_decode(zclient->ibuf, &seqno, &priority, &unique, ifname, ¬e)) - return -1; + return; bgp_pbra = bgp_pbr_action_rule_lookup(vrf_id, unique); if (!bgp_pbra) { @@ -2370,7 +2358,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS) if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("%s: Fail to look BGP rule (%u)", __func__, unique); - return 0; + return; } } @@ -2418,11 +2406,9 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS) zlog_debug("%s: Received RULE REMOVED", __func__); break; } - - return 0; } -static int ipset_notify_owner(ZAPI_CALLBACK_ARGS) +static void ipset_notify_owner(ZAPI_CALLBACK_ARGS) { uint32_t unique; enum zapi_ipset_notify_owner note; @@ -2431,14 +2417,14 @@ static int ipset_notify_owner(ZAPI_CALLBACK_ARGS) if (!zapi_ipset_notify_decode(zclient->ibuf, &unique, ¬e)) - return -1; + return; bgp_pbim = bgp_pbr_match_ipset_lookup(vrf_id, unique); if (!bgp_pbim) { if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("%s: Fail to look BGP match ( %u, ID %u)", __func__, note, unique); - return 0; + return; } switch (note) { @@ -2460,11 +2446,9 @@ static int ipset_notify_owner(ZAPI_CALLBACK_ARGS) zlog_debug("%s: Received IPSET REMOVED", __func__); break; } - - return 0; } -static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS) +static void ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS) { uint32_t unique; char ipset_name[ZEBRA_IPSET_NAME_SIZE]; @@ -2476,7 +2460,7 @@ static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS) &unique, ipset_name, ¬e)) - return -1; + return; bgp_pbime = bgp_pbr_match_ipset_entry_lookup(vrf_id, ipset_name, unique); @@ -2485,7 +2469,7 @@ static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS) zlog_debug( "%s: Fail to look BGP match entry (%u, ID %u)", __func__, note, unique); - return 0; + return; } switch (note) { @@ -2526,10 +2510,9 @@ static int ipset_entry_notify_owner(ZAPI_CALLBACK_ARGS) __func__); break; } - return 0; } -static int iptable_notify_owner(ZAPI_CALLBACK_ARGS) +static void iptable_notify_owner(ZAPI_CALLBACK_ARGS) { uint32_t unique; enum zapi_iptable_notify_owner note; @@ -2539,13 +2522,13 @@ static int iptable_notify_owner(ZAPI_CALLBACK_ARGS) zclient->ibuf, &unique, ¬e)) - return -1; + return; bgpm = bgp_pbr_match_iptable_lookup(vrf_id, unique); if (!bgpm) { if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("%s: Fail to look BGP iptable (%u %u)", __func__, note, unique); - return 0; + return; } switch (note) { case ZAPI_IPTABLE_FAIL_INSTALL: @@ -2568,12 +2551,10 @@ static int iptable_notify_owner(ZAPI_CALLBACK_ARGS) zlog_debug("%s: Received IPTABLE REMOVED", __func__); break; } - return 0; } /* Process route notification messages from RIB */ -static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, - zebra_size_t length, vrf_id_t vrf_id) +static void bgp_zebra_route_notify_owner(ZAPI_CALLBACK_ARGS) { struct prefix p; enum zapi_route_notify_owner note; @@ -2587,7 +2568,7 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e, &afi, &safi)) { zlog_err("%s : error in msg decode", __func__); - return -1; + return; } /* Get the bgp instance */ @@ -2596,14 +2577,14 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, flog_err(EC_BGP_INVALID_BGP_INSTANCE, "%s : bgp instance not found vrf %d", __func__, vrf_id); - return -1; + return; } /* Find the bgp route node */ dest = bgp_safi_node_lookup(bgp->rib[afi][safi], safi, &p, &bgp->vrf_prd); if (!dest) - return -1; + return; switch (note) { case ZAPI_ROUTE_INSTALLED: @@ -2628,7 +2609,7 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, "selected route %pBD not found", dest); bgp_dest_unlock_node(dest); - return -1; + return; } break; case ZAPI_ROUTE_REMOVED: @@ -2677,7 +2658,6 @@ static int bgp_zebra_route_notify_owner(int command, struct zclient *zclient, } bgp_dest_unlock_node(dest); - return 0; } /* this function is used to forge ip rule, @@ -2834,7 +2814,7 @@ static void bgp_zebra_connected(struct zclient *zclient) BGP_GR_ROUTER_DETECT_AND_SEND_CAPABILITY_TO_ZEBRA(bgp, bgp->peer); } -static int bgp_zebra_process_local_es_add(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_local_es_add(ZAPI_CALLBACK_ARGS) { esi_t esi; struct bgp *bgp = NULL; @@ -2847,7 +2827,7 @@ static int bgp_zebra_process_local_es_add(ZAPI_CALLBACK_ARGS) bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) - return 0; + return; s = zclient->ibuf; stream_get(&esi, s, sizeof(esi_t)); @@ -2867,11 +2847,9 @@ static int bgp_zebra_process_local_es_add(ZAPI_CALLBACK_ARGS) bgp_evpn_local_es_add(bgp, &esi, originator_ip, active, df_pref, !!bypass); - - return 0; } -static int bgp_zebra_process_local_es_del(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_local_es_del(ZAPI_CALLBACK_ARGS) { esi_t esi; struct bgp *bgp = NULL; @@ -2881,7 +2859,7 @@ static int bgp_zebra_process_local_es_del(ZAPI_CALLBACK_ARGS) memset(&esi, 0, sizeof(esi_t)); bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) - return 0; + return; s = zclient->ibuf; stream_get(&esi, s, sizeof(esi_t)); @@ -2893,11 +2871,9 @@ static int bgp_zebra_process_local_es_del(ZAPI_CALLBACK_ARGS) frrtrace(1, frr_bgp, evpn_mh_local_es_del_zrecv, &esi); bgp_evpn_local_es_del(bgp, &esi); - - return 0; } -static int bgp_zebra_process_local_es_evi(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_local_es_evi(ZAPI_CALLBACK_ARGS) { esi_t esi; vni_t vni; @@ -2907,7 +2883,7 @@ static int bgp_zebra_process_local_es_evi(ZAPI_CALLBACK_ARGS) bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) - return 0; + return; s = zclient->ibuf; stream_get(&esi, s, sizeof(esi_t)); @@ -2927,11 +2903,9 @@ static int bgp_zebra_process_local_es_evi(ZAPI_CALLBACK_ARGS) bgp_evpn_local_es_evi_del(bgp, &esi, vni); } - - return 0; } -static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS) { int filter = 0; vni_t l3vni = 0; @@ -2976,11 +2950,9 @@ static int bgp_zebra_process_local_l3vni(ZAPI_CALLBACK_ARGS) bgp_evpn_local_l3vni_del(l3vni, vrf_id); } - - return 0; } -static int bgp_zebra_process_local_vni(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_local_vni(ZAPI_CALLBACK_ARGS) { struct stream *s; vni_t vni; @@ -3001,7 +2973,7 @@ static int bgp_zebra_process_local_vni(ZAPI_CALLBACK_ARGS) bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) - return 0; + return; if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug( @@ -3014,18 +2986,19 @@ static int bgp_zebra_process_local_vni(ZAPI_CALLBACK_ARGS) frrtrace(4, frr_bgp, evpn_local_vni_add_zrecv, vni, vtep_ip, tenant_vrf_id, mcast_grp); - return bgp_evpn_local_vni_add( - bgp, vni, - vtep_ip.s_addr != INADDR_ANY ? vtep_ip : bgp->router_id, - tenant_vrf_id, mcast_grp, svi_ifindex); + bgp_evpn_local_vni_add(bgp, vni, + vtep_ip.s_addr != INADDR_ANY + ? vtep_ip + : bgp->router_id, + tenant_vrf_id, mcast_grp, svi_ifindex); } else { frrtrace(1, frr_bgp, evpn_local_vni_del_zrecv, vni); - return bgp_evpn_local_vni_del(bgp, vni); + bgp_evpn_local_vni_del(bgp, vni); } } -static int bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) { struct stream *s; vni_t vni; @@ -3050,7 +3023,7 @@ static int bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) "%u:Recv MACIP %s with invalid IP addr length %d", vrf_id, (cmd == ZEBRA_MACIP_ADD) ? "Add" : "Del", ipa_len); - return -1; + return; } if (ipa_len) { @@ -3069,7 +3042,7 @@ static int bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) bgp = bgp_lookup_by_vrf_id(vrf_id); if (!bgp) - return 0; + return; if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug( @@ -3082,17 +3055,17 @@ static int bgp_zebra_process_local_macip(ZAPI_CALLBACK_ARGS) frrtrace(6, frr_bgp, evpn_local_macip_add_zrecv, vni, &mac, &ip, flags, seqnum, &esi); - return bgp_evpn_local_macip_add(bgp, vni, &mac, &ip, - flags, seqnum, &esi); + bgp_evpn_local_macip_add(bgp, vni, &mac, &ip, flags, seqnum, + &esi); } else { frrtrace(4, frr_bgp, evpn_local_macip_del_zrecv, vni, &mac, &ip, state); - return bgp_evpn_local_macip_del(bgp, vni, &mac, &ip, state); + bgp_evpn_local_macip_del(bgp, vni, &mac, &ip, state); } } -static int bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS) { struct stream *s = NULL; struct bgp *bgp_vrf = NULL; @@ -3104,7 +3077,7 @@ static int bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS) bgp_vrf = bgp_lookup_by_vrf_id(vrf_id); if (!bgp_vrf) - return 0; + return; if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("Recv prefix %pFX %s on vrf %s", &p, @@ -3128,7 +3101,6 @@ static int bgp_zebra_process_local_ip_prefix(ZAPI_CALLBACK_ARGS) bgp_evpn_withdraw_type5_route(bgp_vrf, &p, AFI_IP6, SAFI_UNICAST); } - return 0; } extern struct zebra_privs_t bgpd_privs; @@ -3152,7 +3124,7 @@ static int bgp_ifp_create(struct interface *ifp) return 0; } -static int bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) { struct stream *s = NULL; struct bgp *bgp = bgp_get_default(); @@ -3167,40 +3139,37 @@ static int bgp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) zlog_err("%s: Locator name unmatch %s:%s", __func__, bgp->srv6_locator_name, chunk->locator_name); srv6_locator_chunk_free(&chunk); - return 0; + return; } for (ALL_LIST_ELEMENTS_RO(bgp->srv6_locator_chunks, node, c)) { if (!prefix_cmp(&c->prefix, &chunk->prefix)) { srv6_locator_chunk_free(&chunk); - return 0; + return; } } listnode_add(bgp->srv6_locator_chunks, chunk); vpn_leak_postchange_all(); - return 0; } -static int bgp_zebra_process_srv6_locator_add(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_srv6_locator_add(ZAPI_CALLBACK_ARGS) { struct srv6_locator loc = {}; struct bgp *bgp = bgp_get_default(); const char *loc_name = bgp->srv6_locator_name; if (zapi_srv6_locator_decode(zclient->ibuf, &loc) < 0) - return -1; + return; if (!bgp || !bgp->srv6_enabled) - return 0; + return; if (bgp_zebra_srv6_manager_get_locator_chunk(loc_name) < 0) - return -1; - - return 0; + return; } -static int bgp_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) +static void bgp_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) { struct srv6_locator loc = {}; struct bgp *bgp = bgp_get_default(); @@ -3212,7 +3181,7 @@ static int bgp_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) struct prefix_ipv6 tmp_prefi; if (zapi_srv6_locator_decode(zclient->ibuf, &loc) < 0) - return -1; + return; // refresh chunks for (ALL_LIST_ELEMENTS(bgp->srv6_locator_chunks, node, nnode, chunk)) @@ -3322,8 +3291,6 @@ static int bgp_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) &bgp_vrf->tovpn_sid_locator); } } - - return 0; } static zclient_handler *const bgp_handlers[] = { diff --git a/bgpd/rfapi/vnc_zebra.c b/bgpd/rfapi/vnc_zebra.c index 82c08cabde6e..03a55cc4d348 100644 --- a/bgpd/rfapi/vnc_zebra.c +++ b/bgpd/rfapi/vnc_zebra.c @@ -313,17 +313,17 @@ static void vnc_redistribute_withdraw(struct bgp *bgp, afi_t afi, uint8_t type) * * Assumes 1 nexthop */ -static int vnc_zebra_read_route(ZAPI_CALLBACK_ARGS) +static void vnc_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; int add; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; /* we completely ignore srcdest routes for now. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) - return 0; + return; add = (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD); if (add) @@ -332,12 +332,9 @@ static int vnc_zebra_read_route(ZAPI_CALLBACK_ARGS) vnc_redistribute_delete(&api.prefix, api.type); if (BGP_DEBUG(zebra, ZEBRA)) - vnc_zlog_debug_verbose( - "%s: Zebra rcvd: route delete %s %pFX metric %u", - __func__, zebra_route_string(api.type), &api.prefix, - api.metric); - - return 0; + vnc_zlog_debug_verbose("%s: Zebra rcvd: route delete %s %pFX metric %u", + __func__, zebra_route_string(api.type), + &api.prefix, api.metric); } /*********************************************************************** diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index a0eff683dbc9..6a9d6822427c 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -40,10 +40,10 @@ #include "eigrpd/eigrp_fsm.h" #include "eigrpd/eigrp_metric.h" -static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS); -static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS); +static void eigrp_interface_address_add(ZAPI_CALLBACK_ARGS); +static void eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS); -static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS); +static void eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS); /* Zebra structure to hold current status. */ struct zclient *zclient = NULL; @@ -53,7 +53,7 @@ extern struct event_loop *master; struct in_addr router_id_zebra; /* Router-id update message from zebra. */ -static int eigrp_router_id_update_zebra(ZAPI_CALLBACK_ARGS) +static void eigrp_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct eigrp *eigrp; struct prefix router_id; @@ -65,21 +65,15 @@ static int eigrp_router_id_update_zebra(ZAPI_CALLBACK_ARGS) if (eigrp != NULL) eigrp_router_id_update(eigrp); - - return 0; } -static int eigrp_zebra_route_notify_owner(ZAPI_CALLBACK_ARGS) +static void eigrp_zebra_route_notify_owner(ZAPI_CALLBACK_ARGS) { struct prefix p; enum zapi_route_notify_owner note; uint32_t table; - if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e, NULL, - NULL)) - return -1; - - return 0; + zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e, NULL, NULL); } static void eigrp_zebra_connected(struct zclient *zclient) @@ -107,49 +101,45 @@ void eigrp_zebra_init(void) /* Zebra route add and delete treatment. */ -static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS) +static void eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; struct eigrp *eigrp; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; if (IPV4_NET127(ntohl(api.prefix.u.prefix4.s_addr))) - return 0; + return; eigrp = eigrp_lookup(vrf_id); if (eigrp == NULL) - return 0; + return; if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) { } else /* if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */ { } - - return 0; } -static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS) +static void eigrp_interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *c; c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) zlog_debug("Zebra: interface %s address add %pFX", c->ifp->name, c->address); eigrp_if_update(c->ifp); - - return 0; } -static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS) +static void eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *c; struct interface *ifp; @@ -158,7 +148,7 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS) c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) zlog_debug("Zebra: interface %s address delete %pFX", @@ -167,15 +157,13 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS) ifp = c->ifp; ei = ifp->info; if (!ei) - return 0; + return; /* Call interface hook functions to clean up */ if (prefix_cmp(&ei->address, c->address) == 0) eigrp_if_free(ei, INTERFACE_DOWN_BY_ZEBRA); connected_free(&c); - - return 0; } void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p, diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 18a0c49cebc8..4ee47e205472 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -49,7 +49,7 @@ struct zclient *zclient; static struct zclient *zclient_sync; /* Router-id update message from zebra. */ -static int isis_router_id_update_zebra(ZAPI_CALLBACK_ARGS) +static void isis_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct isis_area *area; struct listnode *node; @@ -59,22 +59,20 @@ static int isis_router_id_update_zebra(ZAPI_CALLBACK_ARGS) isis = isis_lookup_by_vrfid(vrf_id); if (isis == NULL) { - return -1; + return; } zebra_router_id_update_read(zclient->ibuf, &router_id); if (isis->router_id == router_id.u.prefix4.s_addr) - return 0; + return; isis->router_id = router_id.u.prefix4.s_addr; for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) if (listcount(area->area_addrs) > 0) lsp_regenerate_schedule(area, area->is_type, 0); - - return 0; } -static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS) +static void isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS) { struct isis_circuit *circuit; struct connected *c; @@ -83,7 +81,7 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS) zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; #ifdef EXTREME_DEBUG if (c->address->family == AF_INET) @@ -99,11 +97,9 @@ static int isis_zebra_if_address_add(ZAPI_CALLBACK_ARGS) } sr_if_addr_update(c->ifp); - - return 0; } -static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS) +static void isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS) { struct isis_circuit *circuit; struct connected *c; @@ -112,7 +108,7 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS) zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; #ifdef EXTREME_DEBUG if (c->address->family == AF_INET) @@ -130,11 +126,9 @@ static int isis_zebra_if_address_del(ZAPI_CALLBACK_ARGS) sr_if_addr_update(c->ifp); connected_free(&c); - - return 0; } -static int isis_zebra_link_params(ZAPI_CALLBACK_ARGS) +static void isis_zebra_link_params(ZAPI_CALLBACK_ARGS) { struct interface *ifp; bool changed = false; @@ -142,12 +136,10 @@ static int isis_zebra_link_params(ZAPI_CALLBACK_ARGS) ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id, &changed); if (ifp == NULL || !changed) - return 0; + return; /* Update TE TLV */ isis_mpls_te_update(ifp); - - return 0; } enum isis_zebra_nexthop_type { @@ -474,7 +466,7 @@ void isis_zebra_send_adjacency_sid(int cmd, const struct sr_adjacency *sra) (void)zebra_send_mpls_labels(zclient, cmd, &zl); } -static int isis_zebra_read(ZAPI_CALLBACK_ARGS) +static void isis_zebra_read(ZAPI_CALLBACK_ARGS) { struct zapi_route api; struct isis *isis = NULL; @@ -482,14 +474,14 @@ static int isis_zebra_read(ZAPI_CALLBACK_ARGS) isis = isis_lookup_by_vrfid(vrf_id); if (isis == NULL) - return -1; + return; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; if (api.prefix.family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&api.prefix.u.prefix6)) - return 0; + return; /* * Avoid advertising a false default reachability. (A default @@ -509,8 +501,6 @@ static int isis_zebra_read(ZAPI_CALLBACK_ARGS) else isis_redist_delete(isis, api.type, &api.prefix, &api.src_prefix, api.instance); - - return 0; } int isis_distribute_list_update(int routetype) @@ -765,7 +755,7 @@ int isis_zebra_ls_register(bool up) /* * opaque messages between processes */ -static int isis_opaque_msg_handler(ZAPI_CALLBACK_ARGS) +static void isis_opaque_msg_handler(ZAPI_CALLBACK_ARGS) { struct stream *s; struct zapi_opaque_msg info; @@ -773,11 +763,10 @@ static int isis_opaque_msg_handler(ZAPI_CALLBACK_ARGS) struct ldp_igp_sync_if_state state; struct ldp_igp_sync_announce announce; struct zapi_rlfa_response rlfa; - int ret = 0; s = zclient->ibuf; if (zclient_opaque_decode(s, &info) != 0) - return -1; + return; switch (info.type) { case LINK_STATE_SYNC: @@ -785,15 +774,15 @@ static int isis_opaque_msg_handler(ZAPI_CALLBACK_ARGS) dst.instance = info.src_instance; dst.session_id = info.src_session_id; dst.type = LINK_STATE_SYNC; - ret = isis_te_sync_ted(dst); + isis_te_sync_ted(dst); break; case LDP_IGP_SYNC_IF_STATE_UPDATE: STREAM_GET(&state, s, sizeof(state)); - ret = isis_ldp_sync_state_update(state); + isis_ldp_sync_state_update(state); break; case LDP_IGP_SYNC_ANNOUNCE_UPDATE: STREAM_GET(&announce, s, sizeof(announce)); - ret = isis_ldp_sync_announce_update(announce); + isis_ldp_sync_announce_update(announce); break; case LDP_RLFA_LABELS: STREAM_GET(&rlfa, s, sizeof(rlfa)); @@ -804,23 +793,18 @@ static int isis_opaque_msg_handler(ZAPI_CALLBACK_ARGS) } stream_failure: - - return ret; + return; } -static int isis_zebra_client_close_notify(ZAPI_CALLBACK_ARGS) +static void isis_zebra_client_close_notify(ZAPI_CALLBACK_ARGS) { - int ret = 0; - struct zapi_client_close_info info; if (zapi_client_close_notify_decode(zclient->ibuf, &info) < 0) - return -1; + return; isis_ldp_sync_handle_client_close(&info); isis_ldp_rlfa_handle_client_close(&info); - - return ret; } /** @@ -1121,9 +1105,8 @@ void isis_zebra_srv6_adj_sid_uninstall(struct srv6_adjacency *sra) /** * Callback to process an SRv6 locator chunk received from SRv6 Manager (zebra). * - * @result 0 on success, -1 otherwise */ -static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) +static void isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) { struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); struct stream *s = NULL; @@ -1138,14 +1121,14 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) if (!isis) { srv6_locator_chunk_free(&chunk); - return -1; + return; } /* Decode the received zebra message */ s = zclient->ibuf; if (zapi_srv6_locator_chunk_decode(s, chunk) < 0) { srv6_locator_chunk_free(&chunk); - return -1; + return; } sr_debug( @@ -1166,7 +1149,7 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) node, c)) { if (!prefix_cmp(&c->prefix, &chunk->prefix)) { srv6_locator_chunk_free(&chunk); - return 0; + return; } } @@ -1186,7 +1169,7 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) /* Allocate new SRv6 End SID */ sid = isis_srv6_sid_alloc(area, chunk, behavior, 0); if (!sid) - return -1; + return; /* Install the new SRv6 End SID in the forwarding plane through * Zebra */ @@ -1213,16 +1196,12 @@ static int isis_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) chunk->locator_name); srv6_locator_chunk_free(&chunk); } - - return 0; } /** * Callback to process an SRv6 locator received from SRv6 Manager (zebra). - * - * @result 0 on success, -1 otherwise */ -static int isis_zebra_process_srv6_locator_add(ZAPI_CALLBACK_ARGS) +static void isis_zebra_process_srv6_locator_add(ZAPI_CALLBACK_ARGS) { struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); struct srv6_locator loc = {}; @@ -1230,11 +1209,11 @@ static int isis_zebra_process_srv6_locator_add(ZAPI_CALLBACK_ARGS) struct isis_area *area; if (!isis) - return -1; + return; /* Decode the SRv6 locator */ if (zapi_srv6_locator_decode(zclient->ibuf, &loc) < 0) - return -1; + return; sr_debug( "New SRv6 locator allocated in zebra: name %s, " @@ -1258,20 +1237,16 @@ static int isis_zebra_process_srv6_locator_add(ZAPI_CALLBACK_ARGS) if (isis_zebra_srv6_manager_get_locator_chunk( loc.name) < 0) - return -1; + return; } } - - return 0; } /** * Callback to process a notification from SRv6 Manager (zebra) of an SRv6 * locator deleted. - * - * @result 0 on success, -1 otherwise */ -static int isis_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) +static void isis_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) { struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); struct srv6_locator loc = {}; @@ -1282,11 +1257,11 @@ static int isis_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) struct srv6_adjacency *sra; if (!isis) - return -1; + return; /* Decode the received zebra message */ if (zapi_srv6_locator_decode(zclient->ibuf, &loc) < 0) - return -1; + return; sr_debug( "SRv6 locator deleted in zebra: name %s, " @@ -1339,8 +1314,6 @@ static int isis_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS) * exists */ lsp_regenerate_schedule(area, area->is_type, 0); } - - return 0; } /** diff --git a/ldpd/ldp_zebra.c b/ldpd/ldp_zebra.c index df682a1347be..fe30048f9577 100644 --- a/ldpd/ldp_zebra.c +++ b/ldpd/ldp_zebra.c @@ -24,18 +24,18 @@ static void ifp2kif(struct interface *, struct kif *); static void ifc2kaddr(struct interface *, struct connected *, struct kaddr *); static int ldp_zebra_send_mpls_labels(int, struct kroute *); -static int ldp_router_id_update(ZAPI_CALLBACK_ARGS); -static int ldp_interface_address_add(ZAPI_CALLBACK_ARGS); -static int ldp_interface_address_delete(ZAPI_CALLBACK_ARGS); -static int ldp_zebra_read_route(ZAPI_CALLBACK_ARGS); -static int ldp_zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS); +static void ldp_router_id_update(ZAPI_CALLBACK_ARGS); +static void ldp_interface_address_add(ZAPI_CALLBACK_ARGS); +static void ldp_interface_address_delete(ZAPI_CALLBACK_ARGS); +static void ldp_zebra_read_route(ZAPI_CALLBACK_ARGS); +static void ldp_zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS); static void ldp_zebra_connected(struct zclient *); static void ldp_zebra_filter_update(struct access_list *access); static void ldp_zebra_opaque_register(void); static void ldp_zebra_opaque_unregister(void); static int ldp_sync_zebra_send_announce(void); -static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); +static void ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); static void ldp_sync_zebra_init(void); static struct zclient *zclient; @@ -153,8 +153,7 @@ int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response *rlfa_labels) return 0; } -static int -ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) +static void ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) { struct stream *s; struct zapi_opaque_msg info; @@ -165,7 +164,7 @@ ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) s = zclient->ibuf; if(zclient_opaque_decode(s, &info) != 0) - return -1; + return; switch (info.type) { case LDP_IGP_SYNC_IF_STATE_REQUEST: @@ -186,7 +185,7 @@ ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) } stream_failure: - return 0; + return; } static void @@ -349,23 +348,20 @@ kif_redistribute(const char *ifname) } } -static int -ldp_router_id_update(ZAPI_CALLBACK_ARGS) +static void ldp_router_id_update(ZAPI_CALLBACK_ARGS) { struct prefix router_id; zebra_router_id_update_read(zclient->ibuf, &router_id); if (bad_addr_v4(router_id.u.prefix4)) - return (0); + return; debug_zebra_in("router-id update %pI4", &router_id.u.prefix4); global.rtr_id.s_addr = router_id.u.prefix4.s_addr; main_imsg_compose_ldpe(IMSG_RTRID_UPDATE, 0, &global.rtr_id, - sizeof(global.rtr_id)); - - return (0); + sizeof(global.rtr_id)); } static int @@ -433,8 +429,7 @@ static int ldp_ifp_down(struct interface *ifp) return ldp_interface_status_change(ifp); } -static int -ldp_interface_address_add(ZAPI_CALLBACK_ARGS) +static void ldp_interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *ifc; struct interface *ifp; @@ -442,26 +437,23 @@ ldp_interface_address_add(ZAPI_CALLBACK_ARGS) ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return (0); + return; ifp = ifc->ifp; ifc2kaddr(ifp, ifc, &ka); /* Filter invalid addresses. */ if (bad_addr(ka.af, &ka.addr)) - return (0); + return; debug_zebra_in("address add %s/%u interface %s", log_addr(ka.af, &ka.addr), ka.prefixlen, ifp->name); /* notify ldpe about new address */ main_imsg_compose_ldpe(IMSG_NEWADDR, 0, &ka, sizeof(ka)); - - return (0); } -static int -ldp_interface_address_delete(ZAPI_CALLBACK_ARGS) +static void ldp_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *ifc; struct interface *ifp; @@ -469,7 +461,7 @@ ldp_interface_address_delete(ZAPI_CALLBACK_ARGS) ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return (0); + return; ifp = ifc->ifp; ifc2kaddr(ifp, ifc, &ka); @@ -477,19 +469,16 @@ ldp_interface_address_delete(ZAPI_CALLBACK_ARGS) /* Filter invalid addresses. */ if (bad_addr(ka.af, &ka.addr)) - return (0); + return; debug_zebra_in("address delete %s/%u interface %s", log_addr(ka.af, &ka.addr), ka.prefixlen, ifp->name); /* notify ldpe about removed address */ main_imsg_compose_ldpe(IMSG_DELADDR, 0, &ka, sizeof(ka)); - - return (0); } -static int -ldp_zebra_read_route(ZAPI_CALLBACK_ARGS) +static void ldp_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; struct zapi_nexthop *api_nh; @@ -497,11 +486,11 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS) int i, add = 0; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; /* we completely ignore srcdest routes for now. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) - return (0); + return; memset(&kr, 0, sizeof(kr)); kr.af = api.prefix.family; @@ -525,14 +514,14 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS) break; case ZEBRA_ROUTE_BGP: /* LDP should follow the IGP and ignore BGP routes */ - return (0); + return; default: break; } if (bad_addr(kr.af, &kr.prefix) || (kr.af == AF_INET6 && IN6_IS_SCOPE_EMBED(&kr.prefix.v6))) - return (0); + return; if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) add = 1; @@ -589,14 +578,13 @@ ldp_zebra_read_route(ZAPI_CALLBACK_ARGS) main_imsg_compose_lde(IMSG_NETWORK_UPDATE, 0, &kr, sizeof(kr)); - return (0); + return; } /* * Receive PW status update from Zebra and send it to LDE process. */ -static int -ldp_zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS) +static void ldp_zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS) { struct zapi_pw_status zpw; @@ -607,8 +595,6 @@ ldp_zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS) zpw.status); main_imsg_compose_lde(IMSG_PW_UPDATE, 0, &zpw, sizeof(zpw)); - - return (0); } void ldp_zebra_regdereg_zebra_info(bool want_register) diff --git a/lib/bfd.c b/lib/bfd.c index 2222bb954737..e84c82706449 100644 --- a/lib/bfd.c +++ b/lib/bfd.c @@ -863,16 +863,16 @@ void bfd_sess_show(struct vty *vty, struct json_object *json, * * Use this as `zclient` `bfd_dest_replay` callback. */ -int zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS) +void zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS) { struct bfd_session_params *bsp; if (!zclient->bfd_integration) - return 0; + return; /* Do nothing when shutting down. */ if (bsglobal.shutting_down) - return 0; + return; if (bsglobal.debugging) zlog_debug("%s: sending all sessions registered", __func__); @@ -896,11 +896,9 @@ int zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS) bsp->lastev = BSE_INSTALL; event_execute(bsglobal.tm, _bfd_sess_send, bsp, 0, NULL); } - - return 0; } -int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS) +void zclient_bfd_session_update(ZAPI_CALLBACK_ARGS) { struct bfd_session_params *bsp, *bspn; size_t sessions_updated = 0; @@ -914,11 +912,11 @@ int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS) char ifstr[128], cbitstr[32]; if (!zclient->bfd_integration) - return 0; + return; /* Do nothing when shutting down. */ if (bsglobal.shutting_down) - return 0; + return; ifp = bfd_get_peer_info(zclient->ibuf, &dp, &sp, &state, &remote_cbit, vrf_id); @@ -928,7 +926,7 @@ int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS) * family type below. */ if (dp.family == 0 || sp.family == 0) - return 0; + return; if (bsglobal.debugging) { ifstr[0] = 0; @@ -1004,8 +1002,6 @@ int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS) if (bsglobal.debugging) zlog_debug("%s: sessions updated: %zu", __func__, sessions_updated); - - return 0; } /** diff --git a/lib/zclient.c b/lib/zclient.c index 51ebb5627557..88d07a2d5d4b 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -2483,7 +2483,7 @@ int zebra_router_id_update_read(struct stream *s, struct prefix *rid) * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -static int zclient_vrf_add(ZAPI_CALLBACK_ARGS) +static void zclient_vrf_add(ZAPI_CALLBACK_ARGS) { struct vrf *vrf; char vrfname_tmp[VRF_NAMSIZ + 1] = {}; @@ -2501,18 +2501,17 @@ static int zclient_vrf_add(ZAPI_CALLBACK_ARGS) /* If there's already a VRF with this name, don't create vrf */ if (!vrf) - return 0; + return; vrf->data.l.table_id = data.l.table_id; memcpy(vrf->data.l.netns_name, data.l.netns_name, NS_NAMSIZ); vrf_enable(vrf); - return 0; stream_failure: - return -1; + return; } -static int zclient_vrf_delete(ZAPI_CALLBACK_ARGS) +static void zclient_vrf_delete(ZAPI_CALLBACK_ARGS) { struct vrf *vrf; @@ -2525,13 +2524,12 @@ static int zclient_vrf_delete(ZAPI_CALLBACK_ARGS) * no point in attempting to delete it. */ if (!vrf) - return 0; + return; vrf_delete(vrf); - return 0; } -static int zclient_interface_add(ZAPI_CALLBACK_ARGS) +static void zclient_interface_add(ZAPI_CALLBACK_ARGS) { struct interface *ifp; char ifname_tmp[IFNAMSIZ + 1] = {}; @@ -2547,7 +2545,7 @@ static int zclient_interface_add(ZAPI_CALLBACK_ARGS) zlog_debug( "Rx'd interface add from Zebra, but VRF %u does not exist", vrf_id); - return -1; + return; } ifp = if_get_by_name(ifname_tmp, vrf_id, vrf->name); @@ -2556,9 +2554,8 @@ static int zclient_interface_add(ZAPI_CALLBACK_ARGS) if_new_via_zapi(ifp); - return 0; stream_failure: - return -1; + return; } /* @@ -2591,7 +2588,7 @@ struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id) return NULL; } -static int zclient_interface_delete(ZAPI_CALLBACK_ARGS) +static void zclient_interface_delete(ZAPI_CALLBACK_ARGS) { struct interface *ifp; struct stream *s = zclient->ibuf; @@ -2599,13 +2596,12 @@ static int zclient_interface_delete(ZAPI_CALLBACK_ARGS) ifp = zebra_interface_state_read(s, vrf_id); if (ifp == NULL) - return 0; + return; if_destroy_via_zapi(ifp); - return 0; } -static int zclient_interface_up(ZAPI_CALLBACK_ARGS) +static void zclient_interface_up(ZAPI_CALLBACK_ARGS) { struct interface *ifp; struct stream *s = zclient->ibuf; @@ -2613,13 +2609,12 @@ static int zclient_interface_up(ZAPI_CALLBACK_ARGS) ifp = zebra_interface_state_read(s, vrf_id); if (!ifp) - return 0; + return; if_up_via_zapi(ifp); - return 0; } -static int zclient_interface_down(ZAPI_CALLBACK_ARGS) +static void zclient_interface_down(ZAPI_CALLBACK_ARGS) { struct interface *ifp; struct stream *s = zclient->ibuf; @@ -2627,13 +2622,12 @@ static int zclient_interface_down(ZAPI_CALLBACK_ARGS) ifp = zebra_interface_state_read(s, vrf_id); if (!ifp) - return 0; + return; if_down_via_zapi(ifp); - return 0; } -static int zclient_handle_error(ZAPI_CALLBACK_ARGS) +static void zclient_handle_error(ZAPI_CALLBACK_ARGS) { enum zebra_error_types error; struct stream *s = zclient->ibuf; @@ -2642,7 +2636,6 @@ static int zclient_handle_error(ZAPI_CALLBACK_ARGS) if (zclient->handle_error) (*zclient->handle_error)(error); - return 0; } static int link_params_set_value(struct stream *s, struct interface *ifp) @@ -3963,7 +3956,7 @@ enum zclient_send_status zebra_send_pw(struct zclient *zclient, int command, /* * Receive PW status update from Zebra and send it to LDE process. */ -int zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, struct zapi_pw_status *pw) +void zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, struct zapi_pw_status *pw) { struct stream *s; @@ -3975,12 +3968,11 @@ int zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, struct zapi_pw_status *pw) STREAM_GETL(s, pw->ifindex); STREAM_GETL(s, pw->status); - return 0; stream_failure: - return -1; + return; } -static int zclient_capability_decode(ZAPI_CALLBACK_ARGS) +static void zclient_capability_decode(ZAPI_CALLBACK_ARGS) { struct zclient_capabilities cap; struct stream *s = zclient->ibuf; @@ -4008,7 +4000,7 @@ static int zclient_capability_decode(ZAPI_CALLBACK_ARGS) (*zclient->zebra_capabilities)(&cap); stream_failure: - return 0; + return; } enum zclient_send_status zclient_send_mlag_register(struct zclient *client, @@ -4276,7 +4268,7 @@ int zapi_client_close_notify_decode(struct stream *s, return -1; } -static int zclient_nexthop_update(ZAPI_CALLBACK_ARGS) +static void zclient_nexthop_update(ZAPI_CALLBACK_ARGS) { struct vrf *vrf = vrf_lookup_by_id(vrf_id); struct prefix match; @@ -4284,18 +4276,16 @@ static int zclient_nexthop_update(ZAPI_CALLBACK_ARGS) if (!vrf) { zlog_warn("nexthop update for unknown VRF ID %u", vrf_id); - return 0; + return; } if (!zapi_nexthop_update_decode(zclient->ibuf, &match, &route)) { zlog_err("failed to decode nexthop update"); - return -1; + return; } if (zclient->nexthop_update) zclient->nexthop_update(vrf, &match, &route); - - return 0; } static zclient_handler *const lib_handlers[] = { diff --git a/lib/zclient.h b/lib/zclient.h index 1bf91064e2d0..dbad53ee6421 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -291,7 +291,7 @@ struct zapi_cap { int cmd, struct zclient *zclient, uint16_t length, vrf_id_t vrf_id /* function-type typedef (pointer not included) */ -typedef int (zclient_handler)(ZAPI_CALLBACK_ARGS); +typedef void (zclient_handler)(ZAPI_CALLBACK_ARGS); /* clang-format on */ struct zapi_route; @@ -385,8 +385,8 @@ struct zclient { }; /* lib handlers added in bfd.c */ -extern int zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS); -extern int zclient_bfd_session_update(ZAPI_CALLBACK_ARGS); +extern void zclient_bfd_session_replay(ZAPI_CALLBACK_ARGS); +extern void zclient_bfd_session_update(ZAPI_CALLBACK_ARGS); /* Zebra API message flag. */ #define ZAPI_MESSAGE_NEXTHOP 0x01 @@ -1101,8 +1101,8 @@ extern int zapi_srv6_locator_chunk_decode(struct stream *s, extern enum zclient_send_status zebra_send_pw(struct zclient *zclient, int command, struct zapi_pw *pw); -extern int zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, - struct zapi_pw_status *pw); +extern void zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS, + struct zapi_pw_status *pw); extern enum zclient_send_status zclient_route_send(uint8_t, struct zclient *, struct zapi_route *); diff --git a/nhrpd/netlink_arp.c b/nhrpd/netlink_arp.c index 88628999abfb..e102018b706e 100644 --- a/nhrpd/netlink_arp.c +++ b/nhrpd/netlink_arp.c @@ -145,7 +145,7 @@ void netlink_set_nflog_group(int nlgroup) } } -int nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS) +void nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS) { union sockunion addr = {}, lladdr = {}; struct interface *ifp; @@ -156,10 +156,10 @@ int nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS) zclient_neigh_ip_decode(zclient->ibuf, &api); if (api.ip_len != IPV4_MAX_BYTELEN && api.ip_len != 0) - return 0; + return; if (api.ip_in.ipa_type == AF_UNSPEC) - return 0; + return; sockunion_family(&addr) = api.ip_in.ipa_type; memcpy((uint8_t *)sockunion_get_addr(&addr), &api.ip_in.ip.addr, family2addrsize(api.ip_in.ipa_type)); @@ -174,10 +174,10 @@ int nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS) ndm_state = api.ndm_state; if (!ifp) - return 0; + return; c = nhrp_cache_get(ifp, &addr, 0); if (!c) - return 0; + return; debugf(NHRP_DEBUG_KERNEL, "Netlink: %s %pSU dev %s lladdr %pSU nud 0x%x cache used %u type %u", (cmd == ZEBRA_NEIGH_GET) ? "who-has" @@ -201,5 +201,4 @@ int nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS) : ZEBRA_NEIGH_STATE_FAILED; nhrp_cache_set_used(c, state == ZEBRA_NEIGH_STATE_REACHABLE); } - return 0; } diff --git a/nhrpd/nhrp_interface.c b/nhrpd/nhrp_interface.c index 7d0ab9762f71..8cdc14589971 100644 --- a/nhrpd/nhrp_interface.c +++ b/nhrpd/nhrp_interface.c @@ -467,30 +467,30 @@ int nhrp_ifp_down(struct interface *ifp) return 0; } -int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS) +void nhrp_interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *ifc; ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; debugf(NHRP_DEBUG_IF, "if-addr-add: %s: %pFX", ifc->ifp->name, ifc->address); nhrp_interface_update_address( ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0); - nhrp_interface_update_cache_config(ifc->ifp, true, PREFIX_FAMILY(ifc->address)); - return 0; + nhrp_interface_update_cache_config(ifc->ifp, true, + PREFIX_FAMILY(ifc->address)); } -int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS) +void nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *ifc; ifc = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; debugf(NHRP_DEBUG_IF, "if-addr-del: %s: %pFX", ifc->ifp->name, ifc->address); @@ -498,8 +498,6 @@ int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS) nhrp_interface_update_address( ifc->ifp, family2afi(PREFIX_FAMILY(ifc->address)), 0); connected_free(&ifc); - - return 0; } void nhrp_interface_notify_add(struct interface *ifp, struct notifier_block *n, diff --git a/nhrpd/nhrp_route.c b/nhrpd/nhrp_route.c index fd9090bd6e74..3b2527b6a9f0 100644 --- a/nhrpd/nhrp_route.c +++ b/nhrpd/nhrp_route.c @@ -200,7 +200,7 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type, &api); } -int nhrp_route_read(ZAPI_CALLBACK_ARGS) +void nhrp_route_read(ZAPI_CALLBACK_ARGS) { struct zapi_route api; struct zapi_nexthop *api_nh; @@ -209,15 +209,15 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS) int added; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; /* we completely ignore srcdest routes for now. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) - return 0; + return; /* ignore our routes */ if (api.type == ZEBRA_ROUTE_NHRP) - return 0; + return; sockunion_family(&nexthop_addr) = AF_UNSPEC; if (CHECK_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP)) { @@ -244,8 +244,6 @@ int nhrp_route_read(ZAPI_CALLBACK_ARGS) nhrp_route_update_zebra(&api.prefix, &nexthop_addr, added ? ifp : NULL); nhrp_shortcut_prefix_change(&api.prefix, !added); - - return 0; } int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p, @@ -471,7 +469,7 @@ void nhrp_zebra_terminate(void) route_table_finish(zebra_rib[AFI_IP6]); } -int nhrp_gre_update(ZAPI_CALLBACK_ARGS) +void nhrp_gre_update(ZAPI_CALLBACK_ARGS) { struct stream *s; struct nhrp_gre_info gre_info, *val; @@ -480,7 +478,7 @@ int nhrp_gre_update(ZAPI_CALLBACK_ARGS) /* result */ s = zclient->ibuf; if (vrf_id != VRF_DEFAULT) - return 0; + return; /* read GRE information */ STREAM_GETL(s, gre_info.ifindex); @@ -511,9 +509,9 @@ int nhrp_gre_update(ZAPI_CALLBACK_ARGS) ifp ? ifp->name : "", gre_info.ifindex, vrf_id); if (ifp) nhrp_interface_update_nbma(ifp, val); - return 0; + return; stream_failure: zlog_err("%s(): error reading response ..", __func__); - return -1; + return; } diff --git a/nhrpd/nhrpd.h b/nhrpd/nhrpd.h index 50653c784acc..896e1a0abad7 100644 --- a/nhrpd/nhrpd.h +++ b/nhrpd/nhrpd.h @@ -367,14 +367,14 @@ void nhrp_interface_update_mtu(struct interface *ifp, afi_t afi); void nhrp_interface_update_nbma(struct interface *ifp, struct nhrp_gre_info *gre_info); -int nhrp_interface_add(ZAPI_CALLBACK_ARGS); -int nhrp_interface_delete(ZAPI_CALLBACK_ARGS); -int nhrp_interface_up(ZAPI_CALLBACK_ARGS); -int nhrp_interface_down(ZAPI_CALLBACK_ARGS); -int nhrp_interface_address_add(ZAPI_CALLBACK_ARGS); -int nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS); -int nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS); -int nhrp_gre_update(ZAPI_CALLBACK_ARGS); +void nhrp_interface_add(ZAPI_CALLBACK_ARGS); +void nhrp_interface_delete(ZAPI_CALLBACK_ARGS); +void nhrp_interface_up(ZAPI_CALLBACK_ARGS); +void nhrp_interface_down(ZAPI_CALLBACK_ARGS); +void nhrp_interface_address_add(ZAPI_CALLBACK_ARGS); +void nhrp_interface_address_delete(ZAPI_CALLBACK_ARGS); +void nhrp_neighbor_operation(ZAPI_CALLBACK_ARGS); +void nhrp_gre_update(ZAPI_CALLBACK_ARGS); void nhrp_interface_notify_add(struct interface *ifp, struct notifier_block *n, notifier_fn_t fn); @@ -413,7 +413,7 @@ void nhrp_route_update_nhrp(const struct prefix *p, struct interface *ifp); void nhrp_route_announce(int add, enum nhrp_cache_type type, const struct prefix *p, struct interface *ifp, const union sockunion *nexthop, uint32_t mtu); -int nhrp_route_read(ZAPI_CALLBACK_ARGS); +void nhrp_route_read(ZAPI_CALLBACK_ARGS); int nhrp_route_get_nexthop(const union sockunion *addr, struct prefix *p, union sockunion *via, struct interface **ifp); enum nhrp_route_type nhrp_route_address(struct interface *in_ifp, diff --git a/ospf6d/ospf6_zebra.c b/ospf6d/ospf6_zebra.c index 3245578b07f2..38bb22c2dea7 100644 --- a/ospf6d/ospf6_zebra.c +++ b/ospf6d/ospf6_zebra.c @@ -71,7 +71,7 @@ void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6) } /* Router-id update message from zebra. */ -static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS) +static void ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct prefix router_id; struct ospf6 *o; @@ -85,13 +85,11 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS) o = ospf6_lookup_by_vrf_id(vrf_id); if (o == NULL) - return 0; + return; o->router_id_zebra = router_id.u.prefix4.s_addr; ospf6_router_id_update(o, false); - - return 0; } /* redistribute function */ @@ -165,14 +163,14 @@ static void ospf6_zebra_import_check_update(struct vrf *vrf, ospf6_abr_nssa_type_7_defaults(ospf6); } -static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS) +static void ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS) { struct connected *c; c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_ADD, zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; if (IS_OSPF6_DEBUG_ZEBRA(RECV)) zlog_debug("Zebra Interface address add: %s %5s %pFX", @@ -183,17 +181,17 @@ static int ospf6_zebra_if_address_update_add(ZAPI_CALLBACK_ARGS) ospf6_interface_state_update(c->ifp); ospf6_interface_connected_route_update(c->ifp); } - return 0; + return; } -static int ospf6_zebra_if_address_update_delete(ZAPI_CALLBACK_ARGS) +static void ospf6_zebra_if_address_update_delete(ZAPI_CALLBACK_ARGS) { struct connected *c; c = zebra_interface_address_read(ZEBRA_INTERFACE_ADDRESS_DELETE, zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; if (IS_OSPF6_DEBUG_ZEBRA(RECV)) zlog_debug("Zebra Interface address delete: %s %5s %pFX", @@ -206,8 +204,6 @@ static int ospf6_zebra_if_address_update_delete(ZAPI_CALLBACK_ARGS) } connected_free(&c); - - return 0; } static int ospf6_zebra_gr_update(struct ospf6 *ospf6, int command, @@ -246,7 +242,7 @@ int ospf6_zebra_gr_disable(struct ospf6 *ospf6) return ospf6_zebra_gr_update(ospf6, ZEBRA_CLIENT_GR_DISABLE, 0); } -static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) +static void ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; unsigned long ifindex; @@ -257,17 +253,17 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) ospf6 = ospf6_lookup_by_vrf_id(vrf_id); if (ospf6 == NULL) - return 0; + return; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; /* we completely ignore srcdest routes for now. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) - return 0; + return; if (IN6_IS_ADDR_LINKLOCAL(&api.prefix.u.prefix6)) - return 0; + return; ifindex = api.nexthops[0].ifindex; if (api.nexthops[0].type == NEXTHOP_TYPE_IPV6 @@ -293,8 +289,6 @@ static int ospf6_zebra_read_route(ZAPI_CALLBACK_ARGS) else ospf6_asbr_redistribute_remove(api.type, ifindex, &api.prefix, ospf6); - - return 0; } DEFUN(show_zebra, diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c index bb6cc3a89c05..954ec6a5a234 100644 --- a/ospfd/ospf_zebra.c +++ b/ospfd/ospf_zebra.c @@ -53,7 +53,7 @@ struct zclient *zclient_sync; extern struct event_loop *master; /* Router-id update message from zebra. */ -static int ospf_router_id_update_zebra(ZAPI_CALLBACK_ARGS) +static void ospf_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct ospf *ospf = NULL; struct prefix router_id; @@ -75,10 +75,9 @@ static int ospf_router_id_update_zebra(ZAPI_CALLBACK_ARGS) __func__, ospf_vrf_id_to_name(vrf_id), vrf_id, &router_id); } - return 0; } -static int ospf_interface_address_add(ZAPI_CALLBACK_ARGS) +static void ospf_interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *c; struct ospf *ospf = NULL; @@ -87,7 +86,7 @@ static int ospf_interface_address_add(ZAPI_CALLBACK_ARGS) c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) zlog_debug("Zebra: interface %s address add %pFX vrf %s id %u", @@ -96,16 +95,14 @@ static int ospf_interface_address_add(ZAPI_CALLBACK_ARGS) ospf = ospf_lookup_by_vrf_id(vrf_id); if (!ospf) - return 0; + return; ospf_if_update(ospf, c->ifp); ospf_if_interface(c->ifp); - - return 0; } -static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS) +static void ospf_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *c; struct interface *ifp; @@ -116,7 +113,7 @@ static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS) c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE)) zlog_debug("Zebra: interface %s address delete %pFX", @@ -129,7 +126,7 @@ static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS) rn = route_node_lookup(IF_OIFS(ifp), &p); if (!rn) { connected_free(&c); - return 0; + return; } assert(rn->info); @@ -142,11 +139,9 @@ static int ospf_interface_address_delete(ZAPI_CALLBACK_ARGS) ospf_if_interface(c->ifp); connected_free(&c); - - return 0; } -static int ospf_interface_link_params(ZAPI_CALLBACK_ARGS) +static void ospf_interface_link_params(ZAPI_CALLBACK_ARGS) { struct interface *ifp; bool changed = false; @@ -154,12 +149,10 @@ static int ospf_interface_link_params(ZAPI_CALLBACK_ARGS) ifp = zebra_interface_link_params_read(zclient->ibuf, vrf_id, &changed); if (ifp == NULL || !changed) - return 0; + return; /* Update TE TLV */ ospf_mpls_te_update_if(ifp); - - return 0; } /* Nexthop, ifindex, distance and metric information. */ @@ -1245,7 +1238,7 @@ int ospf_zebra_gr_disable(struct ospf *ospf) } /* Zebra route add and delete treatment. */ -static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) +static void ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; struct prefix_ipv4 p; @@ -1259,10 +1252,10 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) ospf = ospf_lookup_by_vrf_id(vrf_id); if (ospf == NULL) - return 0; + return; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; ifindex = api.nexthops[0].ifindex; nexthop = api.nexthops[0].gate.ipv4; @@ -1270,7 +1263,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) memcpy(&p, &api.prefix, sizeof(p)); if (IPV4_NET127(ntohl(p.prefix.s_addr))) - return 0; + return; pgen.family = p.family; pgen.prefixlen = p.prefixlen; @@ -1321,7 +1314,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) api.metric); if (ei == NULL) { /* Nothing has changed, so nothing to do; return */ - return 0; + return; } if (ospf->router_id.s_addr != INADDR_ANY) { if (is_default_prefix4(&p)) @@ -1340,7 +1333,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) */ if (!ospf_redistribute_check(ospf, ei, NULL)) - return 0; + return; if (IS_DEBUG_OSPF(lsa, EXTNL_LSA_AGGR)) zlog_debug( @@ -1362,7 +1355,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) if (prefix_same( (struct prefix *)&aggr->p, (struct prefix *)&ei->p)) - return 0; + return; lsa = ospf_external_info_find_lsa( ospf, &ei->p); @@ -1375,7 +1368,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) if (mask.s_addr != al->mask.s_addr) - return 0; + return; ospf_external_lsa_flush( ospf, ei->type, &ei->p, @@ -1394,7 +1387,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) */ if (!ospf_redistribute_check( ospf, ei, NULL)) - return 0; + return; ospf_external_lsa_originate( ospf, ei); @@ -1426,7 +1419,7 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) ei = ospf_external_info_lookup(ospf, rt_type, api.instance, &p); if (ei == NULL) - return 0; + return; /* * Check if default-information originate i @@ -1453,8 +1446,6 @@ static int ospf_zebra_read_route(ZAPI_CALLBACK_ARGS) ifindex /*, nexthop */); } } - - return 0; } void ospf_zebra_import_default_route(struct ospf *ospf, bool unreg) @@ -2112,19 +2103,18 @@ static void ospf_zebra_connected(struct zclient *zclient) /* * opaque messages between processes */ -static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS) +static void ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS) { struct stream *s; struct zapi_opaque_msg info; struct ldp_igp_sync_if_state state; struct ldp_igp_sync_announce announce; struct zapi_opaque_reg_info dst; - int ret = 0; s = zclient->ibuf; if (zclient_opaque_decode(s, &info) != 0) - return -1; + return; switch (info.type) { case LINK_STATE_SYNC: @@ -2132,37 +2122,32 @@ static int ospf_opaque_msg_handler(ZAPI_CALLBACK_ARGS) dst.instance = info.src_instance; dst.session_id = info.src_session_id; dst.type = LINK_STATE_SYNC; - ret = ospf_te_sync_ted(dst); + ospf_te_sync_ted(dst); break; case LDP_IGP_SYNC_IF_STATE_UPDATE: STREAM_GET(&state, s, sizeof(state)); - ret = ospf_ldp_sync_state_update(state); + ospf_ldp_sync_state_update(state); break; case LDP_IGP_SYNC_ANNOUNCE_UPDATE: STREAM_GET(&announce, s, sizeof(announce)); - ret = ospf_ldp_sync_announce_update(announce); + ospf_ldp_sync_announce_update(announce); break; default: break; } stream_failure: - - return ret; + return; } -static int ospf_zebra_client_close_notify(ZAPI_CALLBACK_ARGS) +static void ospf_zebra_client_close_notify(ZAPI_CALLBACK_ARGS) { - int ret = 0; - struct zapi_client_close_info info; if (zapi_client_close_notify_decode(zclient->ibuf, &info) < 0) - return -1; + return; ospf_ldp_sync_handle_client_close(&info); - - return ret; } static zclient_handler *const ospf_handlers[] = { diff --git a/pathd/path_zebra.c b/pathd/path_zebra.c index 645fa50856cd..5d8d2a7f97f1 100644 --- a/pathd/path_zebra.c +++ b/pathd/path_zebra.c @@ -24,7 +24,7 @@ #include "lib/command.h" #include "lib/link_state.h" -static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); +static void path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); struct zclient *zclient; static struct zclient *zclient_sync; @@ -99,32 +99,29 @@ static void path_zebra_connected(struct zclient *zclient) } } -static int path_zebra_sr_policy_notify_status(ZAPI_CALLBACK_ARGS) +static void path_zebra_sr_policy_notify_status(ZAPI_CALLBACK_ARGS) { struct zapi_sr_policy zapi_sr_policy; struct srte_policy *policy; struct srte_candidate *best_candidate_path; if (zapi_sr_policy_notify_status_decode(zclient->ibuf, &zapi_sr_policy)) - return -1; + return; policy = srte_policy_find(zapi_sr_policy.color, &zapi_sr_policy.endpoint); if (!policy) - return -1; + return; best_candidate_path = policy->best_candidate; if (!best_candidate_path) - return -1; - - srte_candidate_status_update(best_candidate_path, - zapi_sr_policy.status); + return; - return 0; + srte_candidate_status_update(best_candidate_path, zapi_sr_policy.status); } /* Router-id update message from zebra. */ -static int path_zebra_router_id_update(ZAPI_CALLBACK_ARGS) +static void path_zebra_router_id_update(ZAPI_CALLBACK_ARGS) { struct prefix pref; const char *family; @@ -149,10 +146,9 @@ static int path_zebra_router_id_update(ZAPI_CALLBACK_ARGS) } else { zlog_warn("Unexpected router ID address family for vrf %u: %u", vrf_id, pref.family); - return 0; + return; } zlog_info("%s Router Id updated for VRF %u: %s", family, vrf_id, buf); - return 0; } /** @@ -259,16 +255,15 @@ static void path_zebra_label_manager_connect(void) } } -static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) +static void path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) { - int ret = 0; struct stream *s; struct zapi_opaque_msg info; s = zclient->ibuf; if (zclient_opaque_decode(s, &info) != 0) - return -1; + return; switch (info.type) { case LINK_STATE_UPDATE: @@ -290,10 +285,10 @@ static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) zlog_err( "%s: [rcv ted] Could not parse LinkState stream message.", __func__); - return -1; + return; } - ret = path_ted_rcvd_message(msg); + path_ted_rcvd_message(msg); ls_delete_msg(msg); /* Update local configuration after process update. */ path_ted_segment_list_refresh(); @@ -303,8 +298,6 @@ static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS) __func__, info.type); break; } - - return ret; } static zclient_handler *const path_handlers[] = { diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index dd15beaff440..792d47173f93 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -81,7 +81,7 @@ int pbr_ifp_destroy(struct interface *ifp) return 0; } -static int interface_address_add(ZAPI_CALLBACK_ARGS) +static void interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *c; char buf[PREFIX_STRLEN]; @@ -91,24 +91,21 @@ static int interface_address_add(ZAPI_CALLBACK_ARGS) DEBUGD(&pbr_dbg_zebra, "%s: %s added %s", __func__, c ? c->ifp->name : "Unknown", c ? prefix2str(c->address, buf, sizeof(buf)) : "Unknown"); - - return 0; } -static int interface_address_delete(ZAPI_CALLBACK_ARGS) +static void interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *c; c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) - return 0; + return; DEBUGD(&pbr_dbg_zebra, "%s: %s deleted %pFX", __func__, c->ifp->name, c->address); connected_free(&c); - return 0; } int pbr_ifp_up(struct interface *ifp) @@ -129,7 +126,7 @@ int pbr_ifp_down(struct interface *ifp) return 0; } -static int route_notify_owner(ZAPI_CALLBACK_ARGS) +static void route_notify_owner(ZAPI_CALLBACK_ARGS) { struct prefix p; enum zapi_route_notify_owner note; @@ -137,7 +134,7 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e, NULL, NULL)) - return -1; + return; switch (note) { case ZAPI_ROUTE_FAIL_INSTALL: @@ -168,11 +165,9 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) &p, table_id); break; } - - return 0; } -static int rule_notify_owner(ZAPI_CALLBACK_ARGS) +static void rule_notify_owner(ZAPI_CALLBACK_ARGS) { uint32_t seqno, priority, unique; enum zapi_rule_notify_owner note; @@ -183,7 +178,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS) if (!zapi_rule_notify_decode(zclient->ibuf, &seqno, &priority, &unique, ifname, ¬e)) - return -1; + return; pmi = NULL; pbrms = pbrms_lookup_unique(unique, ifname, &pmi); @@ -191,7 +186,7 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS) DEBUGD(&pbr_dbg_zebra, "%s: Failure to lookup pbrms based upon %u", __func__, unique); - return 0; + return; } installed = 1 << pmi->install_bit; @@ -215,8 +210,6 @@ static int rule_notify_owner(ZAPI_CALLBACK_ARGS) zapi_rule_notify_owner2str(note), pbrms->installed); pbr_map_final_interface_deletion(pbrms->parent, pmi); - - return 0; } static void zebra_connected(struct zclient *zclient) diff --git a/pimd/pim_mlag.c b/pimd/pim_mlag.c index dcef2d0d33ab..99d790df8f6d 100644 --- a/pimd/pim_mlag.c +++ b/pimd/pim_mlag.c @@ -775,18 +775,17 @@ static void pim_mlag_process_mroute_del(struct mlag_mroute_del msg) pim_mlag_up_peer_del(&msg); } -int pim_zebra_mlag_handle_msg(int cmd, struct zclient *zclient, - uint16_t zapi_length, vrf_id_t vrf_id) +void pim_zebra_mlag_handle_msg(ZAPI_CALLBACK_ARGS) { struct stream *s = zclient->ibuf; struct mlag_msg mlag_msg; char buf[80]; int rc = 0; - size_t length; + size_t llength; - rc = mlag_lib_decode_mlag_hdr(s, &mlag_msg, &length); + rc = mlag_lib_decode_mlag_hdr(s, &mlag_msg, &llength); if (rc) - return (rc); + return; if (PIM_DEBUG_MLAG) zlog_debug("%s: Received msg type: %s length: %d, bulk_cnt: %d", @@ -801,7 +800,7 @@ int pim_zebra_mlag_handle_msg(int cmd, struct zclient *zclient, rc = mlag_lib_decode_mlag_status(s, &msg); if (rc) - return (rc); + return; pim_mlag_process_mlagd_state_change(msg); } break; case MLAG_PEER_FRR_STATUS: { @@ -809,7 +808,7 @@ int pim_zebra_mlag_handle_msg(int cmd, struct zclient *zclient, rc = mlag_lib_decode_frr_status(s, &msg); if (rc) - return (rc); + return; pim_mlag_process_peer_frr_state_change(msg); } break; case MLAG_VXLAN_UPDATE: { @@ -817,23 +816,23 @@ int pim_zebra_mlag_handle_msg(int cmd, struct zclient *zclient, rc = mlag_lib_decode_vxlan_update(s, &msg); if (rc) - return rc; + return; pim_mlag_process_vxlan_update(&msg); } break; case MLAG_MROUTE_ADD: { struct mlag_mroute_add msg; - rc = mlag_lib_decode_mroute_add(s, &msg, &length); + rc = mlag_lib_decode_mroute_add(s, &msg, &llength); if (rc) - return (rc); + return; pim_mlag_process_mroute_add(msg); } break; case MLAG_MROUTE_DEL: { struct mlag_mroute_del msg; - rc = mlag_lib_decode_mroute_del(s, &msg, &length); + rc = mlag_lib_decode_mroute_del(s, &msg, &llength); if (rc) - return (rc); + return; pim_mlag_process_mroute_del(msg); } break; case MLAG_MROUTE_ADD_BULK: { @@ -841,9 +840,9 @@ int pim_zebra_mlag_handle_msg(int cmd, struct zclient *zclient, int i; for (i = 0; i < mlag_msg.msg_cnt; i++) { - rc = mlag_lib_decode_mroute_add(s, &msg, &length); + rc = mlag_lib_decode_mroute_add(s, &msg, &llength); if (rc) - return (rc); + return; pim_mlag_process_mroute_add(msg); } } break; @@ -852,9 +851,9 @@ int pim_zebra_mlag_handle_msg(int cmd, struct zclient *zclient, int i; for (i = 0; i < mlag_msg.msg_cnt; i++) { - rc = mlag_lib_decode_mroute_del(s, &msg, &length); + rc = mlag_lib_decode_mroute_del(s, &msg, &llength); if (rc) - return (rc); + return; pim_mlag_process_mroute_del(msg); } } break; @@ -865,12 +864,11 @@ int pim_zebra_mlag_handle_msg(int cmd, struct zclient *zclient, case MLAG_PIM_CFG_DUMP: break; } - return 0; } /****************End of PIM Mesasge processing handler********************/ -int pim_zebra_mlag_process_up(ZAPI_CALLBACK_ARGS) +void pim_zebra_mlag_process_up(ZAPI_CALLBACK_ARGS) { if (PIM_DEBUG_MLAG) zlog_debug("%s: Received Process-Up from Mlag", __func__); @@ -881,7 +879,6 @@ int pim_zebra_mlag_process_up(ZAPI_CALLBACK_ARGS) */ router->connected_to_mlag = true; router->mlag_flags |= PIM_MLAGF_LOCAL_CONN_UP; - return 0; } static void pim_mlag_param_reset(void) @@ -898,7 +895,7 @@ static void pim_mlag_param_reset(void) router->peerlink_rif[0] = '\0'; } -int pim_zebra_mlag_process_down(ZAPI_CALLBACK_ARGS) +void pim_zebra_mlag_process_down(ZAPI_CALLBACK_ARGS) { if (PIM_DEBUG_MLAG) zlog_debug("%s: Received Process-Down from Mlag", __func__); @@ -918,7 +915,6 @@ int pim_zebra_mlag_process_down(ZAPI_CALLBACK_ARGS) pim_mlag_up_peer_del_all(); /* notify the vxlan component */ pim_mlag_vxlan_state_update(); - return 0; } static void pim_mlag_register_handler(struct event *thread) diff --git a/pimd/pim_mlag.h b/pimd/pim_mlag.h index 9cabd32ae8fc..a54fab42aad4 100644 --- a/pimd/pim_mlag.h +++ b/pimd/pim_mlag.h @@ -22,9 +22,9 @@ extern void pim_instance_mlag_init(struct pim_instance *pim); extern void pim_instance_mlag_terminate(struct pim_instance *pim); extern void pim_if_configure_mlag_dualactive(struct pim_interface *pim_ifp); extern void pim_if_unconfigure_mlag_dualactive(struct pim_interface *pim_ifp); -extern int pim_zebra_mlag_process_up(ZAPI_CALLBACK_ARGS); -extern int pim_zebra_mlag_process_down(ZAPI_CALLBACK_ARGS); -extern int pim_zebra_mlag_handle_msg(ZAPI_CALLBACK_ARGS); +extern void pim_zebra_mlag_process_up(ZAPI_CALLBACK_ARGS); +extern void pim_zebra_mlag_process_down(ZAPI_CALLBACK_ARGS); +extern void pim_zebra_mlag_handle_msg(ZAPI_CALLBACK_ARGS); /* pm_zpthread.c */ extern int pim_mlag_signal_zpthread(void); diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index 04cd087e6a07..d563f19bc02e 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -42,13 +42,11 @@ struct zclient *zclient; /* Router-id update message from zebra. */ -static int pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS) +static void pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct prefix router_id; zebra_router_id_update_read(zclient->ibuf, &router_id); - - return 0; } #ifdef PIM_DEBUG_IFADDR_DUMP @@ -74,7 +72,7 @@ static void dump_if_address(struct interface *ifp) } #endif -static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) +static void pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) { struct connected *c; struct prefix *p; @@ -90,7 +88,7 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) */ c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) - return 0; + return; pim_ifp = c->ifp->info; p = c->address; @@ -125,7 +123,7 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) } #else /* PIM_IPV != 4 */ if (p->family != PIM_AF) - return 0; + return; #endif pim_if_addr_add(c); @@ -137,7 +135,7 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) if (PIM_DEBUG_ZEBRA) zlog_debug("%s: Unable to find pim instance", __func__); - return 0; + return; } pim_ifp->pim = pim; @@ -154,17 +152,16 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS) pim_if_addr_add_all(ifp); } } - return 0; } -static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) +static void pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) { struct connected *c; struct prefix *p; struct vrf *vrf = vrf_lookup_by_id(vrf_id); if (!vrf) - return 0; + return; /* zebra api notifies address adds/dels events by using the same call @@ -176,7 +173,7 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) */ c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) - return 0; + return; p = c->address; @@ -202,7 +199,6 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS) } connected_free(&c); - return 0; } void pim_zebra_update_all_interfaces(struct pim_instance *pim) @@ -306,8 +302,7 @@ void pim_zebra_upstream_rpf_changed(struct pim_instance *pim, pim_upstream_update_join_desired(pim, up); } -__attribute__((unused)) -static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) +__attribute__((unused)) static void pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) { struct stream *s; struct pim_instance *pim; @@ -316,7 +311,7 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) pim = pim_get_pim_instance(vrf_id); if (!pim) - return 0; + return; s = zclient->ibuf; @@ -333,7 +328,7 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) else pim_vxlan_sg_del(pim, &sg); - return 0; + return; } __attribute__((unused)) diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 65afce8cb724..885849b4c787 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -504,7 +504,7 @@ static void rip_apply_address_add(struct connected *ifc) 0); } -int rip_interface_address_add(ZAPI_CALLBACK_ARGS) +void rip_interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *ifc; struct prefix *p; @@ -513,7 +513,7 @@ int rip_interface_address_add(ZAPI_CALLBACK_ARGS) zclient->ibuf, vrf_id); if (ifc == NULL) - return 0; + return; p = ifc->address; @@ -527,8 +527,6 @@ int rip_interface_address_add(ZAPI_CALLBACK_ARGS) hook_call(rip_ifaddr_add, ifc); } - - return 0; } static void rip_apply_address_del(struct connected *ifc) @@ -556,7 +554,7 @@ static void rip_apply_address_del(struct connected *ifc) &address, ifc->ifp->ifindex); } -int rip_interface_address_delete(ZAPI_CALLBACK_ARGS) +void rip_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *ifc; struct prefix *p; @@ -579,8 +577,6 @@ int rip_interface_address_delete(ZAPI_CALLBACK_ARGS) connected_free(&ifc); } - - return 0; } /* Check interface is enabled by network statement. */ diff --git a/ripd/rip_interface.h b/ripd/rip_interface.h index eee654b49714..7e9ccf459861 100644 --- a/ripd/rip_interface.h +++ b/ripd/rip_interface.h @@ -12,15 +12,13 @@ DECLARE_MTYPE(RIP_INTERFACE_STRING); -extern int rip_interface_down(int, struct zclient *, zebra_size_t, vrf_id_t); -extern int rip_interface_up(int, struct zclient *, zebra_size_t, vrf_id_t); -extern int rip_interface_add(int, struct zclient *, zebra_size_t, vrf_id_t); -extern int rip_interface_delete(int, struct zclient *, zebra_size_t, vrf_id_t); -extern int rip_interface_address_add(int, struct zclient *, zebra_size_t, - vrf_id_t); -extern int rip_interface_address_delete(int, struct zclient *, zebra_size_t, - vrf_id_t); -extern int rip_interface_vrf_update(ZAPI_CALLBACK_ARGS); +extern void rip_interface_down(ZAPI_CALLBACK_ARGS); +extern void rip_interface_up(ZAPI_CALLBACK_ARGS); +extern void rip_interface_add(ZAPI_CALLBACK_ARGS); +extern void rip_interface_delete(ZAPI_CALLBACK_ARGS); +extern void rip_interface_address_add(ZAPI_CALLBACK_ARGS); +extern void rip_interface_address_delete(ZAPI_CALLBACK_ARGS); +extern void rip_interface_vrf_update(ZAPI_CALLBACK_ARGS); extern void rip_interface_sync(struct interface *ifp); #endif /* _QUAGGA_RIP_INTERFACE_H */ diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c index ce94e8e7545f..51ffa455fb0b 100644 --- a/ripd/rip_zebra.c +++ b/ripd/rip_zebra.c @@ -104,7 +104,7 @@ void rip_zebra_ipv4_delete(struct rip *rip, struct route_node *rp) } /* Zebra route add and delete treatment. */ -static int rip_zebra_read_route(ZAPI_CALLBACK_ARGS) +static void rip_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct rip *rip; struct zapi_route api; @@ -112,10 +112,10 @@ static int rip_zebra_read_route(ZAPI_CALLBACK_ARGS) rip = rip_lookup_by_vrf_id(vrf_id); if (!rip) - return 0; + return; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; memset(&nh, 0, sizeof(nh)); nh.type = api.nexthops[0].type; @@ -131,8 +131,6 @@ static int rip_zebra_read_route(ZAPI_CALLBACK_ARGS) rip_redistribute_delete(rip, api.type, RIP_ROUTE_REDISTRIBUTE, (struct prefix_ipv4 *)&api.prefix, nh.ifindex); - - return 0; } void rip_redistribute_conf_update(struct rip *rip, int type) diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index 35d92632a00c..4e995b8a6bda 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -309,7 +309,7 @@ static void ripng_apply_address_add(struct connected *ifc) ifc->ifp->ifindex, NULL, 0); } -int ripng_interface_address_add(ZAPI_CALLBACK_ARGS) +void ripng_interface_address_add(ZAPI_CALLBACK_ARGS) { struct connected *c; struct prefix *p; @@ -318,7 +318,7 @@ int ripng_interface_address_add(ZAPI_CALLBACK_ARGS) zclient->ibuf, vrf_id); if (c == NULL) - return 0; + return; p = c->address; @@ -344,8 +344,6 @@ int ripng_interface_address_add(ZAPI_CALLBACK_ARGS) ripng_if_rmap_update_interface(c->ifp); } } - - return 0; } static void ripng_apply_address_del(struct connected *ifc) @@ -374,7 +372,7 @@ static void ripng_apply_address_del(struct connected *ifc) ifc->ifp->ifindex); } -int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS) +void ripng_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *ifc; struct prefix *p; @@ -396,8 +394,6 @@ int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS) } connected_free(&ifc); } - - return 0; } /* Lookup RIPng enable network. */ diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index bb5a880c0214..5418bb948bfd 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -98,7 +98,7 @@ void ripng_zebra_ipv6_delete(struct ripng *ripng, struct agg_node *rp) } /* Zebra route add and delete treatment. */ -static int ripng_zebra_read_route(ZAPI_CALLBACK_ARGS) +static void ripng_zebra_read_route(ZAPI_CALLBACK_ARGS) { struct ripng *ripng; struct zapi_route api; @@ -107,17 +107,17 @@ static int ripng_zebra_read_route(ZAPI_CALLBACK_ARGS) ripng = ripng_lookup_by_vrf_id(vrf_id); if (!ripng) - return 0; + return; if (zapi_route_decode(zclient->ibuf, &api) < 0) - return -1; + return; /* we completely ignore srcdest routes for now. */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) - return 0; + return; if (IN6_IS_ADDR_LINKLOCAL(&api.prefix.u.prefix6)) - return 0; + return; nexthop = api.nexthops[0].gate.ipv6; ifindex = api.nexthops[0].ifindex; @@ -128,11 +128,10 @@ static int ripng_zebra_read_route(ZAPI_CALLBACK_ARGS) (struct prefix_ipv6 *)&api.prefix, ifindex, &nexthop, api.tag); else - ripng_redistribute_delete( - ripng, api.type, RIPNG_ROUTE_REDISTRIBUTE, - (struct prefix_ipv6 *)&api.prefix, ifindex); - - return 0; + ripng_redistribute_delete(ripng, api.type, + RIPNG_ROUTE_REDISTRIBUTE, + (struct prefix_ipv6 *)&api.prefix, + ifindex); } void ripng_redistribute_conf_update(struct ripng *ripng, int type) diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index 3a2bc0c9d37d..5e041c931418 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -407,12 +407,12 @@ extern int ripng_send_packet(caddr_t buf, int bufsize, struct sockaddr_in6 *to, extern void ripng_packet_dump(struct ripng_packet *packet, int size, const char *sndrcv); -extern int ripng_interface_up(ZAPI_CALLBACK_ARGS); -extern int ripng_interface_down(ZAPI_CALLBACK_ARGS); -extern int ripng_interface_add(ZAPI_CALLBACK_ARGS); -extern int ripng_interface_delete(ZAPI_CALLBACK_ARGS); -extern int ripng_interface_address_add(ZAPI_CALLBACK_ARGS); -extern int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS); +extern void ripng_interface_up(ZAPI_CALLBACK_ARGS); +extern void ripng_interface_down(ZAPI_CALLBACK_ARGS); +extern void ripng_interface_add(ZAPI_CALLBACK_ARGS); +extern void ripng_interface_delete(ZAPI_CALLBACK_ARGS); +extern void ripng_interface_address_add(ZAPI_CALLBACK_ARGS); +extern void ripng_interface_address_delete(ZAPI_CALLBACK_ARGS); extern void ripng_interface_sync(struct interface *ifp); extern struct ripng *ripng_lookup_by_vrf_id(vrf_id_t vrf_id); diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index f4947540d221..8d0b934c34fd 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -43,7 +43,7 @@ struct sharp_zclient { /* Head of test zclient list */ static struct sharp_zclient *sharp_clients_head; -static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS); +static void sharp_opaque_handler(ZAPI_CALLBACK_ARGS); /* Utility to add a test zclient struct to the list */ static void add_zclient(struct zclient *client) @@ -71,24 +71,21 @@ static int sharp_ifp_destroy(struct interface *ifp) return 0; } -static int interface_address_add(ZAPI_CALLBACK_ARGS) +static void interface_address_add(ZAPI_CALLBACK_ARGS) { zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); - - return 0; } -static int interface_address_delete(ZAPI_CALLBACK_ARGS) +static void interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *c; c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) - return 0; + return; connected_free(&c); - return 0; } static int sharp_ifp_up(struct interface *ifp) @@ -464,7 +461,7 @@ static void sharp_zclient_buffer_ready(void) } } -static int route_notify_owner(ZAPI_CALLBACK_ARGS) +static void route_notify_owner(ZAPI_CALLBACK_ARGS) { struct timeval r; struct prefix p; @@ -473,7 +470,7 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e, NULL, NULL)) - return -1; + return; switch (note) { case ZAPI_ROUTE_INSTALLED: @@ -506,7 +503,6 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) zlog_debug("Route removal Failure"); break; } - return 0; } static void zebra_connected(struct zclient *zclient) @@ -688,7 +684,7 @@ static void sharp_nexthop_update(struct vrf *vrf, struct prefix *matched, sharp_debug_nexthops(nhr); } -static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS) +static void sharp_redistribute_route(ZAPI_CALLBACK_ARGS) { struct zapi_route api; @@ -700,8 +696,6 @@ static int sharp_redistribute_route(ZAPI_CALLBACK_ARGS) zebra_route_string(api.type)); sharp_debug_nexthops(&api); - - return 0; } void sharp_redistribute_vrf(struct vrf *vrf, int type) @@ -773,7 +767,7 @@ static const char *const type2txt[] = {"Generic", "Vertex", "Edge", "Subnet"}; static const char *const status2txt[] = {"Unknown", "New", "Update", "Delete", "Sync", "Orphan"}; /* Handler for opaque messages */ -static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS) +static void sharp_opaque_handler(ZAPI_CALLBACK_ARGS) { struct stream *s; struct zapi_opaque_msg info; @@ -782,7 +776,7 @@ static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS) s = zclient->ibuf; if (zclient_opaque_decode(s, &info) != 0) - return -1; + return; zlog_debug("%s: [%u] received opaque type %u", __func__, zclient->session_id, info.type); @@ -799,12 +793,10 @@ static int sharp_opaque_handler(ZAPI_CALLBACK_ARGS) "%s: Error to convert Stream into Link State", __func__); } - - return 0; } /* Handler for opaque notification messages */ -static int sharp_opq_notify_handler(ZAPI_CALLBACK_ARGS) +static void sharp_opq_notify_handler(ZAPI_CALLBACK_ARGS) { struct stream *s; struct zapi_opaque_notif_info info; @@ -812,7 +804,7 @@ static int sharp_opq_notify_handler(ZAPI_CALLBACK_ARGS) s = zclient->ibuf; if (zclient_opaque_notif_decode(s, &info) != 0) - return -1; + return; if (info.reg) zlog_debug("%s: received opaque notification REG, type %u => %d/%d/%d", @@ -821,8 +813,6 @@ static int sharp_opq_notify_handler(ZAPI_CALLBACK_ARGS) else zlog_debug("%s: received opaque notification UNREG, type %u", __func__, info.msg_type); - - return 0; } /* @@ -916,13 +906,13 @@ void sharp_zebra_send_arp(const struct interface *ifp, const struct prefix *p) zclient_send_neigh_discovery_req(zclient, ifp, p); } -static int nhg_notify_owner(ZAPI_CALLBACK_ARGS) +static void nhg_notify_owner(ZAPI_CALLBACK_ARGS) { enum zapi_nhg_notify_owner note; uint32_t id; if (!zapi_nhg_notify_decode(zclient->ibuf, &id, ¬e)) - return -1; + return; switch (note) { case ZAPI_NHG_INSTALLED: @@ -940,8 +930,6 @@ static int nhg_notify_owner(ZAPI_CALLBACK_ARGS) zlog_debug("Failed removal of nhg %u", id); break; } - - return 0; } int sharp_zebra_srv6_manager_get_locator_chunk(const char *locator_name) @@ -954,7 +942,7 @@ int sharp_zebra_srv6_manager_release_locator_chunk(const char *locator_name) return srv6_manager_release_locator_chunk(zclient, locator_name); } -static int sharp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) +static void sharp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) { struct stream *s = NULL; struct srv6_locator_chunk s6c = {}; @@ -977,19 +965,18 @@ static int sharp_zebra_process_srv6_locator_chunk(ZAPI_CALLBACK_ARGS) for (ALL_LIST_ELEMENTS_RO(loc->chunks, chunk_node, c)) if (!prefix_cmp(c, &s6c.prefix)) - return 0; + return; chunk = prefix_ipv6_new(); *chunk = s6c.prefix; listnode_add(loc->chunks, chunk); - return 0; + return; } zlog_err("%s: can't get locator_chunk!!", __func__); - return 0; } -static int sharp_zebra_process_neigh(ZAPI_CALLBACK_ARGS) +static void sharp_zebra_process_neigh(ZAPI_CALLBACK_ARGS) { union sockunion addr = {}, lladdr = {}; struct zapi_neigh_ip api = {}; @@ -999,7 +986,7 @@ static int sharp_zebra_process_neigh(ZAPI_CALLBACK_ARGS) zclient_neigh_ip_decode(zclient->ibuf, &api); if (api.ip_in.ipa_type == AF_UNSPEC) - return 0; + return; sockunion_family(&addr) = api.ip_in.ipa_type; memcpy((uint8_t *)sockunion_get_addr(&addr), &api.ip_in.ip.addr, @@ -1014,14 +1001,12 @@ static int sharp_zebra_process_neigh(ZAPI_CALLBACK_ARGS) if (!ifp) { zlog_debug("Failed to lookup interface for neighbor entry: %u for %u", api.index, vrf_id); - return 0; + return; } zlog_debug("Received: %s %pSU dev %s lladr %pSU", (cmd == ZEBRA_NEIGH_ADDED) ? "NEW" : "DEL", &addr, ifp->name, &lladdr); - - return 0; } int sharp_zebra_send_interface_protodown(struct interface *ifp, bool down) diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index 68761c0084bd..0d75c95c596b 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -89,24 +89,21 @@ static int static_ifp_destroy(struct interface *ifp) return 0; } -static int interface_address_add(ZAPI_CALLBACK_ARGS) +static void interface_address_add(ZAPI_CALLBACK_ARGS) { zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); - - return 0; } -static int interface_address_delete(ZAPI_CALLBACK_ARGS) +static void interface_address_delete(ZAPI_CALLBACK_ARGS) { struct connected *c; c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) - return 0; + return; connected_free(&c); - return 0; } static int static_ifp_up(struct interface *ifp) @@ -125,7 +122,7 @@ static int static_ifp_down(struct interface *ifp) return 0; } -static int route_notify_owner(ZAPI_CALLBACK_ARGS) +static void route_notify_owner(ZAPI_CALLBACK_ARGS) { struct prefix p; enum zapi_route_notify_owner note; @@ -134,7 +131,7 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) if (!zapi_route_notify_decode(zclient->ibuf, &p, &table_id, ¬e, NULL, &safi)) - return -1; + return; switch (note) { case ZAPI_ROUTE_FAIL_INSTALL: @@ -160,8 +157,6 @@ static int route_notify_owner(ZAPI_CALLBACK_ARGS) __func__, &p, table_id); break; } - - return 0; } static void zebra_connected(struct zclient *zclient) diff --git a/vrrpd/vrrp_zebra.c b/vrrpd/vrrp_zebra.c index 009432b217c3..6fdc3b76872a 100644 --- a/vrrpd/vrrp_zebra.c +++ b/vrrpd/vrrp_zebra.c @@ -56,14 +56,11 @@ static void vrrp_zebra_connected(struct zclient *zclient) } /* Router-id update message from zebra. */ -static int vrrp_router_id_update_zebra(int command, struct zclient *zclient, - zebra_size_t length, vrf_id_t vrf_id) +static void vrrp_router_id_update_zebra(ZAPI_CALLBACK_ARGS) { struct prefix router_id; zebra_router_id_update_read(zclient->ibuf, &router_id); - - return 0; } int vrrp_ifp_create(struct interface *ifp) @@ -102,8 +99,7 @@ int vrrp_ifp_down(struct interface *ifp) return 0; } -static int vrrp_zebra_if_address_add(int command, struct zclient *zclient, - zebra_size_t length, vrf_id_t vrf_id) +static void vrrp_zebra_if_address_add(ZAPI_CALLBACK_ARGS) { struct connected *c; @@ -115,21 +111,18 @@ static int vrrp_zebra_if_address_add(int command, struct zclient *zclient, * will add address to interface list by calling * connected_add_by_prefix() */ - c = zebra_interface_address_read(command, zclient->ibuf, vrf_id); + c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) - return 0; + return; vrrp_zebra_debug_if_state(c->ifp, __func__); vrrp_zebra_debug_if_dump_address(c->ifp, __func__); vrrp_if_address_add(c->ifp); - - return 0; } -static int vrrp_zebra_if_address_del(int command, struct zclient *client, - zebra_size_t length, vrf_id_t vrf_id) +static void vrrp_zebra_if_address_del(ZAPI_CALLBACK_ARGS) { struct connected *c; @@ -141,17 +134,15 @@ static int vrrp_zebra_if_address_del(int command, struct zclient *client, * will remove address from interface list by calling * connected_delete_by_prefix() */ - c = zebra_interface_address_read(command, client->ibuf, vrf_id); + c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id); if (!c) - return 0; + return; vrrp_zebra_debug_if_state(c->ifp, __func__); vrrp_zebra_debug_if_dump_address(c->ifp, __func__); vrrp_if_address_del(c->ifp); - - return 0; } void vrrp_zebra_radv_set(struct vrrp_router *r, bool enable)