vty_out(vty, "%s, ",
prefix2str(tn->destination, buffer, PREFIX_STRLEN));
- vty_out(vty, "%u successors, ", successors->count);
+ vty_out(vty, "%u successors, ",
+ (successors) ? successors->count : 0);
vty_out(vty, "FD is %u, serno: %" PRIu64 " \n", tn->fdistance,
tn->serno);
- list_delete(successors);
+ if (successors)
+ list_delete(successors);
}
void show_ip_eigrp_neighbor_entry(struct vty *vty, struct eigrp *eigrp,
{
char ver_string[] = VERSION;
char *dash = strstr(ver_string, "-");
+ int ret;
if (dash)
dash[0] = '\0';
- sscanf(ver_string, "%d.%d", &FRR_MAJOR, &FRR_MINOR);
+ ret = sscanf(ver_string, "%d.%d", &FRR_MAJOR, &FRR_MINOR);
+ if (ret != 2)
+ zlog_err("Did not Properly parse %s, please fix VERSION string",
+ VERSION);
}
/**
struct eigrp_metrics metric;
struct eigrp_interface *ei2;
struct listnode *node, *nnode;
- struct eigrp *eigrp = eigrp_lookup();
+ struct eigrp *eigrp;
if (ei == NULL)
return 0;
- if (eigrp != NULL)
- eigrp_adjust_sndbuflen(eigrp, ei->ifp->mtu);
- else
- zlog_warn("%s: eigrp_lookup () returned NULL", __func__);
+ eigrp = ei->eigrp;
+ eigrp_adjust_sndbuflen(eigrp, ei->ifp->mtu);
+
eigrp_if_stream_set(ei);
/* Set multicast memberships appropriately for new state. */
if (keychain)
key = key_lookup_for_send(keychain);
+ if (!key) {
+ zlog_warn("Interface %s: Expected key value not found in config",
+ nbr->ei->ifp->name);
+ return 0;
+ }
+
memset(&ctx, 0, sizeof(ctx));
MD5Init(&ctx);
}
/* save neighbor's crypt_seqnum */
- if (nbr)
- nbr->crypt_seqnum = authTLV->key_sequence;
+ nbr->crypt_seqnum = authTLV->key_sequence;
return 1;
}
{
struct key *key = NULL;
struct keychain *keychain;
- char *source_ip;
+ char source_ip[PREFIX_STRLEN];
unsigned char digest[EIGRP_AUTH_TYPE_SHA256_LEN];
unsigned char buffer[1 + PLAINTEXT_LENGTH + 45 + 1] = {0};
+
HMAC_SHA256_CTX ctx;
void *ibuf;
size_t backup_get, backup_end;
if (keychain)
key = key_lookup_for_send(keychain);
- // saved_len[index] = strnzcpyn(saved_key[index], key,
- // PLAINTEXT_LENGTH + 1);
+ if (!key) {
+ zlog_warn("Interface %s: Expected key value not found in config",
+ ei->ifp->name);
+ return 0;
+ }
- source_ip = calloc(16, sizeof(char));
- inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, 16);
+ inet_ntop(AF_INET, &ei->address->u.prefix4, source_ip, PREFIX_STRLEN);
memset(&ctx, 0, sizeof(ctx));
buffer[0] = '\n';
stream_set_endp(s, backup_end);
eigrp_authTLV_SHA256_free(auth_TLV);
- free(source_ip);
return EIGRP_AUTH_TYPE_SHA256_LEN;
}
opcode = eigrph->opcode;
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) {
- char src[100], dst[100];
+ char src[PREFIX_STRLEN], dst[PREFIX_STRLEN];
- strcpy(src, inet_ntoa(iph->ip_src));
- strcpy(dst, inet_ntoa(iph->ip_dst));
+ strncpy(src, inet_ntoa(iph->ip_src), PREFIX_STRLEN);
+ strncpy(dst, inet_ntoa(iph->ip_dst), PREFIX_STRLEN);
zlog_debug("Received [%s][%d/%d] length [%u] via [%s] src [%s] dst [%s]",
lookup_msg(eigrp_packet_type_str, opcode, NULL),
ntohl(eigrph->sequence), ntohl(eigrph->ack), length,