diff options
Diffstat (limited to 'eigrpd')
| -rw-r--r-- | eigrpd/eigrp_dump.c | 19 | ||||
| -rw-r--r-- | eigrpd/eigrp_dump.h | 15 | ||||
| -rw-r--r-- | eigrpd/eigrp_filter.c | 16 | ||||
| -rw-r--r-- | eigrpd/eigrp_fsm.c | 4 | ||||
| -rw-r--r-- | eigrpd/eigrp_hello.c | 36 | ||||
| -rw-r--r-- | eigrpd/eigrp_interface.c | 4 | ||||
| -rw-r--r-- | eigrpd/eigrp_neighbor.c | 14 | ||||
| -rw-r--r-- | eigrpd/eigrp_network.c | 23 | ||||
| -rw-r--r-- | eigrpd/eigrp_northbound.c | 39 | ||||
| -rw-r--r-- | eigrpd/eigrp_packet.c | 44 | ||||
| -rw-r--r-- | eigrpd/eigrp_reply.c | 7 | ||||
| -rw-r--r-- | eigrpd/eigrp_topology.c | 10 | ||||
| -rw-r--r-- | eigrpd/eigrp_update.c | 66 | ||||
| -rw-r--r-- | eigrpd/eigrp_vty.c | 21 | ||||
| -rw-r--r-- | eigrpd/eigrp_zebra.c | 32 | ||||
| -rw-r--r-- | eigrpd/eigrpd.c | 4 |
16 files changed, 156 insertions, 198 deletions
diff --git a/eigrpd/eigrp_dump.c b/eigrpd/eigrp_dump.c index 97de73116b..dfce2acad4 100644 --- a/eigrpd/eigrp_dump.c +++ b/eigrpd/eigrp_dump.c @@ -122,8 +122,8 @@ void eigrp_ip_header_dump(struct ip *iph) zlog_debug("ip_ttl %u", iph->ip_ttl); zlog_debug("ip_p %u", iph->ip_p); zlog_debug("ip_sum 0x%x", (uint32_t)iph->ip_sum); - zlog_debug("ip_src %s", inet_ntoa(iph->ip_src)); - zlog_debug("ip_dst %s", inet_ntoa(iph->ip_dst)); + zlog_debug("ip_src %pI4", &iph->ip_src); + zlog_debug("ip_dst %pI4", &iph->ip_dst); } /* @@ -204,8 +204,7 @@ void show_ip_eigrp_neighbor_sub(struct vty *vty, struct eigrp_neighbor *nbr, int detail) { - vty_out(vty, "%-3u %-17s %-21s", 0, eigrp_neigh_ip_string(nbr), - IF_NAME(nbr->ei)); + vty_out(vty, "%-3u %-17pI4 %-21s", 0, &nbr->src, IF_NAME(nbr->ei)); if (nbr->t_holddown) vty_out(vty, "%-7lu", thread_timer_remain_second(nbr->t_holddown)); @@ -231,8 +230,8 @@ void show_ip_eigrp_neighbor_sub(struct vty *vty, struct eigrp_neighbor *nbr, */ void show_ip_eigrp_topology_header(struct vty *vty, struct eigrp *eigrp) { - vty_out(vty, "\nEIGRP Topology Table for AS(%d)/ID(%s)\n\n", eigrp->AS, - inet_ntoa(eigrp->router_id)); + vty_out(vty, "\nEIGRP Topology Table for AS(%d)/ID(%pI4)\n\n", + eigrp->AS, &eigrp->router_id); vty_out(vty, "Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply\n r - reply Status, s - sia Status\n\n"); } @@ -240,12 +239,10 @@ void show_ip_eigrp_topology_header(struct vty *vty, struct eigrp *eigrp) void show_ip_eigrp_prefix_entry(struct vty *vty, struct eigrp_prefix_entry *tn) { struct list *successors = eigrp_topology_get_successor(tn); - char buffer[PREFIX_STRLEN]; vty_out(vty, "%-3c", (tn->state > 0) ? 'A' : 'P'); - vty_out(vty, "%s, ", - prefix2str(tn->destination, buffer, PREFIX_STRLEN)); + vty_out(vty, "%pFX, ", tn->destination); vty_out(vty, "%u successors, ", (successors) ? successors->count : 0); vty_out(vty, "FD is %u, serno: %" PRIu64 " \n", tn->fdistance, tn->serno); @@ -269,8 +266,8 @@ void show_ip_eigrp_nexthop_entry(struct vty *vty, struct eigrp *eigrp, vty_out(vty, "%-7s%s, %s\n", " ", "via Connected", IF_NAME(te->ei)); else { - vty_out(vty, "%-7s%s%s (%u/%u), %s\n", " ", "via ", - inet_ntoa(te->adv_router->src), te->distance, + vty_out(vty, "%-7s%s%pI4 (%u/%u), %s\n", " ", "via ", + &te->adv_router->src, te->distance, te->reported_distance, IF_NAME(te->ei)); } } diff --git a/eigrpd/eigrp_dump.h b/eigrpd/eigrp_dump.h index f141f3cbc6..348356bb3c 100644 --- a/eigrpd/eigrp_dump.h +++ b/eigrpd/eigrp_dump.h @@ -138,21 +138,6 @@ extern unsigned long term_debug_eigrp_zebra; /* Prototypes. */ extern const char *eigrp_if_name_string(struct eigrp_interface *); -static inline const char -*eigrp_topology_ip_string(struct eigrp_prefix_entry *tn) -{ - return inet_ntoa(tn->destination->u.prefix4); -} - -static inline const char *eigrp_if_ip_string(struct eigrp_interface *ei) -{ - return ei ? inet_ntoa(ei->address.u.prefix4) : "inactive"; -} - -static inline const char *eigrp_neigh_ip_string(struct eigrp_neighbor *nbr) -{ - return inet_ntoa(nbr->src); -} extern void eigrp_ip_header_dump(struct ip *); extern void eigrp_header_dump(struct eigrp_header *); diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c index 9d5d45ca50..009b57e05f 100644 --- a/eigrpd/eigrp_filter.c +++ b/eigrpd/eigrp_filter.c @@ -159,13 +159,10 @@ void eigrp_distribute_update(struct distribute_ctx *ctx, #endif // TODO: check Graceful restart after 10sec - /* check if there is already GR scheduled */ - if (e->t_distribute != NULL) { - /* if is, cancel schedule */ - thread_cancel(e->t_distribute); - } + /* cancel GR scheduled */ + thread_cancel(&(e->t_distribute)); + /* schedule Graceful restart for whole process in 10sec */ - e->t_distribute = NULL; thread_add_timer(master, eigrp_distribute_timer_process, e, (10), &e->t_distribute); @@ -267,11 +264,8 @@ void eigrp_distribute_update(struct distribute_ctx *ctx, #endif // TODO: check Graceful restart after 10sec - /* check if there is already GR scheduled */ - if (ei->t_distribute != NULL) { - /* if is, cancel schedule */ - thread_cancel(ei->t_distribute); - } + /* Cancel GR scheduled */ + thread_cancel(&(ei->t_distribute)); /* schedule Graceful restart for interface in 10sec */ e->t_distribute = NULL; thread_add_timer(master, eigrp_distribute_timer_interface, ei, 10, diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c index e43eca0e0d..a69a3eec0a 100644 --- a/eigrpd/eigrp_fsm.c +++ b/eigrpd/eigrp_fsm.c @@ -417,9 +417,9 @@ int eigrp_fsm_event(struct eigrp_fsm_action_message *msg) enum eigrp_fsm_events event = eigrp_get_fsm_event(msg); zlog_info( - "EIGRP AS: %d State: %s Event: %s Network: %s Packet Type: %s Reply RIJ Count: %d change: %s", + "EIGRP AS: %d State: %s Event: %s Network: %pI4 Packet Type: %s Reply RIJ Count: %d change: %s", msg->eigrp->AS, prefix_state2str(msg->prefix->state), - fsm_state2str(event), eigrp_topology_ip_string(msg->prefix), + fsm_state2str(event), &msg->prefix->destination->u.prefix4, packet_type2str(msg->packet_type), msg->prefix->rij->count, change2str(msg->change)); (*(NSM[msg->prefix->state][event].func))(msg); diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c index 6f93cd7b3e..f512833e0a 100644 --- a/eigrpd/eigrp_hello.c +++ b/eigrpd/eigrp_hello.c @@ -144,10 +144,11 @@ eigrp_hello_parameter_decode(struct eigrp_neighbor *nbr, && (eigrp->k_values[4] == nbr->K5)) { if (eigrp_nbr_state_get(nbr) == EIGRP_NEIGHBOR_DOWN) { - zlog_info("Neighbor %s (%s) is pending: new adjacency", - inet_ntoa(nbr->src), - ifindex2ifname(nbr->ei->ifp->ifindex, - eigrp->vrf_id)); + zlog_info( + "Neighbor %pI4 (%s) is pending: new adjacency", + &nbr->src, + ifindex2ifname(nbr->ei->ifp->ifindex, + eigrp->vrf_id)); /* Expedited hello sent */ eigrp_hello_send(nbr->ei, EIGRP_HELLO_NORMAL, NULL); @@ -164,16 +165,16 @@ eigrp_hello_parameter_decode(struct eigrp_neighbor *nbr, & param->K5) == 255) { zlog_info( - "Neighbor %s (%s) is down: Interface PEER-TERMINATION received", - inet_ntoa(nbr->src), + "Neighbor %pI4 (%s) is down: Interface PEER-TERMINATION received", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); eigrp_nbr_delete(nbr); return NULL; } else { zlog_info( - "Neighbor %s (%s) going down: Kvalue mismatch", - inet_ntoa(nbr->src), + "Neighbor %pI4 (%s) going down: Kvalue mismatch", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN); @@ -253,9 +254,10 @@ static void eigrp_peer_termination_decode(struct eigrp_neighbor *nbr, uint32_t received_ip = param->neighbor_ip; if (my_ip == received_ip) { - zlog_info("Neighbor %s (%s) is down: Peer Termination received", - inet_ntoa(nbr->src), - ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); + zlog_info( + "Neighbor %pI4 (%s) is down: Peer Termination received", + &nbr->src, + ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); /* set neighbor to DOWN */ nbr->state = EIGRP_NEIGHBOR_DOWN; /* delete neighbor */ @@ -330,9 +332,9 @@ void eigrp_hello_receive(struct eigrp *eigrp, struct ip *iph, assert(nbr); if (IS_DEBUG_EIGRP_PACKET(eigrph->opcode - 1, RECV)) - zlog_debug("Processing Hello size[%u] int(%s) nbr(%s)", size, + zlog_debug("Processing Hello size[%u] int(%s) nbr(%pI4)", size, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id), - inet_ntoa(nbr->src)); + &nbr->src); size -= EIGRP_HEADER_LEN; if (size < 0) @@ -403,8 +405,7 @@ void eigrp_hello_receive(struct eigrp *eigrp, struct ip *iph, } if (IS_DEBUG_EIGRP_PACKET(0, RECV)) - zlog_debug("Hello Packet received from %s", - inet_ntoa(nbr->src)); + zlog_debug("Hello Packet received from %pI4", &nbr->src); } uint32_t FRR_MAJOR; @@ -708,9 +709,8 @@ void eigrp_hello_send_ack(struct eigrp_neighbor *nbr) if (ep) { if (IS_DEBUG_EIGRP_PACKET(0, SEND)) - zlog_debug("Queueing [Hello] Ack Seq [%u] nbr [%s]", - nbr->recv_sequence_number, - inet_ntoa(nbr->src)); + zlog_debug("Queueing [Hello] Ack Seq [%u] nbr [%pI4]", + nbr->recv_sequence_number, &nbr->src); /* Add packet to the top of the interface output queue*/ eigrp_fifo_push(nbr->ei->obuf, ep); diff --git a/eigrpd/eigrp_interface.c b/eigrpd/eigrp_interface.c index 2f3f347423..dd43dd0478 100644 --- a/eigrpd/eigrp_interface.c +++ b/eigrpd/eigrp_interface.c @@ -358,7 +358,7 @@ void eigrp_if_stream_unset(struct eigrp_interface *ei) if (ei->on_write_q) { listnode_delete(eigrp->oi_write_q, ei); if (list_isempty(eigrp->oi_write_q)) - thread_cancel(eigrp->t_write); + thread_cancel(&(eigrp->t_write)); ei->on_write_q = 0; } } @@ -420,7 +420,7 @@ void eigrp_if_free(struct eigrp_interface *ei, int source) struct eigrp *eigrp = ei->eigrp; if (source == INTERFACE_DOWN_BY_VTY) { - THREAD_OFF(ei->t_hello); + thread_cancel(&ei->t_hello); eigrp_hello_send(ei, EIGRP_HELLO_GRACEFUL_SHUTDOWN, NULL); } diff --git a/eigrpd/eigrp_neighbor.c b/eigrpd/eigrp_neighbor.c index 2ae3997fae..2d5bb0a7d1 100644 --- a/eigrpd/eigrp_neighbor.c +++ b/eigrpd/eigrp_neighbor.c @@ -87,10 +87,6 @@ static struct eigrp_neighbor *eigrp_nbr_add(struct eigrp_interface *ei, nbr = eigrp_nbr_new(ei); nbr->src = iph->ip_src; - // if (IS_DEBUG_EIGRP_EVENT) - // zlog_debug("NSM[%s:%s]: start", IF_NAME (nbr->oi), - // inet_ntoa (nbr->router_id)); - return nbr; } @@ -197,8 +193,7 @@ int holddown_timer_expired(struct thread *thread) struct eigrp_neighbor *nbr = THREAD_ARG(thread); struct eigrp *eigrp = nbr->ei->eigrp; - zlog_info("Neighbor %s (%s) is down: holding time expired", - inet_ntoa(nbr->src), + zlog_info("Neighbor %pI4 (%s) is down: holding time expired", &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); nbr->state = EIGRP_NEIGHBOR_DOWN; eigrp_nbr_delete(nbr); @@ -330,13 +325,12 @@ void eigrp_nbr_hard_restart(struct eigrp_neighbor *nbr, struct vty *vty) { struct eigrp *eigrp = nbr->ei->eigrp; - zlog_debug("Neighbor %s (%s) is down: manually cleared", - inet_ntoa(nbr->src), + zlog_debug("Neighbor %pI4 (%s) is down: manually cleared", &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); if (vty != NULL) { vty_time_print(vty, 0); - vty_out(vty, "Neighbor %s (%s) is down: manually cleared\n", - inet_ntoa(nbr->src), + vty_out(vty, "Neighbor %pI4 (%s) is down: manually cleared\n", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); } diff --git a/eigrpd/eigrp_network.c b/eigrpd/eigrp_network.c index 92b5ce3482..bd8ec2f879 100644 --- a/eigrpd/eigrp_network.c +++ b/eigrpd/eigrp_network.c @@ -160,9 +160,8 @@ int eigrp_if_ipmulticast(struct eigrp *top, struct prefix *p, ret = setsockopt_ipv4_multicast_if(top->fd, p->u.prefix4, ifindex); if (ret < 0) zlog_warn( - "can't setsockopt IP_MULTICAST_IF (fd %d, addr %s, ifindex %u): %s", - top->fd, inet_ntoa(p->u.prefix4), ifindex, - safe_strerror(errno)); + "can't setsockopt IP_MULTICAST_IF (fd %d, addr %pI4, ifindex %u): %s", + top->fd, &p->u.prefix4, ifindex, safe_strerror(errno)); return ret; } @@ -178,12 +177,11 @@ int eigrp_if_add_allspfrouters(struct eigrp *top, struct prefix *p, htonl(EIGRP_MULTICAST_ADDRESS), ifindex); if (ret < 0) zlog_warn( - "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, ifindex %u, AllSPFRouters): %s; perhaps a kernel limit on # of multicast group memberships has been exceeded?", - top->fd, inet_ntoa(p->u.prefix4), ifindex, - safe_strerror(errno)); + "can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %pI4, ifindex %u, AllSPFRouters): %s; perhaps a kernel limit on # of multicast group memberships has been exceeded?", + top->fd, &p->u.prefix4, ifindex, safe_strerror(errno)); else - zlog_debug("interface %s [%u] join EIGRP Multicast group.", - inet_ntoa(p->u.prefix4), ifindex); + zlog_debug("interface %pI4 [%u] join EIGRP Multicast group.", + &p->u.prefix4, ifindex); return ret; } @@ -198,12 +196,11 @@ int eigrp_if_drop_allspfrouters(struct eigrp *top, struct prefix *p, htonl(EIGRP_MULTICAST_ADDRESS), ifindex); if (ret < 0) zlog_warn( - "can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, ifindex %u, AllSPFRouters): %s", - top->fd, inet_ntoa(p->u.prefix4), ifindex, - safe_strerror(errno)); + "can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %pI4, ifindex %u, AllSPFRouters): %s", + top->fd, &p->u.prefix4, ifindex, safe_strerror(errno)); else - zlog_debug("interface %s [%u] leave EIGRP Multicast group.", - inet_ntoa(p->u.prefix4), ifindex); + zlog_debug("interface %pI4 [%u] leave EIGRP Multicast group.", + &p->u.prefix4, ifindex); return ret; } diff --git a/eigrpd/eigrp_northbound.c b/eigrpd/eigrp_northbound.c index 13887368f7..5b87f72640 100644 --- a/eigrpd/eigrp_northbound.c +++ b/eigrpd/eigrp_northbound.c @@ -243,10 +243,12 @@ static int eigrpd_instance_active_time_modify(struct nb_cb_modify_args *args) switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: + snprintf(args->errmsg, args->errmsg_len, + "active time not implemented yet"); /* NOTHING */ break; } @@ -677,11 +679,12 @@ static int eigrpd_instance_neighbor_create(struct nb_cb_create_args *args) switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* NOTHING */ + snprintf(args->errmsg, args->errmsg_len, + "neighbor Command is not implemented yet"); break; } @@ -693,11 +696,12 @@ static int eigrpd_instance_neighbor_destroy(struct nb_cb_destroy_args *args) switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* NOTHING */ + snprintf(args->errmsg, args->errmsg_len, + "no neighbor Command is not implemented yet"); break; } @@ -768,11 +772,13 @@ eigrpd_instance_redistribute_route_map_modify(struct nb_cb_modify_args *args) switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* NOTHING */ + snprintf( + args->errmsg, args->errmsg_len, + "'redistribute X route-map FOO' command not implemented yet"); break; } @@ -785,11 +791,13 @@ eigrpd_instance_redistribute_route_map_destroy(struct nb_cb_destroy_args *args) switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* NOTHING */ + snprintf( + args->errmsg, args->errmsg_len, + "'no redistribute X route-map FOO' command not implemented yet"); break; } @@ -1079,10 +1087,12 @@ lib_interface_eigrp_split_horizon_modify(struct nb_cb_modify_args *args) switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: + snprintf(args->errmsg, args->errmsg_len, + "split-horizon command not implemented yet"); /* NOTHING */ break; } @@ -1161,11 +1171,12 @@ static int lib_interface_eigrp_instance_summarize_addresses_create( switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: - /* NOTHING */ + snprintf(args->errmsg, args->errmsg_len, + "summary command not implemented yet"); break; } @@ -1178,10 +1189,12 @@ static int lib_interface_eigrp_instance_summarize_addresses_destroy( switch (args->event) { case NB_EV_VALIDATE: /* TODO: Not implemented. */ - return NB_ERR_INCONSISTENCY; case NB_EV_PREPARE: case NB_EV_ABORT: + return NB_OK; case NB_EV_APPLY: + snprintf(args->errmsg, args->errmsg_len, + "no summary command not implemented yet"); /* NOTHING */ break; } diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c index cfff63f839..f5f6ab5dff 100644 --- a/eigrpd/eigrp_packet.c +++ b/eigrpd/eigrp_packet.c @@ -442,17 +442,16 @@ int eigrp_write(struct thread *thread) if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND)) { eigrph = (struct eigrp_header *)STREAM_DATA(ep->s); zlog_debug( - "Sending [%s][%d/%d] to [%s] via [%s] ret [%d].", + "Sending [%s][%d/%d] to [%pI4] via [%s] ret [%d].", lookup_msg(eigrp_packet_type_str, eigrph->opcode, NULL), - seqno, ack, inet_ntoa(ep->dst), IF_NAME(ei), ret); + seqno, ack, &ep->dst, IF_NAME(ei), ret); } if (ret < 0) zlog_warn( - "*** sendmsg in eigrp_write failed to %s, id %d, off %d, len %d, interface %s, mtu %u: %s", - inet_ntoa(iph.ip_dst), iph.ip_id, iph.ip_off, - iph.ip_len, ei->ifp->name, ei->ifp->mtu, - safe_strerror(errno)); + "*** sendmsg in eigrp_write failed to %pI4, id %d, off %d, len %d, interface %s, mtu %u: %s", + &iph.ip_dst, iph.ip_id, iph.ip_off, iph.ip_len, + ei->ifp->name, ei->ifp->mtu, safe_strerror(errno)); /* Now delete packet from queue. */ eigrp_packet_delete(ei); @@ -552,8 +551,8 @@ int eigrp_read(struct thread *thread) || (IPV4_ADDR_SAME(&srcaddr, &ei->address.u.prefix4))) { if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) zlog_debug( - "eigrp_read[%s]: Dropping self-originated packet", - inet_ntoa(srcaddr)); + "eigrp_read[%pI4]: Dropping self-originated packet", + &srcaddr); return 0; } @@ -596,8 +595,9 @@ int eigrp_read(struct thread *thread) */ else if (ei->ifp != ifp) { if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) - zlog_warn("Packet from [%s] received on wrong link %s", - inet_ntoa(iph->ip_src), ifp->name); + zlog_warn( + "Packet from [%pI4] received on wrong link %s", + &iph->ip_src, ifp->name); return 0; } @@ -606,8 +606,8 @@ int eigrp_read(struct thread *thread) if (ret < 0) { if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) zlog_debug( - "eigrp_read[%s]: Header check failed, dropping.", - inet_ntoa(iph->ip_src)); + "eigrp_read[%pI4]: Header check failed, dropping.", + &iph->ip_src); return ret; } @@ -615,17 +615,12 @@ int eigrp_read(struct thread *thread) start of the eigrp TLVs */ opcode = eigrph->opcode; - if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) { - char src[PREFIX_STRLEN], dst[PREFIX_STRLEN]; - - strlcpy(src, inet_ntoa(iph->ip_src), sizeof(src)); - strlcpy(dst, inet_ntoa(iph->ip_dst), sizeof(dst)); + if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) zlog_debug( - "Received [%s][%d/%d] length [%u] via [%s] src [%s] dst [%s]", + "Received [%s][%d/%d] length [%u] via [%s] src [%pI4] dst [%pI4]", lookup_msg(eigrp_packet_type_str, opcode, NULL), ntohl(eigrph->sequence), ntohl(eigrph->ack), length, - IF_NAME(ei), src, dst); - } + IF_NAME(ei), &iph->ip_src, &iph->ip_dst); /* Read rest of the packet and call each sort of packet routine. */ stream_forward_getp(ibuf, EIGRP_HEADER_LEN); @@ -648,8 +643,9 @@ int eigrp_read(struct thread *thread) && (ntohl(eigrph->ack) == nbr->init_sequence_number)) { eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_UP); - zlog_info("Neighbor(%s) adjacency became full", - inet_ntoa(nbr->src)); + zlog_info( + "Neighbor(%pI4) adjacency became full", + &nbr->src); nbr->init_sequence_number = 0; nbr->recv_sequence_number = ntohl(eigrph->sequence); @@ -957,8 +953,8 @@ static int eigrp_verify_header(struct stream *ibuf, struct eigrp_interface *ei, /* Check network mask, Silently discarded. */ if (!eigrp_check_network_mask(ei, iph->ip_src)) { zlog_warn( - "interface %s: eigrp_read network address is not same [%s]", - IF_NAME(ei), inet_ntoa(iph->ip_src)); + "interface %s: eigrp_read network address is not same [%pI4]", + IF_NAME(ei), &iph->ip_src); return -1; } // diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c index 79405efbbf..26bb27d7ac 100644 --- a/eigrpd/eigrp_reply.c +++ b/eigrpd/eigrp_reply.c @@ -168,13 +168,10 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph, * Destination must exists */ if (!dest) { - char buf[PREFIX_STRLEN]; - flog_err( EC_EIGRP_PACKET, - "%s: Received prefix %s which we do not know about", - __func__, - prefix2str(&dest_addr, buf, sizeof(buf))); + "%s: Received prefix %pFX which we do not know about", + __func__, &dest_addr); eigrp_IPv4_InternalTLV_free(tlv); continue; } diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c index 7676af15f2..2dbee16694 100644 --- a/eigrpd/eigrp_topology.c +++ b/eigrpd/eigrp_topology.c @@ -133,14 +133,10 @@ void eigrp_prefix_entry_add(struct route_table *topology, rn = route_node_get(topology, pe->destination); if (rn->info) { - if (IS_DEBUG_EIGRP_EVENT) { - char buf[PREFIX_STRLEN]; - + if (IS_DEBUG_EIGRP_EVENT) zlog_debug( - "%s: %s Should we have found this entry in the topo table?", - __func__, - prefix2str(pe->destination, buf, sizeof(buf))); - } + "%s: %pFX Should we have found this entry in the topo table?", + __func__, pe->destination); route_unlock_node(rn); } diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index 6e2a81e32a..cd30eb5ab5 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -141,10 +141,8 @@ static void eigrp_update_receive_GR_ask(struct eigrp *eigrp, /* iterate over all prefixes which weren't advertised by neighbor */ for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix)) { - char buffer[PREFIX_STRLEN]; - zlog_debug( - "GR receive: Neighbor not advertised %s", - prefix2str(prefix->destination, buffer, PREFIX_STRLEN)); + zlog_debug("GR receive: Neighbor not advertised %pFX", + prefix->destination); fsm_msg.metrics = prefix->reported_metric; /* set delay to MAX */ @@ -209,18 +207,18 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph, nbr->recv_sequence_number = ntohl(eigrph->sequence); if (IS_DEBUG_EIGRP_PACKET(0, RECV)) zlog_debug( - "Processing Update size[%u] int(%s) nbr(%s) seq [%u] flags [%0x]", + "Processing Update size[%u] int(%s) nbr(%pI4) seq [%u] flags [%0x]", size, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id), - inet_ntoa(nbr->src), nbr->recv_sequence_number, flags); + &nbr->src, nbr->recv_sequence_number, flags); if ((flags == (EIGRP_INIT_FLAG + EIGRP_RS_FLAG + EIGRP_EOT_FLAG)) && (!same)) { /* Graceful restart Update received with all routes */ - zlog_info("Neighbor %s (%s) is resync: peer graceful-restart", - inet_ntoa(nbr->src), + zlog_info("Neighbor %pI4 (%s) is resync: peer graceful-restart", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); /* get all prefixes from neighbor from topology table */ @@ -231,8 +229,8 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph, /* Graceful restart Update received, routes also in next packet */ - zlog_info("Neighbor %s (%s) is resync: peer graceful-restart", - inet_ntoa(nbr->src), + zlog_info("Neighbor %pI4 (%s) is resync: peer graceful-restart", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); /* get all prefixes from neighbor from topology table */ @@ -279,15 +277,16 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph, eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_DOWN); eigrp_topology_neighbor_down(nbr->ei->eigrp, nbr); nbr->recv_sequence_number = ntohl(eigrph->sequence); - zlog_info("Neighbor %s (%s) is down: peer restarted", - inet_ntoa(nbr->src), + zlog_info("Neighbor %pI4 (%s) is down: peer restarted", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); eigrp_nbr_state_set(nbr, EIGRP_NEIGHBOR_PENDING); - zlog_info("Neighbor %s (%s) is pending: new adjacency", - inet_ntoa(nbr->src), - ifindex2ifname(nbr->ei->ifp->ifindex, - eigrp->vrf_id)); + zlog_info( + "Neighbor %pI4 (%s) is pending: new adjacency", + &nbr->src, + ifindex2ifname(nbr->ei->ifp->ifindex, + eigrp->vrf_id)); eigrp_update_send_init(nbr); } } @@ -450,8 +449,9 @@ void eigrp_update_send_init(struct eigrp_neighbor *nbr) nbr->init_sequence_number = nbr->ei->eigrp->sequence_number; ep->sequence_number = nbr->ei->eigrp->sequence_number; if (IS_DEBUG_EIGRP_PACKET(0, RECV)) - zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]", - ep->length, ep->sequence_number, inet_ntoa(ep->dst)); + zlog_debug( + "Enqueuing Update Init Len [%u] Seq [%u] Dest [%pI4]", + ep->length, ep->sequence_number, &ep->dst); /*Put packet to retransmission queue*/ eigrp_fifo_push(nbr->retrans_queue, ep); @@ -480,8 +480,9 @@ static void eigrp_update_place_on_nbr_queue(struct eigrp_neighbor *nbr, ep->sequence_number = seq_no; if (IS_DEBUG_EIGRP_PACKET(0, RECV)) - zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]", - ep->length, ep->sequence_number, inet_ntoa(ep->dst)); + zlog_debug( + "Enqueuing Update Init Len [%u] Seq [%u] Dest [%pI4]", + ep->length, ep->sequence_number, &ep->dst); /*Put packet to retransmission queue*/ eigrp_fifo_push(nbr->retrans_queue, ep); @@ -815,8 +816,8 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr) if (eigrp_update_prefix_apply(eigrp, ei, EIGRP_FILTER_OUT, dest_addr)) { /* do not send filtered route */ - zlog_info("Filtered prefix %s won't be sent out.", - inet_ntoa(dest_addr->u.prefix4)); + zlog_info("Filtered prefix %pI4 won't be sent out.", + &dest_addr->u.prefix4); } else { /* sending route which wasn't filtered */ length += eigrp_add_internalTLV_to_stream(ep->s, pe); @@ -830,8 +831,8 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr) if (eigrp_update_prefix_apply(eigrp, ei, EIGRP_FILTER_IN, dest_addr)) { /* do not send filtered route */ - zlog_info("Filtered prefix %s will be removed.", - inet_ntoa(dest_addr->u.prefix4)); + zlog_info("Filtered prefix %pI4 will be removed.", + &dest_addr->u.prefix4); /* prepare message for FSM */ struct eigrp_fsm_action_message fsm_msg; @@ -880,8 +881,9 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr) ep->sequence_number = eigrp->sequence_number; if (IS_DEBUG_EIGRP_PACKET(0, RECV)) - zlog_debug("Enqueuing Update Init Len [%u] Seq [%u] Dest [%s]", - ep->length, ep->sequence_number, inet_ntoa(ep->dst)); + zlog_debug( + "Enqueuing Update Init Len [%u] Seq [%u] Dest [%pI4]", + ep->length, ep->sequence_number, &ep->dst); /*Put packet to retransmission queue*/ eigrp_fifo_push(nbr->retrans_queue, ep); @@ -963,20 +965,20 @@ void eigrp_update_send_GR(struct eigrp_neighbor *nbr, enum GR_type gr_type, if (gr_type == EIGRP_GR_FILTER) { /* function was called after applying filtration */ zlog_info( - "Neighbor %s (%s) is resync: route configuration changed", - inet_ntoa(nbr->src), + "Neighbor %pI4 (%s) is resync: route configuration changed", + &nbr->src, ifindex2ifname(ei->ifp->ifindex, eigrp->vrf_id)); } else if (gr_type == EIGRP_GR_MANUAL) { /* Graceful restart was called manually */ - zlog_info("Neighbor %s (%s) is resync: manually cleared", - inet_ntoa(nbr->src), + zlog_info("Neighbor %pI4 (%s) is resync: manually cleared", + &nbr->src, ifindex2ifname(ei->ifp->ifindex, eigrp->vrf_id)); if (vty != NULL) { vty_time_print(vty, 0); vty_out(vty, - "Neighbor %s (%s) is resync: manually cleared\n", - inet_ntoa(nbr->src), + "Neighbor %pI4 (%s) is resync: manually cleared\n", + &nbr->src, ifindex2ifname(ei->ifp->ifindex, eigrp->vrf_id)); } diff --git a/eigrpd/eigrp_vty.c b/eigrpd/eigrp_vty.c index 4426cf67e9..66dfbaa538 100644 --- a/eigrpd/eigrp_vty.c +++ b/eigrpd/eigrp_vty.c @@ -360,14 +360,14 @@ DEFPY (clear_ip_eigrp_neighbors, for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) { if (nbr->state != EIGRP_NEIGHBOR_DOWN) { zlog_debug( - "Neighbor %s (%s) is down: manually cleared", - inet_ntoa(nbr->src), + "Neighbor %pI4 (%s) is down: manually cleared", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); vty_time_print(vty, 0); vty_out(vty, - "Neighbor %s (%s) is down: manually cleared\n", - inet_ntoa(nbr->src), + "Neighbor %pI4 (%s) is down: manually cleared\n", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); @@ -420,14 +420,15 @@ DEFPY (clear_ip_eigrp_neighbors_int, /* iterate over all neighbors on eigrp interface */ for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) { if (nbr->state != EIGRP_NEIGHBOR_DOWN) { - zlog_debug("Neighbor %s (%s) is down: manually cleared", - inet_ntoa(nbr->src), - ifindex2ifname(nbr->ei->ifp->ifindex, - eigrp->vrf_id)); + zlog_debug( + "Neighbor %pI4 (%s) is down: manually cleared", + &nbr->src, + ifindex2ifname(nbr->ei->ifp->ifindex, + eigrp->vrf_id)); vty_time_print(vty, 0); vty_out(vty, - "Neighbor %s (%s) is down: manually cleared\n", - inet_ntoa(nbr->src), + "Neighbor %pI4 (%s) is down: manually cleared\n", + &nbr->src, ifindex2ifname(nbr->ei->ifp->ifindex, eigrp->vrf_id)); diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index 3205f13922..473cc75a2a 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -150,12 +150,9 @@ static int eigrp_interface_address_add(ZAPI_CALLBACK_ARGS) if (c == NULL) return 0; - if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) { - char buf[128]; - prefix2str(c->address, buf, sizeof(buf)); - zlog_debug("Zebra: interface %s address add %s", c->ifp->name, - buf); - } + if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) + zlog_debug("Zebra: interface %s address add %pFX", c->ifp->name, + c->address); eigrp_if_update(c->ifp); @@ -173,12 +170,9 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS) if (c == NULL) return 0; - if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) { - char buf[128]; - prefix2str(c->address, buf, sizeof(buf)); - zlog_debug("Zebra: interface %s address delete %s", - c->ifp->name, buf); - } + if (IS_DEBUG_EIGRP(zebra, ZEBRA_INTERFACE)) + zlog_debug("Zebra: interface %s address delete %pFX", + c->ifp->name, c->address); ifp = c->ifp; ei = ifp->info; @@ -234,10 +228,9 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p, api.nexthop_num = count; if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) { - char buf[2][PREFIX_STRLEN]; - zlog_debug("Zebra: Route add %s nexthop %s", - prefix2str(p, buf[0], PREFIX_STRLEN), - inet_ntop(AF_INET, 0, buf[1], PREFIX_STRLEN)); + char buf[PREFIX_STRLEN]; + zlog_debug("Zebra: Route add %pFX nexthop %s", p, + inet_ntop(AF_INET, 0, buf, PREFIX_STRLEN)); } zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); @@ -257,11 +250,8 @@ void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p) memcpy(&api.prefix, p, sizeof(*p)); zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); - if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) { - char buf[PREFIX_STRLEN]; - zlog_debug("Zebra: Route del %s", - prefix2str(p, buf, PREFIX_STRLEN)); - } + if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) + zlog_debug("Zebra: Route del %pFX", p); return; } diff --git a/eigrpd/eigrpd.c b/eigrpd/eigrpd.c index 820f015b57..5002630796 100644 --- a/eigrpd/eigrpd.c +++ b/eigrpd/eigrpd.c @@ -110,10 +110,6 @@ void eigrp_router_id_update(struct eigrp *eigrp) eigrp->router_id = router_id; if (router_id_old.s_addr != router_id.s_addr) { - // if (IS_DEBUG_EIGRP_EVENT) - // zlog_debug("Router-ID[NEW:%s]: Update", - // inet_ntoa(eigrp->router_id)); - /* update eigrp_interface's */ FOR_ALL_INTERFACES (vrf, ifp) eigrp_if_update(ifp); |
