mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 22:26:14 +00:00
bgpd/bmp: use bgp packet dump hook
Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
6c29258c96
commit
d35a6c2895
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user