summaryrefslogtreecommitdiff
path: root/proto/bgp/attrs.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2022-09-08 19:41:02 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2022-10-03 20:18:12 +0200
commit54430df953d6c590e5f446530a21d18277eeda56 (patch)
treea3c99a8596c3d864bef40d87ddf8f82f9e9b17e0 /proto/bgp/attrs.c
parent605ff0a0ebdd32b1a98316737c3e65acb528a156 (diff)
BGP: Do not assume that all channels are struct bgp_channel
In principle, the channel list is a list of parent struct proto and can contain general structures of type struct channel, That is useful e.g. for adding MPLS channels to BGP.
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r--proto/bgp/attrs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c
index a56aeb19..1e234b16 100644
--- a/proto/bgp/attrs.c
+++ b/proto/bgp/attrs.c
@@ -1725,6 +1725,10 @@ bgp_preexport(struct channel *C, rte *e)
struct bgp_proto *src = (SRC->proto == &proto_bgp) ? (struct bgp_proto *) SRC : NULL;
struct bgp_channel *c = (struct bgp_channel *) C;
+ /* Ignore non-BGP channels */
+ if (C->channel != &channel_bgp)
+ return -1;
+
/* Reject our routes */
if (src == p)
return -1;
@@ -1922,6 +1926,10 @@ bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old)
struct bgp_prefix *px;
u32 path;
+ /* Ignore non-BGP channels */
+ if (C->channel != &channel_bgp)
+ return;
+
if (new)
{
struct ea_list *attrs = bgp_update_attrs(p, c, new, new->attrs->eattrs, tmp_linpool);