From: Donald Sharp Date: Wed, 25 May 2016 05:31:30 +0000 (-0400) Subject: pimd: Rework pim to handle changes between us and upstream X-Git-Tag: frr-2.0-rc1~870 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=469351b349831196b3d4ac7fbfdf276b5581499c;p=mirror%2Ffrr.git pimd: Rework pim to handle changes between us and upstream The code in pimd needs to be updated to handle the changes we've made to api's that it depends on. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 6b2ac6646c..1eab5d05f7 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -157,7 +157,7 @@ static void pim_show_assert(struct vty *vty) "Interface Address Source Group State Winner Uptime Timer%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *ch_node; @@ -218,7 +218,7 @@ static void pim_show_assert_internal(struct vty *vty) "Interface Address Source Group CA eCA ATD eATD%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *ch_node; @@ -262,7 +262,7 @@ static void pim_show_assert_metric(struct vty *vty) "Interface Address Source Group RPT Pref Metric Address %s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *ch_node; @@ -313,7 +313,7 @@ static void pim_show_assert_winner_metric(struct vty *vty) "Interface Address Source Group RPT Pref Metric Address %s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *ch_node; @@ -376,7 +376,7 @@ static void pim_show_membership(struct vty *vty) "Interface Address Source Group Membership%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *ch_node; @@ -423,7 +423,7 @@ static void igmp_show_interfaces(struct vty *vty) "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct listnode *sock_node; struct igmp_sock *igmp; @@ -470,7 +470,7 @@ static void igmp_show_interface_join(struct vty *vty) "Interface Address Source Group Socket Uptime %s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct listnode *join_node; struct igmp_join *ij; @@ -520,7 +520,7 @@ static void show_interface_address(struct vty *vty) "Interface Primary Secondary %s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, ifpnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifpnode, ifp)) { struct listnode *ifcnode; struct connected *ifc; struct in_addr pri_addr; @@ -567,7 +567,7 @@ static void pim_show_dr(struct vty *vty) vty_out(vty, "Interface Address DR Uptime Elections Changes NonPri%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; char dr_str[100]; @@ -611,7 +611,7 @@ static void pim_show_hello(struct vty *vty) vty_out(vty, "Interface Address Period Timer StatStart Recv Rfail Send Sfail%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; char hello_period[10]; @@ -656,7 +656,7 @@ static void pim_show_interfaces(struct vty *vty) vty_out(vty, "Interface Address ifIndex Socket Uptime Multi Broad MLoop AllMu Prmsc Del%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; char uptime[10]; @@ -704,7 +704,7 @@ static void pim_show_join(struct vty *vty) "Interface Address Source Group State Uptime Expire Prune%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *ch_node; @@ -765,7 +765,7 @@ static void pim_show_neighbors(struct vty *vty) vty_out(vty, "Interface Address Neighbor Uptime Timer Holdt DrPri GenId Recv %s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *neighnode; @@ -833,7 +833,7 @@ static void pim_show_lan_prune_delay(struct vty *vty) vty_out(vty, "Interface Address PrDly OvInt NoDly HiDly HiInt T | Neighbor LPD PrDly OvInt T%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *neighnode; @@ -889,7 +889,7 @@ static void pim_show_jp_override_interval(struct vty *vty) vty_out(vty, "Interface Address LAN_Delay EffPDelay EffOvrInt JPOvrInt%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; @@ -921,7 +921,7 @@ static void pim_show_neighbors_secondary(struct vty *vty) vty_out(vty, "Interface Address Neighbor Secondary %s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct listnode *neighnode; @@ -1015,7 +1015,7 @@ static void pim_show_join_desired(struct vty *vty) VTY_NEWLINE); /* scan all interfaces */ - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; @@ -1163,7 +1163,7 @@ static void igmp_show_querier(struct vty *vty) vty_out(vty, "Interface Address Querier StartCount Query-Timer Other-Timer%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp = ifp->info; struct listnode *sock_node; struct igmp_sock *igmp; @@ -1201,7 +1201,7 @@ static void igmp_show_groups(struct vty *vty) vty_out(vty, "Interface Address Group Mode Timer Srcs V Uptime %s", VTY_NEWLINE); /* scan interfaces */ - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp = ifp->info; struct listnode *sock_node; struct igmp_sock *igmp; @@ -1251,7 +1251,7 @@ static void igmp_show_group_retransmission(struct vty *vty) vty_out(vty, "Interface Address Group RetTimer Counter RetSrcs%s", VTY_NEWLINE); /* scan interfaces */ - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp = ifp->info; struct listnode *sock_node; struct igmp_sock *igmp; @@ -1317,7 +1317,7 @@ static void igmp_show_parameters(struct vty *vty) VTY_NEWLINE); /* scan interfaces */ - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp = ifp->info; struct listnode *sock_node; struct igmp_sock *igmp; @@ -1385,7 +1385,7 @@ static void igmp_show_sources(struct vty *vty) vty_out(vty, "Interface Address Group Source Timer Fwd Uptime %s", VTY_NEWLINE); /* scan interfaces */ - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp = ifp->info; struct listnode *sock_node; struct igmp_sock *igmp; @@ -1445,7 +1445,7 @@ static void igmp_show_source_retransmission(struct vty *vty) vty_out(vty, "Interface Address Group Source Counter%s", VTY_NEWLINE); /* scan interfaces */ - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp = ifp->info; struct listnode *sock_node; struct igmp_sock *igmp; @@ -1495,11 +1495,11 @@ static void clear_igmp_interfaces() struct listnode *ifnextnode; struct interface *ifp; - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_if_addr_del_all_igmp(ifp); } - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_if_addr_add_all(ifp); } } @@ -1510,7 +1510,7 @@ static void clear_pim_interfaces() struct listnode *ifnextnode; struct interface *ifp; - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { if (ifp->info) { pim_neighbor_delete_all(ifp, "interface cleared"); } @@ -2015,7 +2015,7 @@ static void show_multicast_interfaces(struct vty *vty) vty_out(vty, "Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut%s", VTY_NEWLINE); - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { struct pim_interface *pim_ifp; struct in_addr ifaddr; struct sioc_vif_req vreq; @@ -3535,7 +3535,7 @@ static struct igmp_sock *find_igmp_sock_by_fd(int fd) struct interface *ifp; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { struct pim_interface *pim_ifp; struct igmp_sock *igmp; diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index ecf9ef6bcb..e9dcf72910 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -26,6 +26,7 @@ #include "vty.h" #include "memory.h" #include "prefix.h" +#include "vrf.h" #include "pimd.h" #include "pim_iface.h" @@ -45,7 +46,7 @@ static void pim_if_igmp_join_del_all(struct interface *ifp); void pim_if_init() { - if_init(); + vrf_iflist_create(VRF_DEFAULT); } static void *if_list_clean(struct pim_interface *pim_ifp) @@ -702,7 +703,7 @@ static int iflist_find_highest_vif_index() struct pim_interface *pim_ifp; int highest_vif_index = -1; - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; @@ -754,7 +755,7 @@ void pim_if_add_vif_all() struct listnode *ifnextnode; struct interface *ifp; - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { if (!ifp->info) continue; @@ -768,7 +769,7 @@ void pim_if_del_vif_all() struct listnode *ifnextnode; struct interface *ifp; - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { if (!ifp->info) continue; @@ -781,7 +782,7 @@ struct interface *pim_if_find_by_vif_index(int vif_index) struct listnode *ifnode; struct interface *ifp; - for (ALL_LIST_ELEMENTS_RO(iflist, ifnode, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { if (ifp->info) { struct pim_interface *pim_ifp; pim_ifp = ifp->info; diff --git a/pimd/pim_main.c b/pimd/pim_main.c index b57f881131..f5957b0a4d 100644 --- a/pimd/pim_main.c +++ b/pimd/pim_main.c @@ -132,7 +132,7 @@ int main(int argc, char** argv, char** envp) { progname = ((p = strrchr(argv[0], '/')) ? ++p : argv[0]); - zlog_default = openzlog(progname, ZLOG_PIM, + zlog_default = openzlog(progname, ZLOG_PIM, 0, LOG_CONS|LOG_NDELAY|LOG_PID, LOG_DAEMON); /* this while just reads the options */ diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index d02f91548e..7bd23ffc61 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -258,7 +258,7 @@ static void forward_on(struct pim_upstream *up) struct pim_ifchannel *ch; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; @@ -287,7 +287,7 @@ static void forward_off(struct pim_upstream *up) struct pim_ifchannel *ch; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; @@ -456,7 +456,7 @@ int pim_upstream_evaluate_join_desired(struct pim_upstream *up) struct pim_ifchannel *ch; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; @@ -566,7 +566,7 @@ void pim_upstream_rpf_interface_changed(struct pim_upstream *up, struct interface *ifp; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { struct listnode *chnode; struct listnode *chnextnode; struct pim_ifchannel *ch; @@ -609,7 +609,7 @@ void pim_upstream_update_could_assert(struct pim_upstream *up) struct pim_ifchannel *ch; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; @@ -637,7 +637,7 @@ void pim_upstream_update_my_assert_metric(struct pim_upstream *up) struct pim_ifchannel *ch; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; @@ -665,7 +665,7 @@ static void pim_upstream_update_assert_tracking_desired(struct pim_upstream *up) struct pim_ifchannel *ch; /* scan all interfaces */ - for (ALL_LIST_ELEMENTS(iflist, ifnode, ifnextnode, ifp)) { + for (ALL_LIST_ELEMENTS (vrf_iflist (VRF_DEFAULT), ifnode, ifnextnode, ifp)) { pim_ifp = ifp->info; if (!pim_ifp) continue; diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c index bcace95c95..641f5dc185 100644 --- a/pimd/pim_vty.c +++ b/pimd/pim_vty.c @@ -24,6 +24,7 @@ #include "if.h" #include "linklist.h" +#include "vrf.h" #include "pimd.h" #include "pim_vty.h" @@ -119,7 +120,7 @@ int pim_interface_config_write(struct vty *vty) struct listnode *node; struct interface *ifp; - for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) { + for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp)) { /* IF name */ vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE); diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c index e102f278d8..4cfb359a5a 100644 --- a/pimd/pim_zebra.c +++ b/pimd/pim_zebra.c @@ -70,7 +70,7 @@ static void zclient_broken(struct zclient *zclient) /* Router-id update message from zebra. */ static int pim_router_id_update_zebra(int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct prefix router_id; @@ -80,7 +80,7 @@ static int pim_router_id_update_zebra(int command, struct zclient *zclient, } static int pim_zebra_if_add(int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp; @@ -88,7 +88,7 @@ static int pim_zebra_if_add(int command, struct zclient *zclient, zebra api adds/dels interfaces using the same call interface_add_read below, see comments in lib/zclient.c */ - ifp = zebra_interface_add_read(zclient->ibuf); + ifp = zebra_interface_add_read(zclient->ibuf, vrf_id); if (!ifp) return 0; @@ -106,7 +106,7 @@ static int pim_zebra_if_add(int command, struct zclient *zclient, } static int pim_zebra_if_del(int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp; @@ -120,7 +120,7 @@ static int pim_zebra_if_del(int command, struct zclient *zclient, pimd to assert. Other clients use zebra_interface_state_read and it appears to work just fine. */ - ifp = zebra_interface_state_read(zclient->ibuf); + ifp = zebra_interface_state_read(zclient->ibuf, vrf_id); if (!ifp) return 0; @@ -138,7 +138,7 @@ static int pim_zebra_if_del(int command, struct zclient *zclient, } static int pim_zebra_if_state_up(int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp; @@ -146,7 +146,7 @@ static int pim_zebra_if_state_up(int command, struct zclient *zclient, zebra api notifies interface up/down events by using the same call zebra_interface_state_read below, see comments in lib/zclient.c */ - ifp = zebra_interface_state_read(zclient->ibuf); + ifp = zebra_interface_state_read(zclient->ibuf, vrf_id); if (!ifp) return 0; @@ -170,7 +170,7 @@ static int pim_zebra_if_state_up(int command, struct zclient *zclient, } static int pim_zebra_if_state_down(int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct interface *ifp; @@ -178,7 +178,7 @@ static int pim_zebra_if_state_down(int command, struct zclient *zclient, zebra api notifies interface up/down events by using the same call zebra_interface_state_read below, see comments in lib/zclient.c */ - ifp = zebra_interface_state_read(zclient->ibuf); + ifp = zebra_interface_state_read(zclient->ibuf, vrf_id); if (!ifp) return 0; @@ -237,7 +237,7 @@ static void dump_if_address(struct interface *ifp) #endif static int pim_zebra_if_address_add(int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct connected *c; struct prefix *p; @@ -252,7 +252,7 @@ static int pim_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); + c = zebra_interface_address_read(command, zclient->ibuf, vrf_id); if (!c) return 0; @@ -299,7 +299,7 @@ static int pim_zebra_if_address_add(int command, struct zclient *zclient, } static int pim_zebra_if_address_del(int command, struct zclient *client, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct connected *c; struct prefix *p; @@ -314,7 +314,7 @@ static int pim_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); + c = zebra_interface_address_read(command, client->ibuf, vrf_id); if (!c) return 0; @@ -526,7 +526,7 @@ static void sched_rpf_cache_refresh() } static int redist_read_ipv4_route(int command, struct zclient *zclient, - zebra_size_t length) + zebra_size_t length, vrf_id_t vrf_id) { struct stream *s; struct zapi_ipv4 api; @@ -664,7 +664,7 @@ void pim_zebra_init(char *zebra_sock_path) #endif /* Socket for receiving updates from Zebra daemon */ - qpim_zclient_update = zclient_new(); + qpim_zclient_update = zclient_new (master); qpim_zclient_update->router_id_update = pim_router_id_update_zebra; qpim_zclient_update->interface_add = pim_zebra_if_add; @@ -676,7 +676,7 @@ void pim_zebra_init(char *zebra_sock_path) qpim_zclient_update->ipv4_route_add = redist_read_ipv4_route; qpim_zclient_update->ipv4_route_delete = redist_read_ipv4_route; - zclient_init(qpim_zclient_update, ZEBRA_ROUTE_PIM); + zclient_init(qpim_zclient_update, ZEBRA_ROUTE_PIM, 0); if (PIM_DEBUG_PIM_TRACE) { zlog_info("zclient_init cleared redistribution request"); } @@ -687,7 +687,7 @@ void pim_zebra_init(char *zebra_sock_path) for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { if (i == qpim_zclient_update->redist_default) continue; - qpim_zclient_update->redist[i] = 1; + vrf_bitmap_set (qpim_zclient_update->redist[AFI_IP][i], VRF_DEFAULT);; if (PIM_DEBUG_PIM_TRACE) { zlog_debug("%s: requesting redistribution for %s (%i)", __PRETTY_FUNCTION__, zebra_route_string(i), i); diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 2e71dc4ef9..94a627b727 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -122,7 +122,7 @@ struct zclient *zclient_lookup_new() { struct zclient *zlookup; - zlookup = zclient_new(); + zlookup = zclient_new (master); if (!zlookup) { zlog_err("%s: zclient_new() failure", __PRETTY_FUNCTION__); @@ -252,7 +252,6 @@ static int zclient_read_nexthop(struct zclient *zlookup, switch (nexthop_type) { case ZEBRA_NEXTHOP_IFINDEX: - case ZEBRA_NEXTHOP_IFNAME: case ZEBRA_NEXTHOP_IPV4_IFINDEX: if (num_ifindex >= tab_size) { char addr_str[100]; @@ -346,7 +345,7 @@ static int zclient_lookup_nexthop_once(struct zclient *zlookup, s = zlookup->obuf; stream_reset(s); - zclient_create_header(s, ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB); + zclient_create_header(s, ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB, VRF_DEFAULT); stream_put_in_addr(s, &addr); stream_putw_at(s, 0, stream_get_endp(s)); diff --git a/pimd/pimd.c b/pimd/pimd.c index 855defcc78..3bbbeaebc3 100644 --- a/pimd/pimd.c +++ b/pimd/pimd.c @@ -42,7 +42,7 @@ const char *const PIM_ALL_ROUTERS = MCAST_ALL_ROUTERS; const char *const PIM_ALL_PIM_ROUTERS = MCAST_ALL_PIM_ROUTERS; const char *const PIM_ALL_IGMP_ROUTERS = MCAST_ALL_IGMP_ROUTERS; -struct thread_master *master = 0; +struct thread_master *master = NULL; uint32_t qpim_debugs = 0; int qpim_mroute_socket_fd = -1; int64_t qpim_mroute_socket_creation = 0; /* timestamp of creation */ diff --git a/pimd/pimd.h b/pimd/pimd.h index 22a29220d6..a34d951fa7 100644 --- a/pimd/pimd.h +++ b/pimd/pimd.h @@ -72,7 +72,7 @@ const char *const PIM_ALL_ROUTERS; const char *const PIM_ALL_PIM_ROUTERS; const char *const PIM_ALL_IGMP_ROUTERS; -struct thread_master *master; +extern struct thread_master *master; uint32_t qpim_debugs; int qpim_mroute_socket_fd; int64_t qpim_mroute_socket_creation; /* timestamp of creation */