vty: Fix 'show message' not finding expired messages

Change-Id: I23523876f1df167e8afd730b2164f133c2776085
This commit is contained in:
Pau Espin 2022-07-25 16:08:47 +02:00
parent 56d1ef3b52
commit 93a588ba60
3 changed files with 15 additions and 1 deletions

View File

@ -102,6 +102,7 @@ struct cbc_message *cbc_message_alloc(void *ctx, const struct cbc_message *cbcms
int cbc_message_new(const struct cbc_message *cbcmsg, struct rest_it_op *op);
void cbc_message_delete(struct cbc_message *cbcmsg, struct rest_it_op *op);
struct cbc_message *cbc_message_by_id(uint16_t message_id);
struct cbc_message *cbc_message_expired_by_id(uint16_t message_id);
int peer_new_cbc_message(struct cbc_peer *peer, struct cbc_message *cbcmsg);
int cbc_message_del_peer(struct cbc_message *cbcmsg, struct cbc_peer *peer);

View File

@ -205,8 +205,11 @@ DEFUN(show_message_cbs, show_message_cbs_cmd,
const struct smscb_message *smscb;
struct cbc_message_peer *msg_peer;
char *timestr;
uint16_t msgid = atoi(argv[0]);
cbc_msg = cbc_message_by_id(atoi(argv[0]));
cbc_msg = cbc_message_by_id(msgid);
if (!cbc_msg)
cbc_msg = cbc_message_expired_by_id(msgid);
if (!cbc_msg) {
vty_out(vty, "Unknown Messsage ID %s%s", argv[0], VTY_NEWLINE);
return CMD_WARNING;

View File

@ -235,3 +235,13 @@ struct cbc_message *cbc_message_by_id(uint16_t message_id)
}
return NULL;
}
struct cbc_message *cbc_message_expired_by_id(uint16_t message_id)
{
struct cbc_message *cbc_msg;
llist_for_each_entry(cbc_msg, &g_cbc->expired_messages, list) {
if (cbc_msg->msg.message_id == message_id)
return cbc_msg;
}
return NULL;
}