#include "eigrpd/eigrp_vty.h"
#include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_macros.h"
+#include "eigrpd/eigrp_errors.h"
/* Packet Type String. */
static const struct message eigrp_general_tlv_type_str[] = {
if (IS_DEBUG_EIGRP(0, TIMERS))
zlog_debug("Start Hello Timer (%s) Expire [%u]", IF_NAME(ei),
- EIGRP_IF_PARAM(ei, v_hello));
+ ei->params.v_hello);
/* Sending hello packet. */
eigrp_hello_send(ei, EIGRP_HELLO_NORMAL, NULL);
/* Hello timer set. */
ei->t_hello = NULL;
- thread_add_timer(master, eigrp_hello_timer, ei,
- EIGRP_IF_PARAM(ei, v_hello), &ei->t_hello);
+ thread_add_timer(master, eigrp_hello_timer, ei, ei->params.v_hello,
+ &ei->t_hello);
return 0;
}
* @param[in] nbr neighbor the ACK should be sent to
* @param[in] param pointer packet TLV is stored to
*
- * @return u_int16_t number of bytes added to packet stream
+ * @return uint16_t number of bytes added to packet stream
*
* @par
* Encode Parameter TLV, used to convey metric weights and the hold time.
return nbr;
}
-static u_char
+static uint8_t
eigrp_hello_authentication_decode(struct stream *s,
struct eigrp_tlv_hdr_type *tlv_header,
struct eigrp_neighbor *nbr)
* @param[in] nbr_addr pointer to neighbor address for Peer
* Termination TLV
*
- * @return u_int16_t number of bytes added to packet stream
+ * @return uint16_t number of bytes added to packet stream
*
* @par
* Function used to encode Peer Termination TLV to Hello packet.
*/
-static u_int16_t eigrp_peer_termination_encode(struct stream *s,
- struct in_addr *nbr_addr)
+static uint16_t eigrp_peer_termination_encode(struct stream *s,
+ struct in_addr *nbr_addr)
{
- u_int16_t length = EIGRP_TLV_PEER_TERMINATION_LEN;
+ uint16_t length = EIGRP_TLV_PEER_TERMINATION_LEN;
/* fill in type and length */
stream_putw(s, EIGRP_TLV_PEER_TERMINATION);
inet_ntoa(nbr->src));
}
-u_int32_t FRR_MAJOR;
-u_int32_t FRR_MINOR;
+uint32_t FRR_MAJOR;
+uint32_t FRR_MINOR;
void eigrp_sw_version_initialize(void)
{
if (dash)
dash[0] = '\0';
- ret = sscanf(ver_string, "%d.%d", &FRR_MAJOR, &FRR_MINOR);
+ ret = sscanf(ver_string, "%" SCNu32 ".%" SCNu32, &FRR_MAJOR,
+ &FRR_MINOR);
if (ret != 2)
- zlog_err("Did not Properly parse %s, please fix VERSION string",
+ flog_err(EC_EIGRP_PACKET,
+ "Did not Properly parse %s, please fix VERSION string",
VERSION);
}
*
* @param[in,out] s packet stream TLV is stored to
*
- * @return u_int16_t number of bytes added to packet stream
+ * @return uint16_t number of bytes added to packet stream
*
* @par
* Store the software version in the specified location.
* This consists of two bytes of OS version, and two bytes of EIGRP
* revision number.
*/
-static u_int16_t eigrp_sw_version_encode(struct stream *s)
+static uint16_t eigrp_sw_version_encode(struct stream *s)
{
- u_int16_t length = EIGRP_TLV_SW_VERSION_LEN;
+ uint16_t length = EIGRP_TLV_SW_VERSION_LEN;
// setup the tlv fields
stream_putw(s, EIGRP_TLV_SW_VERSION);
stream_putw(s, length);
- stream_putc(s, FRR_MAJOR); //!< major os version
+ stream_putc(s, FRR_MAJOR); //!< major os version
stream_putc(s, FRR_MINOR); //!< minor os version
/* and the core eigrp version */
* If doing mutli-topology, then store the supported TID list.
* This is currently a place holder function
*/
-static u_int16_t eigrp_tidlist_encode(struct stream *s)
+static uint16_t eigrp_tidlist_encode(struct stream *s)
{
- // u_int16_t length = EIGRP_TLV_SW_VERSION_LEN;
+ // uint16_t length = EIGRP_TLV_SW_VERSION_LEN;
return 0;
}
*
* @param[in,out] s packet stream TLV is stored to
*
- * @return u_int16_t number of bytes added to packet stream
+ * @return uint16_t number of bytes added to packet stream
*
* @par
* Part of conditional receive process
*
*/
-static u_int16_t eigrp_sequence_encode(struct stream *s)
+static uint16_t eigrp_sequence_encode(struct stream *s)
{
- u_int16_t length = EIGRP_TLV_SEQ_BASE_LEN;
+ uint16_t length = EIGRP_TLV_SEQ_BASE_LEN;
struct eigrp *eigrp;
struct eigrp_interface *ei;
struct listnode *node, *node2, *nnode2;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
if (nbr->multicast_queue->count > 0) {
- length += (u_int16_t)stream_put_ipv4(
+ length += (uint16_t)stream_put_ipv4(
s, nbr->src.s_addr);
found = 1;
}
*
* @param[in,out] s packet stream TLV is stored to
*
- * @return u_int16_t number of bytes added to packet stream
+ * @return uint16_t number of bytes added to packet stream
*
* @par
* Part of conditional receive process
*
*/
-static u_int16_t eigrp_next_sequence_encode(struct stream *s)
+static uint16_t eigrp_next_sequence_encode(struct stream *s)
{
- u_int16_t length = EIGRP_NEXT_SEQUENCE_TLV_SIZE;
+ uint16_t length = EIGRP_NEXT_SEQUENCE_TLV_SIZE;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
* @param[in] ei pointer to interface hello packet came in on
* @param[in,out] s packet stream TLV is stored to
*
- * @return u_int16_t number of bytes added to packet stream
+ * @return uint16_t number of bytes added to packet stream
*
* @par
* Encode Parameter TLV, used to convey metric weights and the hold time.
* Note the addition of K6 for the new extended metrics, and does not apply to
* older TLV packet formats.
*/
-static u_int16_t eigrp_hello_parameter_encode(struct eigrp_interface *ei,
- struct stream *s, u_char flags)
+static uint16_t eigrp_hello_parameter_encode(struct eigrp_interface *ei,
+ struct stream *s, uint8_t flags)
{
- u_int16_t length = EIGRP_TLV_PARAMETER_LEN;
+ uint16_t length = EIGRP_TLV_PARAMETER_LEN;
// add in the parameters TLV
stream_putw(s, EIGRP_TLV_PARAMETER);
}
// and set hold time value..
- stream_putw(s, IF_DEF_PARAMS(ei->ifp)->v_wait);
+ stream_putw(s, ei->params.v_wait);
return length;
}
*
*/
static struct eigrp_packet *eigrp_hello_encode(struct eigrp_interface *ei,
- in_addr_t addr, u_int32_t ack,
- u_char flags,
+ in_addr_t addr, uint32_t ack,
+ uint8_t flags,
struct in_addr *nbr_addr)
{
struct eigrp_packet *ep;
- u_int16_t length = EIGRP_HEADER_LEN;
+ uint16_t length = EIGRP_HEADER_LEN;
// allocate a new packet to be sent
- ep = eigrp_packet_new(ei->ifp->mtu, NULL);
+ ep = eigrp_packet_new(EIGRP_PACKET_MTU(ei->ifp->mtu), NULL);
if (ep) {
// encode common header feilds
- eigrp_packet_header_init(EIGRP_OPC_HELLO, ei->eigrp, ep->s, 0, 0, ack);
+ eigrp_packet_header_init(EIGRP_OPC_HELLO, ei->eigrp, ep->s, 0,
+ 0, ack);
// encode Authentication TLV
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_MD5_to_stream(ep->s, ei);
- } else if ((IF_DEF_PARAMS(ei->ifp)->auth_type
- == EIGRP_AUTH_TYPE_SHA256)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ } else if ((ei->params.auth_type == EIGRP_AUTH_TYPE_SHA256)
+ && (ei->params.auth_keychain != NULL)) {
length += eigrp_add_authTLV_SHA256_to_stream(ep->s, ei);
}
// set soruce address for the hello packet
ep->dst.s_addr = addr;
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type == EIGRP_AUTH_TYPE_MD5)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ if ((ei->params.auth_type == EIGRP_AUTH_TYPE_MD5)
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_md5_digest(ei, ep->s,
EIGRP_AUTH_BASIC_HELLO_FLAG);
- } else if ((IF_DEF_PARAMS(ei->ifp)->auth_type
- == EIGRP_AUTH_TYPE_SHA256)
- && (IF_DEF_PARAMS(ei->ifp)->auth_keychain != NULL)) {
+ } else if ((ei->params.auth_type == EIGRP_AUTH_TYPE_SHA256)
+ && (ei->params.auth_keychain != NULL)) {
eigrp_make_sha256_digest(ei, ep->s,
EIGRP_AUTH_BASIC_HELLO_FLAG);
}
* sending. If no packets are currently queues, the packet will be
* sent immadiatly
*/
-void eigrp_hello_send(struct eigrp_interface *ei, u_char flags,
+void eigrp_hello_send(struct eigrp_interface *ei, uint8_t flags,
struct in_addr *nbr_addr)
{
struct eigrp_packet *ep = NULL;