summaryrefslogtreecommitdiff
path: root/proto/bmp/bmp.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2023-05-30 17:23:56 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-05-30 17:23:56 +0200
commit1e45e2aa4e173869be071bfa28057d8b52e8948c (patch)
tree0def5026b349a66ac4060bf1efcbeb27bd249cd2 /proto/bmp/bmp.c
parent62d8fbdc1cb3d358b0d20d7b10bd3f17f357d567 (diff)
BMP: Add station address check
Also, do not initialize it to IPA_NONE4, use regular IPA_NONE.
Diffstat (limited to 'proto/bmp/bmp.c')
-rw-r--r--proto/bmp/bmp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/proto/bmp/bmp.c b/proto/bmp/bmp.c
index 7efa8f6a..fce9a0a1 100644
--- a/proto/bmp/bmp.c
+++ b/proto/bmp/bmp.c
@@ -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,