void router_id_del_address (struct connected *ifc) { struct connected *c; struct list *l; struct prefix after; struct prefix before; struct listnode *node; struct zserv *client; if (router_id_bad_address (ifc)) return; router_id_get (&before); if (!strncmp (ifc->ifp->name, "lo", 2) || !strncmp (ifc->ifp->name, "dummy", 5)) l = &rid_lo_sorted_list; else l = &rid_all_sorted_list; if ((c = router_id_find_node (l, ifc))) listnode_delete (l, c); router_id_get (&after); if (prefix_same (&before, &after)) return; for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client)) zsend_router_id_update (client, &after); }
void router_id_add_address (struct connected *ifc) { struct list *l = NULL; struct listnode *node; struct prefix before; struct prefix after; struct zserv *client; struct zebra_vrf *zvrf = vrf_info_get (ifc->ifp->vrf_id); if (router_id_bad_address (ifc)) return; router_id_get (&before, zvrf->vrf_id); if (!strncmp (ifc->ifp->name, "lo", 2) || !strncmp (ifc->ifp->name, "dummy", 5)) l = zvrf->rid_lo_sorted_list; else l = zvrf->rid_all_sorted_list; if (!router_id_find_node (l, ifc)) listnode_add_sort (l, ifc); router_id_get (&after, zvrf->vrf_id); if (prefix_same (&before, &after)) return; for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client)) zsend_router_id_update (client, &after, zvrf->vrf_id); }
/* Register zebra server router-id information. Send current router-id */ void zread_router_id_add (struct zserv *client, u_short length) { struct prefix p; /* Router-id information is needed. */ client->ridinfo = 1; router_id_get (&p); zsend_router_id_update (client,&p); }
static void router_id_set (struct prefix *p) { struct prefix p2; struct listnode *node; struct zserv *client; rid_user_assigned.u.prefix4.s_addr = p->u.prefix4.s_addr; router_id_get (&p2); for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client)) zsend_router_id_update (client, &p2); }
static void router_id_set (struct prefix *p, vrf_id_t vrf_id) { struct prefix p2; struct listnode *node; struct zserv *client; struct zebra_vrf *zvrf; if (p->u.prefix4.s_addr == 0) /* unset */ { zvrf = vrf_info_lookup (vrf_id); if (! zvrf) return; } else /* set */ zvrf = vrf_info_get (vrf_id); zvrf->rid_user_assigned.u.prefix4.s_addr = p->u.prefix4.s_addr; router_id_get (&p2, vrf_id); for (ALL_LIST_ELEMENTS_RO (zebrad.client_list, node, client)) zsend_router_id_update (client, &p2, vrf_id); }