Commit 59e9b106 authored by Pawel Maslanka's avatar Pawel Maslanka Committed by Ondrej Zajicek (work)
Browse files

BMP protocol support

Initial implementation of a basic subset of the BMP (BGP Monitoring
Protocol, RFC 7854) from Akamai team. Submitted for further review
and improvement.
parent a06469d9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ if test "$enable_mpls_kernel" != no ; then
  fi
fi

all_protocols="$proto_bfd babel bgp mrt ospf perf pipe radv rip rpki static"
all_protocols="$proto_bfd babel bgp bmp mrt ospf perf pipe radv rip rpki static"

all_protocols=`echo $all_protocols | sed 's/ /,/g'`

@@ -315,6 +315,7 @@ fi
AH_TEMPLATE([CONFIG_BABEL], 	[Babel protocol])
AH_TEMPLATE([CONFIG_BFD],	[BFD protocol])
AH_TEMPLATE([CONFIG_BGP],	[BGP protocol])
AH_TEMPLATE([CONFIG_BMP],	[BMP protocol])
AH_TEMPLATE([CONFIG_MRT],	[MRT protocol])
AH_TEMPLATE([CONFIG_OSPF],	[OSPF protocol])
AH_TEMPLATE([CONFIG_PIPE],	[Pipe protocol])
+4 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ enum protocol_class {
  PROTOCOL_BABEL,
  PROTOCOL_BFD,
  PROTOCOL_BGP,
  PROTOCOL_BMP,
  PROTOCOL_DEVICE,
  PROTOCOL_DIRECT,
  PROTOCOL_KERNEL,
@@ -103,7 +104,7 @@ void protos_dump_all(void);
extern struct protocol
  proto_device, proto_radv, proto_rip, proto_static, proto_mrt,
  proto_ospf, proto_perf,
  proto_pipe, proto_bgp, proto_bfd, proto_babel, proto_rpki;
  proto_pipe, proto_bgp, proto_bmp, proto_bfd, proto_babel, proto_rpki;

/*
 *	Routing Protocol Instance
@@ -214,6 +215,8 @@ struct proto {
  void (*if_notify)(struct proto *, unsigned flags, struct iface *i);
  void (*ifa_notify)(struct proto *, unsigned flags, struct ifa *a);
  void (*rt_notify)(struct proto *, struct channel *, struct network *net, struct rte *new, struct rte *old);
  void (*rte_update_in_notify)(const struct proto *, const struct channel *,
    const net *net, const struct rte *new, const struct rte *old, const struct rte_src *src);
  void (*neigh_notify)(struct neighbor *neigh);
  void (*make_tmp_attrs)(struct rte *rt, struct linpool *pool);
  void (*store_tmp_attrs)(struct rte *rt, struct linpool *pool);
+17 −0
Original line number Diff line number Diff line
@@ -2542,6 +2542,12 @@ rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *sr
	if (old->flags & (REF_STALE | REF_DISCARD | REF_MODIFY))
	{
	  old->flags &= ~(REF_STALE | REF_DISCARD | REF_MODIFY);

    if (c->proto->rte_update_in_notify)
    {
      c->proto->rte_update_in_notify(c->proto, c, net, new, old, src);
    }

	  return 1;
	}

@@ -2565,6 +2571,11 @@ rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *sr
    if (!old)
      goto drop_withdraw;

    if (c->proto->rte_update_in_notify)
    {
      c->proto->rte_update_in_notify(c->proto, c, net, new, old, src);
    }

    return 1;
  }

@@ -2593,6 +2604,12 @@ rte_update_in(struct channel *c, const net_addr *n, rte *new, struct rte_src *sr
  e->next = *pos;
  *pos = e;
  tab->rt_count++;

  if (c->proto->rte_update_in_notify)
  {
    c->proto->rte_update_in_notify(c->proto, c, net, new, old, src);
  }

  return 1;

drop_update:
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ H Protocols
C babel
C bfd
C bgp
C bmp
C ospf
C pipe
C radv
+7 −1
Original line number Diff line number Diff line
@@ -1122,6 +1122,13 @@ bgp_attr_known(uint code)
  return (code < ARRAY_SIZE(bgp_attr_table)) && bgp_attr_table[code].name;
}

void bgp_fix_attr_flags(ea_list *attrs)
{
  for (u8 i = 0; i < attrs->count; i++)
  {
    attrs->attrs[i].flags = bgp_attr_table[EA_ID(attrs->attrs[i].id)].flags;
  }
}

/*
 *	Attribute export
@@ -1863,7 +1870,6 @@ bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old)
  bgp_schedule_packet(p->conn, c, PKT_UPDATE);
}


static inline u32
bgp_get_neighbor(rte *r)
{
Loading