summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-05-10 19:29:01 +0200
committerDavid Lamparter <equinox@diac24.net>2019-07-03 16:59:12 +0200
commit6fd04594bb36321158558326993d00b760d1a51f (patch)
tree5d983d6fe2a08f10d2ae3710b218b2c6e4c0c08d /bgpd
parentbgpd: add & use bgp packet dump hook (diff)
downloadfrr-6fd04594bb36321158558326993d00b760d1a51f.tar.xz
frr-6fd04594bb36321158558326993d00b760d1a51f.zip
bgpd: add packet send hook
Unlike MRT dumps, BMP also provides packets sent by the router. Add another hook for that. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_packet.c6
-rw-r--r--bgpd/bgp_packet.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index da00c7b3f..99522a652 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -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.
*
@@ -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);
diff --git a/bgpd/bgp_packet.h b/bgpd/bgp_packet.h
index 91031589a..e8eacee58 100644
--- a/bgpd/bgp_packet.h
+++ b/bgpd/bgp_packet.h
@@ -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