summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_bmp.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2019-04-24 17:19:09 +0200
committerDavid Lamparter <equinox@diac24.net>2019-08-30 19:00:45 +0200
commitd35a6c28954b0f6128998f30f703746a63610393 (patch)
tree82ee955fdc0394571f418aec1637e4fb25c84409 /bgpd/bgp_bmp.c
parentbgpd/bmp: Initial BMP implementation. (diff)
downloadfrr-d35a6c28954b0f6128998f30f703746a63610393.tar.xz
frr-d35a6c28954b0f6128998f30f703746a63610393.zip
bgpd/bmp: use bgp packet dump hook
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'bgpd/bgp_bmp.c')
-rw-r--r--bgpd/bgp_bmp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c
index 16e123341..bdc599ab0 100644
--- a/bgpd/bgp_bmp.c
+++ b/bgpd/bgp_bmp.c
@@ -40,6 +40,7 @@
#include "bgpd/bgp_attr.h"
#include "bgpd/bgp_dump.h"
#include "bgpd/bgp_errors.h"
+#include "bgpd/bgp_packet.h"
#include "bgpd/bgp_bmp.h"
int accept_sock = -1;
@@ -272,7 +273,8 @@ static int bmp_send_peerup(struct bmp *bmp)
return 0;
}
-void bmp_mirror_packet(struct peer *peer, struct stream *packet)
+static int bmp_mirror_packet(struct peer *peer, uint8_t type, bgp_size_t size,
+ struct stream *packet)
{
struct bmp *bmp;
int len;
@@ -280,7 +282,7 @@ void bmp_mirror_packet(struct peer *peer, struct stream *packet)
bmp = bmp_default;
if (!bmp)
- return;
+ return 0;
s = stream_new(BGP_MAX_PACKET_SIZE);
@@ -300,6 +302,7 @@ void bmp_mirror_packet(struct peer *peer, struct stream *packet)
stream_fifo_push(bmp->obuf, s);
bmp_send_packets(bmp);
+ return 0;
}
static int bmp_event(struct thread *thread)
@@ -513,6 +516,8 @@ void bmp_serv_sock(const char *hostname, unsigned short port)
void bgp_bmp_init()
{
+ hook_register(bgp_packet_dump, bmp_mirror_packet);
+
bmp_serv_sock("localhost", 60000);
}