version 1.1.1.1, 2012/02/21 17:26:11
|
version 1.1.1.2, 2012/10/09 09:22:28
|
Line 36
|
Line 36
|
#include "isisd/dict.h" |
#include "isisd/dict.h" |
#include "isisd/isis_constants.h" |
#include "isisd/isis_constants.h" |
#include "isisd/isis_common.h" |
#include "isisd/isis_common.h" |
|
#include "isisd/isis_flags.h" |
|
#include "isisd/isis_misc.h" |
|
#include "isisd/isis_circuit.h" |
|
#include "isisd/isis_tlv.h" |
#include "isisd/isisd.h" |
#include "isisd/isisd.h" |
#include "isisd/isis_circuit.h" |
#include "isisd/isis_circuit.h" |
#include "isisd/isis_csm.h" |
#include "isisd/isis_csm.h" |
|
#include "isisd/isis_lsp.h" |
#include "isisd/isis_route.h" |
#include "isisd/isis_route.h" |
#include "isisd/isis_zebra.h" |
#include "isisd/isis_zebra.h" |
|
|
struct zclient *zclient = NULL; |
struct zclient *zclient = NULL; |
|
|
extern struct thread_master *master; |
|
extern struct isis *isis; |
|
|
|
struct in_addr router_id_zebra; |
|
|
|
/* Router-id update message from zebra. */ |
/* Router-id update message from zebra. */ |
static int |
static int |
isis_router_id_update_zebra (int command, struct zclient *zclient, |
isis_router_id_update_zebra (int command, struct zclient *zclient, |
zebra_size_t length) |
zebra_size_t length) |
{ |
{ |
|
struct isis_area *area; |
|
struct listnode *node; |
struct prefix router_id; |
struct prefix router_id; |
|
|
zebra_router_id_update_read (zclient->ibuf,&router_id); | zebra_router_id_update_read (zclient->ibuf, &router_id); |
router_id_zebra = router_id.u.prefix4; | if (isis->router_id == router_id.u.prefix4.s_addr) |
| return 0; |
|
|
/* FIXME: Do we react somehow? */ | 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; |
return 0; |
} |
} |
|
|
Line 100 isis_zebra_if_del (int command, struct zclient *zclien
|
Line 107 isis_zebra_if_del (int command, struct zclient *zclien
|
zlog_debug ("Zebra I/F delete: %s index %d flags %ld metric %d mtu %d", |
zlog_debug ("Zebra I/F delete: %s index %d flags %ld metric %d mtu %d", |
ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric, ifp->mtu); |
ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric, ifp->mtu); |
|
|
|
isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp), ifp); |
|
|
/* Cannot call if_delete because we should retain the pseudo interface |
/* Cannot call if_delete because we should retain the pseudo interface |
in case there is configuration info attached to it. */ |
in case there is configuration info attached to it. */ |
if_delete_retain(ifp); |
if_delete_retain(ifp); |
|
|
isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp), ifp); |
|
|
|
ifp->ifindex = IFINDEX_INTERNAL; |
ifp->ifindex = IFINDEX_INTERNAL; |
|
|
return 0; |
return 0; |
} |
} |
|
|
static struct interface * |
|
zebra_interface_if_lookup (struct stream *s) |
|
{ |
|
char ifname_tmp[INTERFACE_NAMSIZ]; |
|
|
|
/* Read interface name. */ |
|
stream_get (ifname_tmp, s, INTERFACE_NAMSIZ); |
|
|
|
/* And look it up. */ |
|
return if_lookup_by_name_len(ifname_tmp, |
|
strnlen(ifname_tmp, INTERFACE_NAMSIZ)); |
|
} |
|
|
|
static int |
static int |
isis_zebra_if_state_up (int command, struct zclient *zclient, |
isis_zebra_if_state_up (int command, struct zclient *zclient, |
zebra_size_t length) |
zebra_size_t length) |
{ |
{ |
struct interface *ifp; |
struct interface *ifp; |
|
|
ifp = zebra_interface_if_lookup (zclient->ibuf); | ifp = zebra_interface_state_read (zclient->ibuf); |
|
|
if (!ifp) | if (ifp == NULL) |
return 0; |
return 0; |
|
|
if (if_is_operative (ifp)) |
|
{ |
|
zebra_interface_if_set_value (zclient->ibuf, ifp); |
|
/* HT: This is wrong actually. We can't assume that circuit exist |
|
* if we delete circuit during if_state_down event. Needs rethink. |
|
* TODO */ |
|
isis_circuit_update_params (circuit_scan_by_ifp (ifp), ifp); |
|
return 0; |
|
} |
|
|
|
zebra_interface_if_set_value (zclient->ibuf, ifp); |
|
isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp); |
isis_csm_state_change (IF_UP_FROM_Z, circuit_scan_by_ifp (ifp), ifp); |
|
|
return 0; |
return 0; |
Line 157 isis_zebra_if_state_down (int command, struct zclient
|
Line 139 isis_zebra_if_state_down (int command, struct zclient
|
zebra_size_t length) |
zebra_size_t length) |
{ |
{ |
struct interface *ifp; |
struct interface *ifp; |
|
struct isis_circuit *circuit; |
|
|
ifp = zebra_interface_if_lookup (zclient->ibuf); | ifp = zebra_interface_state_read (zclient->ibuf); |
|
|
if (ifp == NULL) |
if (ifp == NULL) |
return 0; |
return 0; |
|
|
if (if_is_operative (ifp)) | circuit = isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp), |
{ | ifp); |
zebra_interface_if_set_value (zclient->ibuf, ifp); | if (circuit) |
isis_csm_state_change (IF_DOWN_FROM_Z, circuit_scan_by_ifp (ifp), ifp); | SET_FLAG(circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF); |
} | |
|
|
return 0; |
return 0; |
} |
} |
Line 251 isis_zebra_route_add_ipv4 (struct prefix *prefix,
|
Line 233 isis_zebra_route_add_ipv4 (struct prefix *prefix,
|
struct isis_nexthop *nexthop; |
struct isis_nexthop *nexthop; |
struct listnode *node; |
struct listnode *node; |
|
|
if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC)) | if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) |
return; |
return; |
|
|
if (zclient->redist[ZEBRA_ROUTE_ISIS]) |
if (zclient->redist[ZEBRA_ROUTE_ISIS]) |
Line 274 isis_zebra_route_add_ipv4 (struct prefix *prefix,
|
Line 256 isis_zebra_route_add_ipv4 (struct prefix *prefix,
|
stream_putc (stream, flags); |
stream_putc (stream, flags); |
/* message */ |
/* message */ |
stream_putc (stream, message); |
stream_putc (stream, message); |
|
/* SAFI */ |
|
stream_putw (stream, SAFI_UNICAST); |
/* prefix information */ |
/* prefix information */ |
psize = PSIZE (prefix->prefixlen); |
psize = PSIZE (prefix->prefixlen); |
stream_putc (stream, prefix->prefixlen); |
stream_putc (stream, prefix->prefixlen); |
Line 305 isis_zebra_route_add_ipv4 (struct prefix *prefix,
|
Line 289 isis_zebra_route_add_ipv4 (struct prefix *prefix,
|
|
|
stream_putw_at (stream, 0, stream_get_endp (stream)); |
stream_putw_at (stream, 0, stream_get_endp (stream)); |
zclient_send_message(zclient); |
zclient_send_message(zclient); |
SET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC); | SET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); |
| UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC); |
} |
} |
} |
} |
|
|
Line 321 isis_zebra_route_del_ipv4 (struct prefix *prefix,
|
Line 306 isis_zebra_route_del_ipv4 (struct prefix *prefix,
|
api.type = ZEBRA_ROUTE_ISIS; |
api.type = ZEBRA_ROUTE_ISIS; |
api.flags = 0; |
api.flags = 0; |
api.message = 0; |
api.message = 0; |
|
api.safi = SAFI_UNICAST; |
prefix4.family = AF_INET; |
prefix4.family = AF_INET; |
prefix4.prefixlen = prefix->prefixlen; |
prefix4.prefixlen = prefix->prefixlen; |
prefix4.prefix = prefix->u.prefix4; |
prefix4.prefix = prefix->u.prefix4; |
zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient, &prefix4, &api); |
zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient, &prefix4, &api); |
} |
} |
UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC); | UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); |
|
|
return; |
return; |
} |
} |
Line 344 isis_zebra_route_add_ipv6 (struct prefix *prefix,
|
Line 330 isis_zebra_route_add_ipv6 (struct prefix *prefix,
|
struct listnode *node; |
struct listnode *node; |
struct prefix_ipv6 prefix6; |
struct prefix_ipv6 prefix6; |
|
|
if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC)) | if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) |
return; |
return; |
|
|
api.type = ZEBRA_ROUTE_ISIS; |
api.type = ZEBRA_ROUTE_ISIS; |
api.flags = 0; |
api.flags = 0; |
api.message = 0; |
api.message = 0; |
|
api.safi = SAFI_UNICAST; |
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP); |
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP); |
SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX); |
SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX); |
SET_FLAG (api.message, ZAPI_MESSAGE_METRIC); |
SET_FLAG (api.message, ZAPI_MESSAGE_METRIC); |
Line 406 isis_zebra_route_add_ipv6 (struct prefix *prefix,
|
Line 393 isis_zebra_route_add_ipv6 (struct prefix *prefix,
|
prefix6.prefixlen = prefix->prefixlen; |
prefix6.prefixlen = prefix->prefixlen; |
memcpy (&prefix6.prefix, &prefix->u.prefix6, sizeof (struct in6_addr)); |
memcpy (&prefix6.prefix, &prefix->u.prefix6, sizeof (struct in6_addr)); |
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, &prefix6, &api); |
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient, &prefix6, &api); |
SET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC); | SET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); |
| UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC); |
} |
} |
|
|
XFREE (MTYPE_ISIS_TMP, nexthop_list); |
XFREE (MTYPE_ISIS_TMP, nexthop_list); |
Line 427 isis_zebra_route_del_ipv6 (struct prefix *prefix,
|
Line 415 isis_zebra_route_del_ipv6 (struct prefix *prefix,
|
struct listnode *node; |
struct listnode *node; |
struct prefix_ipv6 prefix6; |
struct prefix_ipv6 prefix6; |
|
|
if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC)) | if (CHECK_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) |
return; |
return; |
|
|
api.type = ZEBRA_ROUTE_ISIS; |
api.type = ZEBRA_ROUTE_ISIS; |
api.flags = 0; |
api.flags = 0; |
api.message = 0; |
api.message = 0; |
|
api.safi = SAFI_UNICAST; |
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP); |
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP); |
SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX); |
SET_FLAG (api.message, ZAPI_MESSAGE_IFINDEX); |
api.nexthop_num = listcount (route_info->nexthops6); |
api.nexthop_num = listcount (route_info->nexthops6); |
Line 483 isis_zebra_route_del_ipv6 (struct prefix *prefix,
|
Line 472 isis_zebra_route_del_ipv6 (struct prefix *prefix,
|
prefix6.prefixlen = prefix->prefixlen; |
prefix6.prefixlen = prefix->prefixlen; |
memcpy (&prefix6.prefix, &prefix->u.prefix6, sizeof (struct in6_addr)); |
memcpy (&prefix6.prefix, &prefix->u.prefix6, sizeof (struct in6_addr)); |
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, &prefix6, &api); |
zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient, &prefix6, &api); |
UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC); | UNSET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); |
} |
} |
|
|
XFREE (MTYPE_ISIS_TMP, nexthop_list); |
XFREE (MTYPE_ISIS_TMP, nexthop_list); |