*/
#include <zebra.h>
-#include "zebra/rib.h"
#include "log.h"
#include "prefix.h"
#include "thread.h"
#include "prefix.h"
#include "vty.h"
+#include "lib_errors.h"
#include "pimd.h"
#include "pim_iface.h"
{
zlookup = zclient_new_notify(master, &zclient_options_default);
if (!zlookup) {
- zlog_err("%s: zclient_new() failure", __PRETTY_FUNCTION__);
+ flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_new() failure",
+ __PRETTY_FUNCTION__);
return;
}
err = zclient_read_header(s, zlookup->sock, &length, &marker,
&version, &vrf_id, &command);
if (err < 0) {
- zlog_err("%s: zclient_read_header() failed",
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
+ "%s: zclient_read_header() failed",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -1;
tab_size, addr_str, pim->vrf->name);
return num_ifindex;
}
+ nexthop_tab[num_ifindex].protocol_distance = distance;
+ nexthop_tab[num_ifindex].route_metric = metric;
switch (nexthop_type) {
case NEXTHOP_TYPE_IFINDEX:
+ nexthop_tab[num_ifindex].ifindex = stream_getl(s);
+ /*
+ * Connected route (i.e. no nexthop), use
+ * address passed in as PIM nexthop. This will
+ * allow us to work in cases where we are
+ * trying to find a route for this box.
+ */
+ nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET;
+ nexthop_tab[num_ifindex].nexthop_addr.prefixlen =
+ IPV4_MAX_BITLEN;
+ nexthop_tab[num_ifindex].nexthop_addr.u.prefix4 =
+ addr;
+ ++num_ifindex;
+ break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
case NEXTHOP_TYPE_IPV4:
nexthop_tab[num_ifindex].nexthop_addr.family = AF_INET;
- if (nexthop_type == NEXTHOP_TYPE_IPV4_IFINDEX
- || nexthop_type == NEXTHOP_TYPE_IPV4) {
- nexthop_tab[num_ifindex]
- .nexthop_addr.u.prefix4.s_addr =
- stream_get_ipv4(s);
- } else {
- nexthop_tab[num_ifindex]
- .nexthop_addr.u.prefix4.s_addr =
- PIM_NET_INADDR_ANY;
- }
+ nexthop_tab[num_ifindex].nexthop_addr.u.prefix4.s_addr =
+ stream_get_ipv4(s);
nexthop_tab[num_ifindex].ifindex = stream_getl(s);
- nexthop_tab[num_ifindex].protocol_distance = distance;
- nexthop_tab[num_ifindex].route_metric = metric;
++num_ifindex;
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
/* Check socket. */
if (zlookup->sock < 0) {
- zlog_err("%s: zclient lookup socket is not connected",
+ flog_err(EC_LIB_ZAPI_SOCKET,
+ "%s: zclient lookup socket is not connected",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -1;
}
if (pim->vrf->vrf_id == VRF_UNKNOWN) {
- zlog_err(
+ zlog_notice(
"%s: VRF: %s does not fully exist yet, delaying lookup",
__PRETTY_FUNCTION__, pim->vrf->name);
return -1;
ret = writen(zlookup->sock, s->data, stream_get_endp(s));
if (ret < 0) {
- zlog_err(
+ flog_err(
+ EC_LIB_SOCKET,
"%s: writen() failure: %d writing to zclient lookup socket",
__PRETTY_FUNCTION__, errno);
zclient_lookup_failed(zlookup);
return -2;
}
if (ret == 0) {
- zlog_err("%s: connection closed on zclient lookup socket",
- __PRETTY_FUNCTION__);
+ flog_err_sys(EC_LIB_SOCKET,
+ "%s: connection closed on zclient lookup socket",
+ __PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -3;
}
uint32_t route_metric = 0xFFFFFFFF;
uint8_t protocol_distance = 0xFF;
- qpim_nexthop_lookups++;
+ pim->nexthop_lookups++;
for (lookup = 0; lookup < max_lookup; ++lookup) {
int num_ifindex;
count = stream_get_endp(s);
ret = writen(zlookup->sock, s->data, count);
if (ret <= 0) {
- zlog_err(
+ flog_err(
+ EC_LIB_SOCKET,
"%s: writen() failure: %d writing to zclient lookup socket",
__PRETTY_FUNCTION__, errno);
return -1;
err = zclient_read_header(s, zlookup->sock, &length, &marker,
&version, &vrf_id, &command);
if (err < 0) {
- zlog_err("%s: zclient_read_header() failed",
+ flog_err(EC_LIB_ZAPI_MISSMATCH,
+ "%s: zclient_read_header() failed",
__PRETTY_FUNCTION__);
zclient_lookup_failed(zlookup);
return -1;
more.src = c_oil->oil.mfcc_origin;
more.grp = c_oil->oil.mfcc_mcastgrp;
- zlog_err(
+ flog_err(
+ EC_LIB_ZAPI_MISSMATCH,
"%s: Received wrong %s(%s) information requested",
__PRETTY_FUNCTION__, pim_str_sg_dump(&more),
c_oil->pim->vrf->name);