#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
-static int eigrp_interface_add(int, struct zclient *, zebra_size_t, vrf_id_t);
-static int eigrp_interface_delete(int, struct zclient *, zebra_size_t,
- vrf_id_t);
-static int eigrp_interface_address_add(int, struct zclient *, zebra_size_t,
- vrf_id_t vrf_id);
-static int eigrp_interface_address_delete(int, struct zclient *, zebra_size_t,
- vrf_id_t vrf_id);
-static int eigrp_interface_state_up(int, struct zclient *, zebra_size_t,
- vrf_id_t vrf_id);
-static int eigrp_interface_state_down(int, struct zclient *, zebra_size_t,
- vrf_id_t vrf_id);
+static int eigrp_interface_add(ZAPI_CALLBACK_ARGS);
+static int eigrp_interface_delete(ZAPI_CALLBACK_ARGS);
+static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS);
+static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS);
+static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS);
+static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS);
static struct interface *zebra_interface_if_lookup(struct stream *);
-static int eigrp_zebra_read_route(int, struct zclient *, zebra_size_t,
- vrf_id_t vrf_id);
+static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);
/* Zebra structure to hold current status. */
struct zclient *zclient = NULL;
struct in_addr router_id_zebra;
/* Router-id update message from zebra. */
-static int eigrp_router_id_update_zebra(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
{
struct eigrp *eigrp;
struct prefix router_id;
return 0;
}
-static int eigrp_zebra_route_notify_owner(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_zebra_route_notify_owner(ZAPI_CALLBACK_ARGS)
{
struct prefix p;
enum zapi_route_notify_owner note;
/* Zebra route add and delete treatment. */
-static int eigrp_zebra_read_route(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS)
{
struct zapi_route api;
struct eigrp *eigrp;
if (eigrp == NULL)
return 0;
- if (command == ZEBRA_REDISTRIBUTE_ROUTE_ADD) {
+ if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_ADD) {
- } else /* if (command == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */
+ } else /* if (cmd == ZEBRA_REDISTRIBUTE_ROUTE_DEL) */
{
}
}
/* Inteface addition message from zebra. */
-static int eigrp_interface_add(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_interface_add(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
struct eigrp_interface *ei;
return 0;
}
-static int eigrp_interface_delete(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_interface_delete(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
struct stream *s;
return 0;
}
-static int eigrp_interface_address_add(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
- c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
+ c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (c == NULL)
return 0;
return 0;
}
-static int eigrp_interface_address_delete(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS)
{
struct connected *c;
struct interface *ifp;
struct eigrp_interface *ei;
- c = zebra_interface_address_read(command, zclient->ibuf, vrf_id);
+ c = zebra_interface_address_read(cmd, zclient->ibuf, vrf_id);
if (c == NULL)
return 0;
return 0;
/* Call interface hook functions to clean up */
- eigrp_if_free(ei, INTERFACE_DOWN_BY_ZEBRA);
+ if (prefix_cmp(&ei->address, c->address) == 0)
+ eigrp_if_free(ei, INTERFACE_DOWN_BY_ZEBRA);
connected_free(c);
return 0;
}
-static int eigrp_interface_state_up(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_interface_state_up(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
return 0;
}
-static int eigrp_interface_state_down(int command, struct zclient *zclient,
- zebra_size_t length, vrf_id_t vrf_id)
+static int eigrp_interface_state_down(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
}
-void eigrp_zebra_route_add(struct prefix *p, struct list *successors)
+void eigrp_zebra_route_add(struct prefix *p, struct list *successors,
+ uint32_t distance)
{
struct zapi_route api;
struct zapi_nexthop *api_nh;
api.vrf_id = VRF_DEFAULT;
api.type = ZEBRA_ROUTE_EIGRP;
api.safi = SAFI_UNICAST;
+ api.metric = distance;
memcpy(&api.prefix, p, sizeof(*p));
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
+ SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
/* Nexthop, ifindex, distance and metric information. */
for (ALL_LIST_ELEMENTS_RO(successors, node, te)) {