summaryrefslogtreecommitdiff
path: root/nest/proto.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2017-04-25 19:02:31 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2017-04-25 19:02:31 +0200
commitb29499996bbc1612a63a7e715bb53a8abf0940e3 (patch)
tree2cda557718d08df68f0be9f5b05283bedeeb71b1 /nest/proto.c
parent6f535924ebbb5a08d96c4a8d0cf0984b130a0995 (diff)
Nest: Update of show route cmd
Some code cleanup, multiple bugfixes, allows to specify also channel for 'show route export'. Interesting how such apparenty simple thing like show route cmd has plenty of ugly corner cases.
Diffstat (limited to 'nest/proto.c')
-rw-r--r--nest/proto.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/nest/proto.c b/nest/proto.c
index 0a7a32a6..3d764df0 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -105,6 +105,25 @@ proto_find_channel_by_table(struct proto *p, struct rtable *t)
}
/**
+ * proto_find_channel_by_name - find channel by its name
+ * @p: protocol instance
+ * @n: channel name
+ *
+ * Returns pointer to channel or NULL
+ */
+struct channel *
+proto_find_channel_by_name(struct proto *p, const char *n)
+{
+ struct channel *c;
+
+ WALK_LIST(c, p->channels)
+ if (!strcmp(c->name, n))
+ return c;
+
+ return NULL;
+}
+
+/**
* proto_add_channel - connect protocol to a routing table
* @p: protocol instance
* @cf: channel configuration