summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eigrpd/eigrp_const.h5
-rw-r--r--eigrpd/eigrp_fsm.c69
-rw-r--r--eigrpd/eigrp_hello.c6
-rw-r--r--eigrpd/eigrp_packet.c131
-rw-r--r--eigrpd/eigrp_packet.h8
-rw-r--r--eigrpd/eigrp_query.c4
-rw-r--r--eigrpd/eigrp_reply.c8
-rw-r--r--eigrpd/eigrp_siaquery.c4
-rw-r--r--eigrpd/eigrp_siareply.c4
-rw-r--r--eigrpd/eigrp_structs.h2
-rw-r--r--eigrpd/eigrp_topology.c32
-rw-r--r--eigrpd/eigrp_topology.h2
-rw-r--r--eigrpd/eigrp_update.c24
-rw-r--r--nhrpd/nhrp_nhs.c2
-rw-r--r--ospfd/ospf_interface.h2
-rw-r--r--ospfd/ospf_vty.c28
-rw-r--r--pimd/pim_bfd.c42
-rw-r--r--pimd/pim_cmd.c79
-rw-r--r--pimd/pim_ifchannel.c3
-rw-r--r--pimd/pim_upstream.c29
20 files changed, 269 insertions, 215 deletions
diff --git a/eigrpd/eigrp_const.h b/eigrpd/eigrp_const.h
index a6282665e4..a008891a51 100644
--- a/eigrpd/eigrp_const.h
+++ b/eigrpd/eigrp_const.h
@@ -94,6 +94,11 @@
#define EIGRP_MULTICAST_ADDRESS 0xe000000A /*224.0.0.10*/
#define EIGRP_MAX_METRIC 0xffffffffU /*4294967295*/
+enum metric_change {
+ METRIC_DECREASE,
+ METRIC_SAME,
+ METRIC_INCREASE
+};
#define DEFAULT_ROUTE ZEBRA_ROUTE_MAX
#define DEFAULT_ROUTE_TYPE(T) ((T) == DEFAULT_ROUTE)
diff --git a/eigrpd/eigrp_fsm.c b/eigrpd/eigrp_fsm.c
index 852362e192..ba2d1f7e8d 100644
--- a/eigrpd/eigrp_fsm.c
+++ b/eigrpd/eigrp_fsm.c
@@ -185,6 +185,7 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
struct eigrp_prefix_entry *prefix = msg->prefix;
struct eigrp_neighbor_entry *entry = msg->entry;
u_char actual_state = prefix->state;
+ enum metric_change change;
if (entry == NULL) {
entry = eigrp_neighbor_entry_new();
@@ -194,19 +195,18 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
msg->entry = entry;
}
- // Dividing by actual state of prefix's FSM
+ /*
+ * Calculate resultant metrics and insert to correct position
+ * in entries list
+ */
+ change = eigrp_topology_update_distance(msg);
+
switch (actual_state) {
case EIGRP_FSM_STATE_PASSIVE: {
- // Calculate resultant metrics and insert to correct position in
- // entries list
- eigrp_topology_update_distance(msg);
-
struct eigrp_neighbor_entry *head =
(struct eigrp_neighbor_entry *)
entry->prefix->entries->head->data;
- // zlog_info ("flag: %d rdist: %u dist: %u pfdist: %u pdist:
- // %u", head->flags, head->reported_distance, head->distance,
- // prefix->fdistance, prefix->distance);
+
if (head->reported_distance < prefix->fdistance) {
return EIGRP_FSM_KEEP_STATE;
}
@@ -215,34 +215,31 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
* move to active state
* dependently if it was query from successor
*/
- else {
- if (msg->packet_type == EIGRP_OPC_QUERY) {
- return EIGRP_FSM_EVENT_Q_FCN;
- } else {
- return EIGRP_FSM_EVENT_NQ_FCN;
- }
+ if (msg->packet_type == EIGRP_OPC_QUERY) {
+ return EIGRP_FSM_EVENT_Q_FCN;
+ } else {
+ return EIGRP_FSM_EVENT_NQ_FCN;
}
break;
}
case EIGRP_FSM_STATE_ACTIVE_0: {
- eigrp_topology_update_distance(msg);
-
if (msg->packet_type == EIGRP_OPC_REPLY) {
+ struct eigrp_neighbor_entry *head =
+ (struct eigrp_neighbor_entry *)
+ entry->prefix->entries->head->data;
+
listnode_delete(prefix->rij, entry->adv_router);
- if (prefix->rij->count) {
+ if (prefix->rij->count)
return EIGRP_FSM_KEEP_STATE;
- } else {
- zlog_info("All reply received\n");
- if (((struct eigrp_neighbor_entry *)
- prefix->entries->head->data)
- ->reported_distance
- < prefix->fdistance) {
- return EIGRP_FSM_EVENT_LR_FCS;
- }
- return EIGRP_FSM_EVENT_LR_FCN;
+ zlog_info("All reply received\n");
+ if (head->reported_distance
+ < prefix->fdistance) {
+ return EIGRP_FSM_EVENT_LR_FCS;
}
+
+ return EIGRP_FSM_EVENT_LR_FCN;
} else if (msg->packet_type == EIGRP_OPC_QUERY
&& (entry->flags
& EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
@@ -254,15 +251,13 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
break;
}
case EIGRP_FSM_STATE_ACTIVE_1: {
- int change = eigrp_topology_update_distance(msg);
-
if (msg->packet_type == EIGRP_OPC_QUERY
&& (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
return EIGRP_FSM_EVENT_QACT;
} else if (msg->packet_type == EIGRP_OPC_REPLY) {
listnode_delete(prefix->rij, entry->adv_router);
- if (change == 1
+ if (change == METRIC_INCREASE
&& (entry->flags
& EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
return EIGRP_FSM_EVENT_DINC;
@@ -282,17 +277,17 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
break;
}
case EIGRP_FSM_STATE_ACTIVE_2: {
- eigrp_topology_update_distance(msg);
-
if (msg->packet_type == EIGRP_OPC_REPLY) {
+ struct eigrp_neighbor_entry *head =
+ (struct eigrp_neighbor_entry *)
+ prefix->entries->head->data;
+
listnode_delete(prefix->rij, entry->adv_router);
if (prefix->rij->count) {
return EIGRP_FSM_KEEP_STATE;
} else {
zlog_info("All reply received\n");
- if (((struct eigrp_neighbor_entry *)
- prefix->entries->head->data)
- ->reported_distance
+ if (head->reported_distance
< prefix->fdistance) {
return EIGRP_FSM_EVENT_LR_FCS;
}
@@ -305,12 +300,10 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
break;
}
case EIGRP_FSM_STATE_ACTIVE_3: {
- int change = eigrp_topology_update_distance(msg);
-
if (msg->packet_type == EIGRP_OPC_REPLY) {
listnode_delete(prefix->rij, entry->adv_router);
- if (change == 1
+ if (change == METRIC_INCREASE
&& (entry->flags
& EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)) {
return EIGRP_FSM_EVENT_DINC;
@@ -340,7 +333,7 @@ int eigrp_get_fsm_event(struct eigrp_fsm_action_message *msg)
*/
int eigrp_fsm_event(struct eigrp_fsm_action_message *msg, int event)
{
- zlog_info("EIGRP AS: %d State: %d Event: %d Network: %s\n",
+ zlog_info("EIGRP AS: %d State: %d Event: %d Network: %s",
msg->eigrp->AS, msg->prefix->state, event,
eigrp_topology_ip_string(msg->prefix));
(*(NSM[msg->prefix->state][event].func))(msg);
diff --git a/eigrpd/eigrp_hello.c b/eigrpd/eigrp_hello.c
index b7c2f7f18d..67f75c536b 100644
--- a/eigrpd/eigrp_hello.c
+++ b/eigrpd/eigrp_hello.c
@@ -614,7 +614,7 @@ static struct eigrp_packet *eigrp_hello_encode(struct eigrp_interface *ei,
u_int16_t length = EIGRP_HEADER_LEN;
// allocate a new packet to be sent
- ep = eigrp_packet_new(ei->ifp->mtu);
+ ep = eigrp_packet_new(ei->ifp->mtu, NULL);
if (ep) {
// encode common header feilds
@@ -707,7 +707,7 @@ void eigrp_hello_send_ack(struct eigrp_neighbor *nbr)
inet_ntoa(nbr->src));
/* Add packet to the top of the interface output queue*/
- eigrp_fifo_push_head(nbr->ei->obuf, ep);
+ eigrp_fifo_push(nbr->ei->obuf, ep);
/* Hook thread to write packet. */
if (nbr->ei->on_write_q == 0) {
@@ -755,7 +755,7 @@ void eigrp_hello_send(struct eigrp_interface *ei, u_char flags,
if (ep) {
// Add packet to the top of the interface output queue
- eigrp_fifo_push_head(ei->obuf, ep);
+ eigrp_fifo_push(ei->obuf, ep);
/* Hook thread to write packet. */
if (ei->on_write_q == 0) {
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index dfc7463025..f38b759e9f 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -299,18 +299,6 @@ int eigrp_check_sha256_digest(struct stream *s,
return 1;
}
-/*
- * eigrp_packet_dump
- *
- * This routing dumps the contents of the IP packet either received or
- * built by EIGRP.
- */
-static void eigrp_packet_dump(struct stream *s)
-{
- // not yet...
- return;
-}
-
int eigrp_write(struct thread *thread)
{
struct eigrp *eigrp = THREAD_ARG(thread);
@@ -322,6 +310,7 @@ int eigrp_write(struct thread *thread)
struct msghdr msg;
struct iovec iov[2];
u_int16_t opcode = 0;
+ u_int32_t seqno, ack;
int ret;
int flags = 0;
@@ -347,7 +336,7 @@ int eigrp_write(struct thread *thread)
#endif /* WANT_EIGRP_WRITE_FRAGMENT */
/* Get one packet from queue. */
- ep = eigrp_fifo_head(ei->obuf);
+ ep = eigrp_fifo_next(ei->obuf);
assert(ep);
assert(ep->length >= EIGRP_HEADER_LEN);
@@ -357,6 +346,25 @@ int eigrp_write(struct thread *thread)
memset(&iph, 0, sizeof(struct ip));
memset(&sa_dst, 0, sizeof(sa_dst));
+ /*
+ * We build and schedule packets to go out
+ * in the future. In the mean time we may
+ * process some update packets from the
+ * neighbor, thus making it necessary
+ * to update the ack we are using for
+ * this outgoing packet.
+ */
+ eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
+ opcode = eigrph->opcode;
+ seqno = ntohl(eigrph->sequence);
+ ack = ntohl(eigrph->ack);
+ if (ep->nbr && (ack != ep->nbr->recv_sequence_number)) {
+ eigrph->ack = htonl(ep->nbr->recv_sequence_number);
+ ack = ep->nbr->recv_sequence_number;
+ eigrph->checksum = 0;
+ eigrp_packet_checksum(ei, ep->s, ep->length);
+ }
+
sa_dst.sin_family = AF_INET;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
sa_dst.sin_len = sizeof(sa_dst);
@@ -412,8 +420,9 @@ int eigrp_write(struct thread *thread)
if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND)) {
eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
opcode = eigrph->opcode;
- zlog_debug("Sending [%s] to [%s] via [%s] ret [%d].",
+ zlog_debug("Sending [%s][%d/%d] to [%s] via [%s] ret [%d].",
lookup_msg(eigrp_packet_type_str, opcode, NULL),
+ seqno, ack,
inet_ntoa(ep->dst), IF_NAME(ei), ret);
}
@@ -425,22 +434,10 @@ int eigrp_write(struct thread *thread)
iph.ip_len, ei->ifp->name, ei->ifp->mtu,
safe_strerror(errno));
- /* Show debug sending packet. */
- if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND)
- && (IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))) {
- zlog_debug(
- "-----------------------------------------------------");
- eigrp_ip_header_dump(&iph);
- stream_set_getp(ep->s, 0);
- eigrp_packet_dump(ep->s);
- zlog_debug(
- "-----------------------------------------------------");
- }
-
/* Now delete packet from queue. */
eigrp_packet_delete(ei);
- if (eigrp_fifo_head(ei->obuf) == NULL) {
+ if (eigrp_fifo_next(ei->obuf) == NULL) {
ei->on_write_q = 0;
list_delete_node(eigrp->oi_write_q, node);
}
@@ -615,12 +612,16 @@ int eigrp_read(struct thread *thread)
start of the eigrp TLVs */
opcode = eigrph->opcode;
- if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
- zlog_debug(
- "Received [%s] length [%u] via [%s] src [%s] dst [%s]",
- lookup_msg(eigrp_packet_type_str, opcode, NULL), length,
- IF_NAME(ei), inet_ntoa(iph->ip_src),
- inet_ntoa(iph->ip_dst));
+ if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV)) {
+ char src[100], dst[100];
+
+ strcpy(src, inet_ntoa(iph->ip_src));
+ strcpy(dst, inet_ntoa(iph->ip_dst));
+ 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,
+ IF_NAME(ei), src, dst);
+ }
/* Read rest of the packet and call each sort of packet routine. */
stream_forward_getp(ibuf, EIGRP_HEADER_LEN);
@@ -635,7 +636,7 @@ int eigrp_read(struct thread *thread)
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_next(nbr->retrans_queue);
if (ep) {
if (ntohl(eigrph->ack) == ep->sequence_number) {
if ((nbr->state == EIGRP_NEIGHBOR_PENDING)
@@ -643,24 +644,24 @@ int eigrp_read(struct thread *thread)
== nbr->init_sequence_number)) {
eigrp_nbr_state_set(nbr,
EIGRP_NEIGHBOR_UP);
- zlog_info(
- "Neighbor adjacency became full");
+ zlog_info("Neighbor(%s) adjacency became full",
+ inet_ntoa(nbr->src));
nbr->init_sequence_number = 0;
nbr->recv_sequence_number =
ntohl(eigrph->sequence);
eigrp_update_send_EOT(nbr);
}
- ep = eigrp_fifo_pop_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_pop(nbr->retrans_queue);
eigrp_packet_free(ep);
if (nbr->retrans_queue->count > 0) {
eigrp_send_packet_reliably(nbr);
}
}
}
- ep = eigrp_fifo_tail(nbr->multicast_queue);
+ ep = eigrp_fifo_next(nbr->multicast_queue);
if (ep) {
if (ntohl(eigrph->ack) == ep->sequence_number) {
- ep = eigrp_fifo_pop_tail(nbr->multicast_queue);
+ ep = eigrp_fifo_pop(nbr->multicast_queue);
eigrp_packet_free(ep);
if (nbr->multicast_queue->count > 0) {
eigrp_send_packet_reliably(nbr);
@@ -826,13 +827,14 @@ void eigrp_fifo_reset(struct eigrp_fifo *fifo)
fifo->count = 0;
}
-struct eigrp_packet *eigrp_packet_new(size_t size)
+struct eigrp_packet *eigrp_packet_new(size_t size, struct eigrp_neighbor *nbr)
{
struct eigrp_packet *new;
new = XCALLOC(MTYPE_EIGRP_PACKET, sizeof(struct eigrp_packet));
new->s = stream_new(size);
new->retrans_counter = 0;
+ new->nbr = nbr;
return new;
}
@@ -841,13 +843,13 @@ void eigrp_send_packet_reliably(struct eigrp_neighbor *nbr)
{
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_next(nbr->retrans_queue);
if (ep) {
struct eigrp_packet *duplicate;
duplicate = eigrp_packet_duplicate(ep, nbr);
/* Add packet to the top of the interface output queue*/
- eigrp_fifo_push_head(nbr->ei->obuf, duplicate);
+ eigrp_fifo_push(nbr->ei->obuf, duplicate);
/*Start retransmission timer*/
thread_add_timer(master, eigrp_unack_packet_retrans, nbr,
@@ -901,7 +903,7 @@ void eigrp_packet_header_init(int type, struct eigrp_interface *ei,
// eigrph->sequence = htonl(3);
eigrph->flags = htonl(flags);
- if (IS_DEBUG_EIGRP_TRANSMIT(0, RECV))
+ if (IS_DEBUG_EIGRP_TRANSMIT(0, PACKET_DETAIL))
zlog_debug("Packet Header Init Seq [%u] Ack [%u]",
htonl(eigrph->sequence), htonl(eigrph->ack));
@@ -909,7 +911,7 @@ void eigrp_packet_header_init(int type, struct eigrp_interface *ei,
}
/* Add new packet to head of fifo. */
-void eigrp_fifo_push_head(struct eigrp_fifo *fifo, struct eigrp_packet *ep)
+void eigrp_fifo_push(struct eigrp_fifo *fifo, struct eigrp_packet *ep)
{
ep->next = fifo->head;
ep->previous = NULL;
@@ -925,14 +927,8 @@ void eigrp_fifo_push_head(struct eigrp_fifo *fifo, struct eigrp_packet *ep)
fifo->count++;
}
-/* Return first fifo entry. */
-struct eigrp_packet *eigrp_fifo_head(struct eigrp_fifo *fifo)
-{
- return fifo->head;
-}
-
/* Return last fifo entry. */
-struct eigrp_packet *eigrp_fifo_tail(struct eigrp_fifo *fifo)
+struct eigrp_packet *eigrp_fifo_next(struct eigrp_fifo *fifo)
{
return fifo->tail;
}
@@ -947,27 +943,6 @@ void eigrp_packet_delete(struct eigrp_interface *ei)
eigrp_packet_free(ep);
}
-/* Delete first packet from fifo. */
-struct eigrp_packet *eigrp_fifo_pop(struct eigrp_fifo *fifo)
-{
- struct eigrp_packet *ep;
-
- ep = fifo->head;
-
- if (ep) {
- fifo->head = ep->next;
-
- if (fifo->head == NULL)
- fifo->tail = NULL;
- else
- fifo->head->previous = NULL;
-
- fifo->count--;
- }
-
- return ep;
-}
-
void eigrp_packet_free(struct eigrp_packet *ep)
{
if (ep->s)
@@ -1028,14 +1003,14 @@ int eigrp_unack_packet_retrans(struct thread *thread)
nbr = (struct eigrp_neighbor *)THREAD_ARG(thread);
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->retrans_queue);
+ ep = eigrp_fifo_next(nbr->retrans_queue);
if (ep) {
struct eigrp_packet *duplicate;
duplicate = eigrp_packet_duplicate(ep, nbr);
/* Add packet to the top of the interface output queue*/
- eigrp_fifo_push_head(nbr->ei->obuf, duplicate);
+ eigrp_fifo_push(nbr->ei->obuf, duplicate);
ep->retrans_counter++;
if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX)
@@ -1065,13 +1040,13 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread)
nbr = (struct eigrp_neighbor *)THREAD_ARG(thread);
struct eigrp_packet *ep;
- ep = eigrp_fifo_tail(nbr->multicast_queue);
+ ep = eigrp_fifo_next(nbr->multicast_queue);
if (ep) {
struct eigrp_packet *duplicate;
duplicate = eigrp_packet_duplicate(ep, nbr);
/* Add packet to the top of the interface output queue*/
- eigrp_fifo_push_head(nbr->ei->obuf, duplicate);
+ eigrp_fifo_push(nbr->ei->obuf, duplicate);
ep->retrans_counter++;
if (ep->retrans_counter == EIGRP_PACKET_RETRANS_MAX)
@@ -1096,7 +1071,7 @@ int eigrp_unack_multicast_packet_retrans(struct thread *thread)
}
/* Get packet from tail of fifo. */
-struct eigrp_packet *eigrp_fifo_pop_tail(struct eigrp_fifo *fifo)
+struct eigrp_packet *eigrp_fifo_pop(struct eigrp_fifo *fifo)
{
struct eigrp_packet *ep;
@@ -1121,7 +1096,7 @@ struct eigrp_packet *eigrp_packet_duplicate(struct eigrp_packet *old,
{
struct eigrp_packet *new;
- new = eigrp_packet_new(nbr->ei->ifp->mtu);
+ new = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
new->length = old->length;
new->retrans_counter = old->retrans_counter;
new->dst = old->dst;
diff --git a/eigrpd/eigrp_packet.h b/eigrpd/eigrp_packet.h
index 2f607e5cab..040204a7fc 100644
--- a/eigrpd/eigrp_packet.h
+++ b/eigrpd/eigrp_packet.h
@@ -36,7 +36,7 @@
extern int eigrp_read(struct thread *);
extern int eigrp_write(struct thread *);
-extern struct eigrp_packet *eigrp_packet_new(size_t);
+extern struct eigrp_packet *eigrp_packet_new(size_t, struct eigrp_neighbor *);
extern struct eigrp_packet *eigrp_packet_duplicate(struct eigrp_packet *,
struct eigrp_neighbor *);
extern void eigrp_packet_free(struct eigrp_packet *);
@@ -48,11 +48,9 @@ extern void eigrp_packet_checksum(struct eigrp_interface *, struct stream *,
u_int16_t);
extern struct eigrp_fifo *eigrp_fifo_new(void);
-extern struct eigrp_packet *eigrp_fifo_head(struct eigrp_fifo *);
-extern struct eigrp_packet *eigrp_fifo_tail(struct eigrp_fifo *);
+extern struct eigrp_packet *eigrp_fifo_next(struct eigrp_fifo *);
extern struct eigrp_packet *eigrp_fifo_pop(struct eigrp_fifo *);
-extern struct eigrp_packet *eigrp_fifo_pop_tail(struct eigrp_fifo *);
-extern void eigrp_fifo_push_head(struct eigrp_fifo *, struct eigrp_packet *);
+extern void eigrp_fifo_push(struct eigrp_fifo *, struct eigrp_packet *);
extern void eigrp_fifo_free(struct eigrp_fifo *);
extern void eigrp_fifo_reset(struct eigrp_fifo *);
diff --git a/eigrpd/eigrp_query.c b/eigrpd/eigrp_query.c
index 653eae258f..d6299ad923 100644
--- a/eigrpd/eigrp_query.c
+++ b/eigrpd/eigrp_query.c
@@ -159,7 +159,7 @@ void eigrp_send_query(struct eigrp_interface *ei)
char has_tlv;
bool ep_saved = false;
- ep = eigrp_packet_new(ei->ifp->mtu);
+ ep = eigrp_packet_new(ei->ifp->mtu, NULL);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_QUERY, ei, ep->s, 0,
@@ -207,7 +207,7 @@ void eigrp_send_query(struct eigrp_interface *ei)
for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) {
if (nbr->state == EIGRP_NEIGHBOR_UP) {
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
ep_saved = true;
if (nbr->retrans_queue->count == 1) {
diff --git a/eigrpd/eigrp_reply.c b/eigrpd/eigrp_reply.c
index 4eb08c60d0..60390ad8a3 100644
--- a/eigrpd/eigrp_reply.c
+++ b/eigrpd/eigrp_reply.c
@@ -84,9 +84,7 @@ void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
plist = e->prefix[EIGRP_FILTER_OUT];
alist_i = nbr->ei->list[EIGRP_FILTER_OUT];
plist_i = nbr->ei->prefix[EIGRP_FILTER_OUT];
- zlog_info("REPLY Send: Filtering");
- zlog_info("REPLY SEND Prefix: %s", inet_ntoa(nbr->src));
/* Check if any list fits */
if ((alist
&& access_list_apply(alist, (struct prefix *)pe2->destination_ipv4)
@@ -106,15 +104,13 @@ void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
zlog_info("REPLY SEND: Setting Metric to max");
pe2->reported_metric.delay = EIGRP_MAX_METRIC;
- } else {
- zlog_info("REPLY SEND: Not setting metric");
}
/*
* End of filtering
*/
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_REPLY, nbr->ei, ep->s, 0,
@@ -144,7 +140,7 @@ void eigrp_send_reply(struct eigrp_neighbor *nbr, struct eigrp_prefix_entry *pe)
ep->sequence_number = nbr->ei->eigrp->sequence_number;
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) {
eigrp_send_packet_reliably(nbr);
diff --git a/eigrpd/eigrp_siaquery.c b/eigrpd/eigrp_siaquery.c
index f16f49a330..215df7b8ee 100644
--- a/eigrpd/eigrp_siaquery.c
+++ b/eigrpd/eigrp_siaquery.c
@@ -123,7 +123,7 @@ void eigrp_send_siaquery(struct eigrp_neighbor *nbr,
struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAQUERY, nbr->ei, ep->s, 0,
@@ -153,7 +153,7 @@ void eigrp_send_siaquery(struct eigrp_neighbor *nbr,
if (nbr->state == EIGRP_NEIGHBOR_UP) {
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) {
eigrp_send_packet_reliably(nbr);
diff --git a/eigrpd/eigrp_siareply.c b/eigrpd/eigrp_siareply.c
index 9a768566d3..32f0c8be33 100644
--- a/eigrpd/eigrp_siareply.c
+++ b/eigrpd/eigrp_siareply.c
@@ -122,7 +122,7 @@ void eigrp_send_siareply(struct eigrp_neighbor *nbr,
struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_SIAREPLY, nbr->ei, ep->s, 0,
@@ -152,7 +152,7 @@ void eigrp_send_siareply(struct eigrp_neighbor *nbr,
if (nbr->state == EIGRP_NEIGHBOR_UP) {
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) {
eigrp_send_packet_reliably(nbr);
diff --git a/eigrpd/eigrp_structs.h b/eigrpd/eigrp_structs.h
index fd3e4b2014..0c15436d4f 100644
--- a/eigrpd/eigrp_structs.h
+++ b/eigrpd/eigrp_structs.h
@@ -311,6 +311,8 @@ struct eigrp_packet {
/* EIGRP packet length. */
u_int16_t length;
+
+ struct eigrp_neighbor *nbr;
};
struct eigrp_fifo {
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index ae1396ebaf..50d83430a8 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -374,42 +374,42 @@ struct list *eigrp_neighbor_prefixes_lookup(struct eigrp *eigrp,
return prefixes;
}
-int eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
+enum metric_change eigrp_topology_update_distance(struct eigrp_fsm_action_message *msg)
{
struct eigrp *eigrp = msg->eigrp;
struct eigrp_prefix_entry *prefix = msg->prefix;
struct eigrp_neighbor_entry *entry = msg->entry;
- int change = 0;
+ enum metric_change change = METRIC_SAME;
assert(entry);
struct TLV_IPv4_External_type *ext_data = NULL;
struct TLV_IPv4_Internal_type *int_data = NULL;
if (msg->data_type == EIGRP_TLV_IPv4_INT) {
+ u_int32_t new_reported_distance;
+
int_data = msg->data.ipv4_int_type;
if (eigrp_metrics_is_same(int_data->metric,
entry->reported_metric)) {
- return 0; // No change
+ return change; // No change
}
- change = entry->reported_distance
- < eigrp_calculate_metrics(
- eigrp, int_data->metric)
- ? 1
- : entry->reported_distance
- > eigrp_calculate_metrics(
- eigrp,
- int_data->metric)
- ? 2
- : 3; // Increase : Decrease : No
- // change
+
+ new_reported_distance = eigrp_calculate_metrics(eigrp,
+ int_data->metric);
+
+ if (entry->reported_distance < new_reported_distance)
+ change = METRIC_INCREASE;
+ else
+ change = METRIC_DECREASE;
+
entry->reported_metric = int_data->metric;
- entry->reported_distance =
+ entry->reported_distance = new_reported_distance;
eigrp_calculate_metrics(eigrp, int_data->metric);
entry->distance = eigrp_calculate_total_metrics(eigrp, entry);
} else {
ext_data = msg->data.ipv4_ext_data;
if (eigrp_metrics_is_same(ext_data->metric,
entry->reported_metric))
- return 0;
+ return change;
}
/*
* Move to correct position in list according to new distance
diff --git a/eigrpd/eigrp_topology.h b/eigrpd/eigrp_topology.h
index 1340c82101..0c9b5c60c6 100644
--- a/eigrpd/eigrp_topology.h
+++ b/eigrpd/eigrp_topology.h
@@ -60,7 +60,7 @@ extern struct list *eigrp_neighbor_prefixes_lookup(struct eigrp *,
struct eigrp_neighbor *);
extern void eigrp_topology_update_all_node_flags(struct eigrp *);
extern void eigrp_topology_update_node_flags(struct eigrp_prefix_entry *);
-extern int eigrp_topology_update_distance(struct eigrp_fsm_action_message *);
+extern enum metric_change eigrp_topology_update_distance(struct eigrp_fsm_action_message *);
extern void eigrp_update_routing_table(struct eigrp_prefix_entry *);
extern void eigrp_topology_neighbor_down(struct eigrp *,
struct eigrp_neighbor *);
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c
index e0169c514b..68c0b92fd8 100644
--- a/eigrpd/eigrp_update.c
+++ b/eigrpd/eigrp_update.c
@@ -463,7 +463,7 @@ void eigrp_update_send_init(struct eigrp_neighbor *nbr)
struct eigrp_packet *ep;
u_int16_t length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
/* Prepare EIGRP INIT UPDATE header */
if (IS_DEBUG_EIGRP_PACKET(0, RECV))
@@ -497,7 +497,7 @@ void eigrp_update_send_init(struct eigrp_neighbor *nbr)
ep->length, ep->sequence_number, inet_ntoa(ep->dst));
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) {
eigrp_send_packet_reliably(nbr);
@@ -528,7 +528,7 @@ static void eigrp_update_place_on_nbr_queue(struct eigrp_neighbor *nbr,
ep->length, ep->sequence_number, inet_ntoa(ep->dst));
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
}
void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
@@ -546,7 +546,7 @@ void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
struct prefix_ipv4 *dest_addr;
u_int32_t seq_no = nbr->ei->eigrp->sequence_number;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
/* Prepare EIGRP EOT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_UPDATE, nbr->ei, ep->s, EIGRP_EOT_FLAG,
@@ -571,7 +571,7 @@ void eigrp_update_send_EOT(struct eigrp_neighbor *nbr)
seq_no++;
length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
eigrp_packet_header_init(EIGRP_OPC_UPDATE, nbr->ei, ep->s, EIGRP_EOT_FLAG,
seq_no, nbr->recv_sequence_number);
@@ -635,7 +635,7 @@ void eigrp_update_send(struct eigrp_interface *ei)
u_int16_t length = EIGRP_HEADER_LEN;
- ep = eigrp_packet_new(ei->ifp->mtu);
+ ep = eigrp_packet_new(ei->ifp->mtu, NULL);
/* Prepare EIGRP INIT UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_UPDATE, ei, ep->s, 0,
@@ -684,13 +684,9 @@ void eigrp_update_send(struct eigrp_interface *ei)
&& prefix_list_apply(plist_i,
(struct prefix *)dest_addr)
== PREFIX_DENY)) {
- zlog_info("PROC OUT: Skipping");
// pe->reported_metric.delay = EIGRP_MAX_METRIC;
- zlog_info("PROC OUT Prefix: %s",
- inet_ntoa(dest_addr->prefix));
continue;
} else {
- zlog_info("PROC OUT: NENastavujem metriku ");
length += eigrp_add_internalTLV_to_stream(ep->s,
pe);
has_tlv = 1;
@@ -731,7 +727,7 @@ void eigrp_update_send(struct eigrp_interface *ei)
if (nbr->state == EIGRP_NEIGHBOR_UP) {
packet_sent = true;
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) {
eigrp_send_packet_reliably(nbr);
@@ -762,8 +758,6 @@ void eigrp_update_send_all(struct eigrp *eigrp,
pe->req_action &= ~EIGRP_FSM_NEED_UPDATE;
listnode_delete(eigrp->topology_changes_internalIPV4,
pe);
- zlog_debug("UPDATE COUNT: %d",
- eigrp->topology_changes_internalIPV4->count);
}
}
}
@@ -835,7 +829,7 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
}
}
- ep = eigrp_packet_new(nbr->ei->ifp->mtu);
+ ep = eigrp_packet_new(nbr->ei->ifp->mtu, nbr);
/* Prepare EIGRP Graceful restart UPDATE header */
eigrp_packet_header_init(EIGRP_OPC_UPDATE, nbr->ei, ep->s, flags,
@@ -980,7 +974,7 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
ep->length, ep->sequence_number, inet_ntoa(ep->dst));
/*Put packet to retransmission queue*/
- eigrp_fifo_push_head(nbr->retrans_queue, ep);
+ eigrp_fifo_push(nbr->retrans_queue, ep);
if (nbr->retrans_queue->count == 1) {
eigrp_send_packet_reliably(nbr);
diff --git a/nhrpd/nhrp_nhs.c b/nhrpd/nhrp_nhs.c
index 76c591fd79..0bada33502 100644
--- a/nhrpd/nhrp_nhs.c
+++ b/nhrpd/nhrp_nhs.c
@@ -171,7 +171,7 @@ static int nhrp_reg_send_req(struct thread *t)
zb = zbuf_alloc(1400);
hdr = nhrp_packet_push(zb, NHRP_PACKET_REGISTRATION_REQUEST, &nifp->nbma, &if_ad->addr, dst_proto);
- hdr->hop_count = 0;
+ hdr->hop_count = 1;
if (!(if_ad->flags & NHRP_IFF_REG_NO_UNIQUE))
hdr->flags |= htons(NHRP_FLAG_REGISTRATION_UNIQUE);
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index d4b495b20f..829a3f4297 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -66,6 +66,8 @@ struct ospf_if_params {
DECLARE_IF_PARAM(u_char, priority); /* OSPF Interface priority */
/* Enable OSPF on this interface with area if_area */
DECLARE_IF_PARAM(struct in_addr, if_area);
+ u_int32_t if_area_id_fmt;
+
DECLARE_IF_PARAM(u_char, type); /* type of interface */
#define OSPF_IF_ACTIVE 0
#define OSPF_IF_PASSIVE 1
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 13d4780db3..47c4d0078c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -4032,12 +4032,13 @@ DEFUN (show_ip_ospf_neighbor_int,
JSON_STR)
{
struct ospf *ospf;
+ int idx_ifname = 4;
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
- return show_ip_ospf_neighbor_int_common(vty, ospf, 0, argv, uj);
+ return show_ip_ospf_neighbor_int_common(vty, ospf, idx_ifname, argv, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_int,
@@ -4052,6 +4053,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int,
JSON_STR)
{
int idx_number = 3;
+ int idx_ifname = 5;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
@@ -4064,7 +4066,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int,
if (!ospf->oi_running)
return CMD_SUCCESS;
- return show_ip_ospf_neighbor_int_common(vty, ospf, 1, argv, uj);
+ return show_ip_ospf_neighbor_int_common(vty, ospf, idx_ifname, argv, uj);
}
static void show_ip_ospf_nbr_nbma_detail_sub(struct vty *vty,
@@ -4422,12 +4424,13 @@ DEFUN (show_ip_ospf_neighbor_id,
JSON_STR)
{
struct ospf *ospf;
+ int idx_router_id = 4;
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
- return show_ip_ospf_neighbor_id_common(vty, ospf, 0, argv, uj);
+ return show_ip_ospf_neighbor_id_common(vty, ospf, idx_router_id, argv, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_id,
@@ -4442,6 +4445,7 @@ DEFUN (show_ip_ospf_instance_neighbor_id,
JSON_STR)
{
int idx_number = 3;
+ int idx_router_id = 5;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
@@ -4454,7 +4458,7 @@ DEFUN (show_ip_ospf_instance_neighbor_id,
if (!ospf->oi_running)
return CMD_SUCCESS;
- return show_ip_ospf_neighbor_id_common(vty, ospf, 1, argv, uj);
+ return show_ip_ospf_neighbor_id_common(vty, ospf, idx_router_id, argv, uj);
}
static int show_ip_ospf_neighbor_detail_common(struct vty *vty,
@@ -4725,12 +4729,13 @@ DEFUN (show_ip_ospf_neighbor_int_detail,
JSON_STR)
{
struct ospf *ospf;
+ int idx_ifname = 4;
u_char uj = use_json(argc, argv);
if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
- return show_ip_ospf_neighbor_int_detail_common(vty, ospf, 0, argv, uj);
+ return show_ip_ospf_neighbor_int_detail_common(vty, ospf, idx_ifname, argv, uj);
}
DEFUN (show_ip_ospf_instance_neighbor_int_detail,
@@ -4746,6 +4751,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail,
JSON_STR)
{
int idx_number = 3;
+ int idx_ifname = 5;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
@@ -4758,7 +4764,7 @@ DEFUN (show_ip_ospf_instance_neighbor_int_detail,
if (!ospf->oi_running)
return CMD_SUCCESS;
- return show_ip_ospf_neighbor_int_detail_common(vty, ospf, 1, argv, uj);
+ return show_ip_ospf_neighbor_int_detail_common(vty, ospf, idx_ifname, argv, uj);
}
/* Show functions */
@@ -6971,6 +6977,7 @@ DEFUN (ip_ospf_area,
/* enable ospf on this interface with area_id */
SET_IF_PARAM(params, if_area);
params->if_area = area_id;
+ params->if_area_id_fmt = format;
ospf_interface_area_set(ifp);
ospf->if_ospf_cli_count++;
@@ -8312,8 +8319,13 @@ static int config_write_interface(struct vty *vty)
else
vty_out(vty, " ip ospf");
- vty_out(vty, " area %s",
- inet_ntoa(params->if_area));
+
+ size_t buflen = MAX(strlen("4294967295"),
+ strlen("255.255.255.255"));
+ char buf[buflen];
+ area_id2str(buf, sizeof(buf), &params->if_area,
+ params->if_area_id_fmt);
+ vty_out(vty, " area %s", buf);
if (params != IF_DEF_PARAMS(ifp))
vty_out(vty, " %s",
inet_ntoa(rn->p.u.prefix4));
diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c
index 1dfb558f46..bba26662bd 100644
--- a/pimd/pim_bfd.c
+++ b/pimd/pim_bfd.c
@@ -295,31 +295,39 @@ static int pim_bfd_nbr_replay(int command, struct zclient *zclient,
struct listnode *node;
struct listnode *neigh_node;
struct listnode *neigh_nextnode;
+ struct vrf *vrf = NULL;
/* Send the client registration */
bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER);
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) {
- pim_ifp = ifp->info;
+ RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
+ for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf->vrf_id), node, ifp)) {
+ pim_ifp = ifp->info;
- if (!pim_ifp)
- continue;
-
- if (pim_ifp->pim_sock_fd < 0)
- continue;
+ if (!pim_ifp)
+ continue;
- for (ALL_LIST_ELEMENTS(pim_ifp->pim_neighbor_list, neigh_node,
- neigh_nextnode, neigh)) {
- if (!neigh->bfd_info)
+ if (pim_ifp->pim_sock_fd < 0)
continue;
- if (PIM_DEBUG_PIM_TRACE) {
- char str[INET_ADDRSTRLEN];
- pim_inet4_dump("<bfd_nbr?>", neigh->source_addr,
- str, sizeof(str));
- zlog_debug("%s: Replaying Pim Neigh %s to BFD",
- __PRETTY_FUNCTION__, str);
+
+ for (ALL_LIST_ELEMENTS(pim_ifp->pim_neighbor_list,
+ neigh_node, neigh_nextnode,
+ neigh)) {
+ if (!neigh->bfd_info)
+ continue;
+ if (PIM_DEBUG_PIM_TRACE) {
+ char str[INET_ADDRSTRLEN];
+
+ pim_inet4_dump("<bfd_nbr?>",
+ neigh->source_addr,
+ str, sizeof(str));
+ zlog_debug("%s: Replaying Pim Neigh %s to BFD vrf_id %u",
+ __PRETTY_FUNCTION__, str,
+ vrf->vrf_id);
+ }
+ pim_bfd_reg_dereg_nbr(neigh,
+ ZEBRA_BFD_DEST_UPDATE);
}
- pim_bfd_reg_dereg_nbr(neigh, ZEBRA_BFD_DEST_UPDATE);
}
}
return 0;
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index fdc19e6294..3bffaf855b 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -1369,7 +1369,7 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty,
json_object_pim_ifp_add(json_row, ifp);
json_object_int_add(json_row, "pimNeighbors", pim_nbrs);
json_object_int_add(json_row, "pimIfChannels", pim_ifchannels);
- json_object_int_add(json_row, "firstHopRouter", fhr);
+ json_object_int_add(json_row, "firstHopRouterCount", fhr);
json_object_string_add(json_row, "pimDesignatedRouter",
inet_ntoa(pim_ifp->pim_dr_addr));
@@ -7308,11 +7308,12 @@ DEFUN (interface_pim_use_source,
DEFUN (interface_no_pim_use_source,
interface_no_pim_use_source_cmd,
- "no ip pim use-source",
+ "no ip pim use-source [A.B.C.D]",
NO_STR
IP_STR
"pim multicast routing\n"
- "Delete source IP address\n")
+ "Delete source IP address\n"
+ "source ip address\n")
{
return interface_pim_use_src_cmd_worker(vty, "0.0.0.0");
}
@@ -7328,8 +7329,14 @@ DEFUN (ip_pim_bfd,
struct pim_interface *pim_ifp = ifp->info;
struct bfd_info *bfd_info = NULL;
- if (!pim_ifp)
- return CMD_SUCCESS;
+ if (!pim_ifp) {
+ if (!pim_cmd_interface_add(ifp)) {
+ vty_out(vty, "Could not enable PIM SM on interface\n");
+ return CMD_WARNING;
+ }
+ }
+ pim_ifp = ifp->info;
+
bfd_info = pim_ifp->bfd_info;
if (!bfd_info || !CHECK_FLAG(bfd_info->flags, BFD_FLAG_PARAM_CFG))
@@ -7350,8 +7357,10 @@ DEFUN (no_ip_pim_bfd,
VTY_DECLVAR_CONTEXT(interface, ifp);
struct pim_interface *pim_ifp = ifp->info;
- if (!pim_ifp)
- return CMD_SUCCESS;
+ if (!pim_ifp) {
+ vty_out(vty, "Pim not enabled on this interface\n");
+ return CMD_WARNING;
+ }
if (pim_ifp->bfd_info) {
pim_bfd_reg_dereg_all_nbr(ifp, ZEBRA_BFD_DEST_DEREGISTER);
@@ -7379,7 +7388,14 @@ DEFUN (ip_pim_bfd_param,
u_int32_t tx_val;
u_int8_t dm_val;
int ret;
+ struct pim_interface *pim_ifp = ifp->info;
+ if (!pim_ifp) {
+ if (!pim_cmd_interface_add(ifp)) {
+ vty_out(vty, "Could not enable PIM SM on interface\n");
+ return CMD_WARNING;
+ }
+ }
if ((ret = bfd_validate_param(
vty, argv[idx_number]->arg, argv[idx_number_2]->arg,
@@ -8382,6 +8398,54 @@ DEFUN (show_ip_msdp_sa_sg,
return CMD_SUCCESS;
}
+DEFUN (show_ip_msdp_sa_sg_vrf_all,
+ show_ip_msdp_sa_sg_vrf_all_cmd,
+ "show ip msdp vrf all sa [A.B.C.D [A.B.C.D]] [json]",
+ SHOW_STR
+ IP_STR
+ MSDP_STR
+ VRF_CMD_HELP_STR
+ "MSDP active-source information\n"
+ "source or group ip\n"
+ "group ip\n"
+ JSON_STR)
+{
+ u_char uj = use_json(argc, argv);
+ struct vrf *vrf;
+ bool first = true;
+ int idx = 2;
+
+ char *src_ip = argv_find(argv, argc, "A.B.C.D", &idx) ? argv[idx++]->arg
+ : NULL;
+ char *grp_ip = idx < argc && argv_find(argv, argc, "A.B.C.D", &idx)
+ ? argv[idx]->arg
+ : NULL;
+
+ if (uj)
+ vty_out(vty, "{ ");
+ RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name) {
+ if (uj) {
+ if (!first)
+ vty_out(vty, ", ");
+ vty_out(vty, " \"%s\": ", vrf->name);
+ first = false;
+ } else
+ vty_out(vty, "VRF: %s\n", vrf->name);
+
+ if (src_ip && grp_ip)
+ ip_msdp_show_sa_sg(vrf->info, vty, src_ip, grp_ip, uj);
+ else if (src_ip)
+ ip_msdp_show_sa_addr(vrf->info, vty, src_ip, uj);
+ else
+ ip_msdp_show_sa(vrf->info, vty, uj);
+ }
+ if (uj)
+ vty_out(vty, "}\n");
+
+ return CMD_SUCCESS;
+}
+
+
void pim_cmd_init(void)
{
install_node(&pim_global_node, pim_global_config_write); /* PIM_NODE */
@@ -8637,6 +8701,7 @@ void pim_cmd_init(void)
install_element(VIEW_NODE, &show_ip_msdp_sa_detail_cmd);
install_element(VIEW_NODE, &show_ip_msdp_sa_detail_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_msdp_sa_sg_cmd);
+ install_element(VIEW_NODE, &show_ip_msdp_sa_sg_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_msdp_mesh_group_cmd);
install_element(VIEW_NODE, &show_ip_msdp_mesh_group_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_pim_ssm_range_cmd);
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index c91efbd8b6..39f5f2cc4b 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -553,6 +553,9 @@ struct pim_ifchannel *pim_ifchannel_add(struct interface *ifp,
"%s: could not attach upstream (S,G)=%s on interface %s",
__PRETTY_FUNCTION__, pim_str_sg_dump(sg), ifp->name);
+ if (ch->parent)
+ listnode_delete(ch->parent->sources, ch);
+
pim_ifchannel_remove_children(ch);
if (ch->sources)
list_delete(ch->sources);
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index cc90cef3ae..751611479e 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -167,8 +167,9 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
if (PIM_DEBUG_TRACE)
zlog_debug(
- "%s(%s): Delete %s ref count: %d , flags: %d c_oil ref count %d (Pre decrement)",
- __PRETTY_FUNCTION__, name, up->sg_str, up->ref_count,
+ "%s(%s): Delete %s[%s] ref count: %d , flags: %d c_oil ref count %d (Pre decrement)",
+ __PRETTY_FUNCTION__, name, up->sg_str,
+ pim->vrf->name, up->ref_count,
up->flags, up->channel_oil->oil_ref_count);
--up->ref_count;
@@ -948,8 +949,8 @@ void pim_upstream_rpf_genid_changed(struct pim_instance *pim,
pim_addr_dump("<rpf?>", &up->rpf.rpf_addr, rpf_addr_str,
sizeof(rpf_addr_str));
zlog_debug(
- "%s: matching neigh=%s against upstream (S,G)=%s joined=%d rpf_addr=%s",
- __PRETTY_FUNCTION__, neigh_str, up->sg_str,
+ "%s: matching neigh=%s against upstream (S,G)=%s[%s] joined=%d rpf_addr=%s",
+ __PRETTY_FUNCTION__, neigh_str, up->sg_str, pim->vrf->name,
up->join_state == PIM_UPSTREAM_JOINED,
rpf_addr_str);
}
@@ -1106,8 +1107,8 @@ static int pim_upstream_keep_alive_timer(struct thread *t)
if (PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) {
pim_upstream_fhr_kat_expiry(pim, up);
if (PIM_DEBUG_TRACE)
- zlog_debug("kat expired on %s; remove stream reference",
- up->sg_str);
+ zlog_debug("kat expired on %s[%s]; remove stream reference",
+ up->sg_str, pim->vrf->name);
PIM_UPSTREAM_FLAG_UNSET_SRC_STREAM(up->flags);
pim_upstream_del(pim, up, __PRETTY_FUNCTION__);
} else if (PIM_UPSTREAM_FLAG_TEST_SRC_LHR(up->flags)) {
@@ -1334,8 +1335,8 @@ static int pim_upstream_register_stop_timer(struct thread *t)
if (PIM_DEBUG_TRACE) {
char state_str[PIM_REG_STATE_STR_LEN];
- zlog_debug("%s: (S,G)=%s upstream register stop timer %s",
- __PRETTY_FUNCTION__, up->sg_str,
+ zlog_debug("%s: (S,G)=%s[%s] upstream register stop timer %s",
+ __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name,
pim_reg_state2str(up->reg_state, state_str));
}
@@ -1637,8 +1638,8 @@ static void pim_upstream_sg_running(void *arg)
if (up->channel_oil->oil_inherited_rescan) {
if (PIM_DEBUG_TRACE)
zlog_debug(
- "%s: Handling unscanned inherited_olist for %s",
- __PRETTY_FUNCTION__, up->sg_str);
+ "%s: Handling unscanned inherited_olist for %s[%s]",
+ __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name);
pim_upstream_inherited_olist_decide(pim, up);
up->channel_oil->oil_inherited_rescan = 0;
}
@@ -1649,8 +1650,8 @@ static void pim_upstream_sg_running(void *arg)
&& (up->channel_oil->cc.lastused / 100 > 30)) {
if (PIM_DEBUG_TRACE) {
zlog_debug(
- "%s: %s old packet count is equal or lastused is greater than 30, (%ld,%ld,%lld)",
- __PRETTY_FUNCTION__, up->sg_str,
+ "%s[%s]: %s old packet count is equal or lastused is greater than 30, (%ld,%ld,%lld)",
+ __PRETTY_FUNCTION__, up->sg_str, pim->vrf->name,
up->channel_oil->cc.oldpktcnt,
up->channel_oil->cc.pktcnt,
up->channel_oil->cc.lastused / 100);
@@ -1664,8 +1665,8 @@ static void pim_upstream_sg_running(void *arg)
if (!PIM_UPSTREAM_FLAG_TEST_SRC_STREAM(up->flags)) {
if (PIM_DEBUG_TRACE)
zlog_debug(
- "source reference created on kat restart %s",
- up->sg_str);
+ "source reference created on kat restart %s[%s]",
+ up->sg_str, pim->vrf->name);
pim_upstream_ref(up, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM,
__PRETTY_FUNCTION__);