0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-17 16:48:43 +00:00

BMP: Add station address check

Also, do not initialize it to IPA_NONE4, use regular IPA_NONE.
This commit is contained in:
Ondrej Zajicek 2023-05-30 17:23:56 +02:00
parent 62d8fbdc1c
commit 1e45e2aa4e
2 changed files with 17 additions and 3 deletions

View File

@ -964,6 +964,22 @@ bmp_close_socket(struct bmp_proto *p)
}
static void
bmp_postconfig(struct proto_config *CF)
{
struct bmp_config *cf = (void *) CF;
/* Do not check templates at all */
if (cf->c.class == SYM_TEMPLATE)
return;
if (ipa_zero(cf->station_ip))
cf_error("Station IP address not specified");
if (!cf->station_port)
cf_error("Station port number not specified");
}
/** Configuration handle section **/
static struct proto *
bmp_init(struct proto_config *CF)
@ -1047,6 +1063,7 @@ struct protocol proto_bmp = {
.class = PROTOCOL_BMP,
.proto_size = sizeof(struct bmp_proto),
.config_size = sizeof(struct bmp_config),
.postconfig = bmp_postconfig,
.init = bmp_init,
.start = bmp_start,
.shutdown = bmp_shutdown,

View File

@ -25,9 +25,6 @@ proto: bmp_proto '}' ;
bmp_proto_start: proto_start BMP {
this_proto = proto_config_new(&proto_bmp, $1);
BMP_CFG->local_addr = IPA_NONE4;
BMP_CFG->station_ip = IPA_NONE4;
BMP_CFG->station_port = 0;
BMP_CFG->sys_descr = "Not defined";
BMP_CFG->sys_name = "Not defined";
BMP_CFG->monitoring_rib_in_pre_policy = false;