#include "checksum.h"
#include "md5.h"
#include "sha256.h"
+#include "lib_errors.h"
#include "eigrpd/eigrp_structs.h"
#include "eigrpd/eigrpd.h"
#include "eigrpd/eigrp_zebra.h"
#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_dump.h"
+#include "eigrpd/eigrp_macros.h"
#include "eigrpd/eigrp_network.h"
#include "eigrpd/eigrp_topology.h"
#include "eigrpd/eigrp_fsm.h"
#include "eigrpd/eigrp_memory.h"
+#include "eigrpd/eigrp_errors.h"
/* Packet Type String. */
const struct message eigrp_packet_type_str[] = {
}
int eigrp_make_md5_digest(struct eigrp_interface *ei, struct stream *s,
- u_char flags)
+ uint8_t flags)
{
struct key *key = NULL;
struct keychain *keychain;
unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN];
MD5_CTX ctx;
- u_char *ibuf;
+ uint8_t *ibuf;
size_t backup_get, backup_end;
struct TLV_MD5_Authentication_Type *auth_TLV;
int eigrp_check_md5_digest(struct stream *s,
struct TLV_MD5_Authentication_Type *authTLV,
- struct eigrp_neighbor *nbr, u_char flags)
+ struct eigrp_neighbor *nbr, uint8_t flags)
{
MD5_CTX ctx;
unsigned char digest[EIGRP_AUTH_TYPE_MD5_LEN];
unsigned char orig[EIGRP_AUTH_TYPE_MD5_LEN];
struct key *key = NULL;
struct keychain *keychain;
- u_char *ibuf;
+ uint8_t *ibuf;
size_t backup_end;
struct TLV_MD5_Authentication_Type *auth_TLV;
struct eigrp_header *eigrph;
}
int eigrp_make_sha256_digest(struct eigrp_interface *ei, struct stream *s,
- u_char flags)
+ uint8_t flags)
{
struct key *key = NULL;
struct keychain *keychain;
int eigrp_check_sha256_digest(struct stream *s,
struct TLV_SHA256_Authentication_Type *authTLV,
- struct eigrp_neighbor *nbr, u_char flags)
+ struct eigrp_neighbor *nbr, uint8_t flags)
{
return 1;
}
struct ip iph;
struct msghdr msg;
struct iovec iov[2];
- u_int32_t seqno, ack;
+ uint32_t seqno, ack;
int ret;
int flags = 0;
struct listnode *node;
#ifdef WANT_EIGRP_WRITE_FRAGMENT
- static u_int16_t ipid = 0;
+ static uint16_t ipid = 0;
#endif /* WANT_EIGRP_WRITE_FRAGMENT */
#define EIGRP_WRITE_IPHL_SHIFT 2
/* Get one packet from queue. */
ep = eigrp_fifo_next(ei->obuf);
if (!ep) {
- zlog_err("%s: Interface %s no packet on queue?",
+ flog_err(EC_LIB_DEVELOPMENT,
+ "%s: Interface %s no packet on queue?",
__PRETTY_FUNCTION__, ei->ifp->name);
goto out;
}
if (ep->length < EIGRP_HEADER_LEN) {
- zlog_err("%s: Packet just has a header?", __PRETTY_FUNCTION__);
+ flog_err(EC_EIGRP_PACKET, "%s: Packet just has a header?",
+ __PRETTY_FUNCTION__);
eigrp_header_dump((struct eigrp_header *)ep->s->data);
eigrp_packet_delete(ei);
goto out;
struct interface *ifp;
struct eigrp_neighbor *nbr;
- u_int16_t opcode = 0;
- u_int16_t length = 0;
+ uint16_t opcode = 0;
+ uint16_t length = 0;
/* first of all get interface pointer. */
eigrp = THREAD_ARG(thread);
// return -1;
/* If incoming interface is passive one, ignore it. */
- if (ei && eigrp_if_is_passive(ei)) {
+ if (eigrp_if_is_passive(ei)) {
char buf[3][INET_ADDRSTRLEN];
if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
{
int ret;
struct ip *iph;
- u_int16_t ip_len;
+ uint16_t ip_len;
unsigned int ifindex = 0;
struct iovec iov;
/* Header and data both require alignment. */
zlog_warn("stream_recvmsg failed: %s", safe_strerror(errno));
return NULL;
}
- if ((unsigned int)ret < sizeof(iph)) /* ret must be > 0 now */
+ if ((unsigned int)ret < sizeof(*iph)) /* ret must be > 0 now */
{
zlog_warn(
"eigrp_recv_packet: discarding runt packet of length %d "
"(ip header size is %u)",
- ret, (u_int)sizeof(iph));
+ ret, (unsigned int)sizeof(*iph));
return NULL;
}
/* Calculate EIGRP checksum */
void eigrp_packet_checksum(struct eigrp_interface *ei, struct stream *s,
- u_int16_t length)
+ uint16_t length)
{
struct eigrp_header *eigrph;
/* Make EIGRP header. */
void eigrp_packet_header_init(int type, struct eigrp *eigrp, struct stream *s,
- u_int32_t flags, u_int32_t sequence,
- u_int32_t ack)
+ uint32_t flags, uint32_t sequence, uint32_t ack)
{
struct eigrp_header *eigrph;
stream_reset(s);
eigrph = (struct eigrp_header *)STREAM_DATA(s);
- eigrph->version = (u_char)EIGRP_HEADER_VERSION;
- eigrph->opcode = (u_char)type;
+ eigrph->version = (uint8_t)EIGRP_HEADER_VERSION;
+ eigrph->opcode = (uint8_t)type;
eigrph->checksum = 0;
eigrph->vrid = htons(eigrp->vrid);
THREAD_OFF(ep->t_retrans_timer);
XFREE(MTYPE_EIGRP_PACKET, ep);
-
- ep = NULL;
}
/* EIGRP Header verification. */
{
struct eigrp_packet *new;
- new = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
+ new = eigrp_packet_new(EIGRP_PACKET_MTU(nbr->ei->ifp->mtu), nbr);
new->length = old->length;
new->retrans_counter = old->retrans_counter;
new->dst = old->dst;
return tlv;
}
-u_int16_t eigrp_add_internalTLV_to_stream(struct stream *s,
- struct eigrp_prefix_entry *pe)
+uint16_t eigrp_add_internalTLV_to_stream(struct stream *s,
+ struct eigrp_prefix_entry *pe)
{
- u_int16_t length;
+ uint16_t length;
stream_putw(s, EIGRP_TLV_IPv4_INT);
switch (pe->destination->prefixlen) {
stream_putw(s, length);
break;
default:
- zlog_err("%s: Unexpected prefix length: %d",
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Unexpected prefix length: %d",
__PRETTY_FUNCTION__, pe->destination->prefixlen);
return 0;
}
return length;
}
-u_int16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s,
- struct eigrp_interface *ei)
+uint16_t eigrp_add_authTLV_MD5_to_stream(struct stream *s,
+ struct eigrp_interface *ei)
{
struct key *key;
struct keychain *keychain;
return 0;
}
-u_int16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s,
- struct eigrp_interface *ei)
+uint16_t eigrp_add_authTLV_SHA256_to_stream(struct stream *s,
+ struct eigrp_interface *ei)
{
struct key *key;
struct keychain *keychain;