summaryrefslogtreecommitdiffstats
path: root/bgpd
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
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')
-rw-r--r--bgpd/bgp_bmp.c9
-rw-r--r--bgpd/bgp_bmp.h1
-rw-r--r--bgpd/bgp_packet.c3
3 files changed, 7 insertions, 6 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);
}
diff --git a/bgpd/bgp_bmp.h b/bgpd/bgp_bmp.h
index c3736916c..54365c0f0 100644
--- a/bgpd/bgp_bmp.h
+++ b/bgpd/bgp_bmp.h
@@ -64,7 +64,6 @@ struct bmp
&(X)->t_event); \
} while (0)
-extern void bmp_mirror_packet(struct peer *peer, struct stream *packet);
extern void bmp_serv_sock(const char *hostname, unsigned short port);
extern void bgp_bmp_init(void);
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 1014dccf6..cd94f421e 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -2256,9 +2256,6 @@ int bgp_process_packet(struct thread *thread)
hook_call(bgp_packet_dump, peer, type, size, peer->curr);
- /* BGP Monitoring Protocol: mirroring. */
- bmp_mirror_packet(peer, peer->curr);
-
/* adjust size to exclude the marker + length + type */
size -= BGP_HEADER_SIZE;