diff options
author | David Lamparter <equinox@diac24.net> | 2019-04-24 17:19:09 +0200 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2019-07-03 16:58:26 +0200 |
commit | 584470fb5fc611580367ff2cf15b3ab8e07ef92c (patch) | |
tree | 4c88b591ccb863646811daa7465de7f1aaa97d25 /bgpd/bgp_dump.c | |
parent | bgpd: add instance delete & config write hooks (diff) | |
download | frr-584470fb5fc611580367ff2cf15b3ab8e07ef92c.tar.xz frr-584470fb5fc611580367ff2cf15b3ab8e07ef92c.zip |
bgpd: add & use bgp packet dump hook
The MRT dump code is already hooked in at the right places to write out
packets; the BMP code needs exactly the same access so let's make this
a hook.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_dump.c')
-rw-r--r-- | bgpd/bgp_dump.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 751140850..d12c0b6c7 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -37,6 +37,7 @@ #include "bgpd/bgp_attr.h" #include "bgpd/bgp_dump.h" #include "bgpd/bgp_errors.h" +#include "bgpd/bgp_packet.h" enum bgp_dump_type { BGP_DUMP_ALL, @@ -555,7 +556,8 @@ static void bgp_dump_packet_func(struct bgp_dump *bgp_dump, struct peer *peer, } /* Called from bgp_packet.c when BGP packet is received. */ -void bgp_dump_packet(struct peer *peer, int type, struct stream *packet) +static int bgp_dump_packet(struct peer *peer, uint8_t type, bgp_size_t size, + struct stream *packet) { /* bgp_dump_all. */ bgp_dump_packet_func(&bgp_dump_all, peer, packet); @@ -563,6 +565,7 @@ void bgp_dump_packet(struct peer *peer, int type, struct stream *packet) /* bgp_dump_updates. */ if (type == BGP_MSG_UPDATE) bgp_dump_packet_func(&bgp_dump_updates, peer, packet); + return 0; } static unsigned int bgp_dump_parse_time(const char *str) @@ -862,6 +865,8 @@ void bgp_dump_init(void) install_element(CONFIG_NODE, &dump_bgp_all_cmd); install_element(CONFIG_NODE, &no_dump_bgp_all_cmd); + + hook_register(bgp_packet_dump, bgp_dump_packet); } void bgp_dump_finish(void) |