return 0;
}
+static int eigrp_zebra_route_notify_owner(int command, struct zclient *zclient,
+ zebra_size_t length, vrf_id_t vrf_id)
+{
+ struct prefix p;
+ enum zapi_route_notify_owner note;
+ uint32_t table;
+
+ if (!zapi_route_notify_decode(zclient->ibuf, &p, &table, ¬e))
+ return -1;
+
+ return 0;
+}
+
static void eigrp_zebra_connected(struct zclient *zclient)
{
zclient_send_reg_requests(zclient, VRF_DEFAULT);
void eigrp_zebra_init(void)
{
- zclient = zclient_new(master);
+ struct zclient_options opt = {.receive_notify = false};
- zclient_init(zclient, ZEBRA_ROUTE_EIGRP, 0);
+ zclient = zclient_new(master, &opt);
+
+ zclient_init(zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs);
zclient->zebra_connected = eigrp_zebra_connected;
zclient->router_id_update = eigrp_router_id_update_zebra;
zclient->interface_add = eigrp_interface_add;
zclient->interface_address_delete = eigrp_interface_address_delete;
zclient->redistribute_route_add = eigrp_zebra_read_route;
zclient->redistribute_route_del = eigrp_zebra_read_route;
+ zclient->route_notify_owner = eigrp_zebra_route_notify_owner;
}
zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
+ struct eigrp_interface *ei;
ifp = zebra_interface_add_read(zclient->ibuf, vrf_id);
- assert(ifp->info);
+ if (!ifp->info)
+ return 0;
- if (!EIGRP_IF_PARAM_CONFIGURED(IF_DEF_PARAMS(ifp), type)) {
- SET_IF_PARAM(IF_DEF_PARAMS(ifp), type);
- IF_DEF_PARAMS(ifp)->type = eigrp_default_iftype(ifp);
- }
+ ei = ifp->info;
+
+ ei->params.type = eigrp_default_iftype(ifp);
eigrp_if_update(ifp);
{
struct interface *ifp;
struct stream *s;
- struct route_node *rn;
s = zclient->ibuf;
/* zebra_interface_state_read () updates interface structure in iflist
ifp->name, ifp->ifindex, (unsigned long long)ifp->flags,
ifp->metric, ifp->mtu);
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn))
- if (rn->info)
- eigrp_if_free((struct eigrp_interface *)rn->info,
- INTERFACE_DOWN_BY_ZEBRA);
+ if (ifp->info)
+ eigrp_if_free(ifp->info, INTERFACE_DOWN_BY_ZEBRA);
- ifp->ifindex = IFINDEX_INTERNAL;
+ if_set_index(ifp, IFINDEX_INTERNAL);
return 0;
}
struct connected *c;
struct interface *ifp;
struct eigrp_interface *ei;
- struct route_node *rn;
- struct prefix p;
c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
}
ifp = c->ifp;
- p = *c->address;
- p.prefixlen = IPV4_MAX_PREFIXLEN;
-
- rn = route_node_lookup(IF_OIFS(ifp), &p);
- if (!rn) {
- connected_free(c);
+ ei = ifp->info;
+ if (!ei)
return 0;
- }
-
- assert(rn->info);
- ei = rn->info;
/* Call interface hook functions to clean up */
eigrp_if_free(ei, INTERFACE_DOWN_BY_ZEBRA);
zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
- struct eigrp_interface *ei;
- struct route_node *rn;
ifp = zebra_interface_if_lookup(zclient->ibuf);
zlog_debug("Zebra: Interface[%s] state change to up.",
ifp->name);
- for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
- if ((ei = rn->info) == NULL)
- continue;
-
- eigrp_if_up(ei);
- }
+ if (ifp->info)
+ eigrp_if_up(ifp->info);
return 0;
}
zebra_size_t length, vrf_id_t vrf_id)
{
struct interface *ifp;
- struct eigrp_interface *ei;
- struct route_node *node;
ifp = zebra_interface_state_read(zclient->ibuf, vrf_id);
zlog_debug("Zebra: Interface[%s] state change to down.",
ifp->name);
- for (node = route_top(IF_OIFS(ifp)); node; node = route_next(node)) {
- if ((ei = node->info) == NULL)
- continue;
- eigrp_if_down(ei);
- }
+ if (ifp->info)
+ eigrp_if_down(ifp->info);
return 0;
}
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* And look it up. */
- return if_lookup_by_name_len(
- ifname_tmp, strnlen(ifname_tmp, INTERFACE_NAMSIZ), VRF_DEFAULT);
+ return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
}
void eigrp_zebra_route_add(struct prefix *p, struct list *successors)
if (count >= MULTIPATH_NUM)
break;
api_nh = &api.nexthops[count];
+ api_nh->vrf_id = VRF_DEFAULT;
if (te->adv_router->src.s_addr) {
api_nh->gate.ipv4 = te->adv_router->src;
api_nh->type = NEXTHOP_TYPE_IPV4_IFINDEX;