Skip to content

Commit

Permalink
bgpd: add packet send hook
Browse files Browse the repository at this point in the history
Unlike MRT dumps, BMP also provides packets sent by the router.  Add
another hook for that.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
  • Loading branch information
eqvinox committed Jul 3, 2019
1 parent 584470f commit 6fd0459
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bgpd/bgp_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ DEFINE_HOOK(bgp_packet_dump,
struct stream *s),
(peer, type, size, s))

DEFINE_HOOK(bgp_packet_send,
(struct peer *peer, uint8_t type, bgp_size_t size,
struct stream *s),
(peer, type, size, s))

/**
* Sets marker and type fields for a BGP message.
*
Expand Down Expand Up @@ -547,6 +552,7 @@ void bgp_open_send(struct peer *peer)

/* Dump packet if debug option is set. */
/* bgp_packet_dump (s); */
hook_call(bgp_packet_send, peer, BGP_MSG_OPEN, stream_get_endp(s), s);

/* Add packet to the peer. */
bgp_packet_add(peer, s);
Expand Down
5 changes: 5 additions & 0 deletions bgpd/bgp_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ DECLARE_HOOK(bgp_packet_dump,
struct stream *s),
(peer, type, size, s))

DECLARE_HOOK(bgp_packet_send,
(struct peer *peer, uint8_t type, bgp_size_t size,
struct stream *s),
(peer, type, size, s))

#define BGP_NLRI_LENGTH 1U
#define BGP_TOTAL_ATTR_LEN 2U
#define BGP_UNFEASIBLE_LEN 2U
Expand Down

0 comments on commit 6fd0459

Please sign in to comment.