diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-05-25 16:21:35 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2014-07-31 16:58:26 +0200 |
commit | 0655cac6f1fbb0a669f064780a171a363ce8ef83 (patch) | |
tree | 17bda895ab0b476e73d74e9fdb6deb21dd38689b /src/osmo-bts-sysmo/oml_router.c | |
parent | b05d72d21b8cc91126cf45525f9010df6142e1c2 (diff) |
sysmobts: Verify the structure of IPA and OML messages
Extend the router to verify that the message received is
properly encoded. The code can deal with the basic structure
of ETSI OML and vendor specific messages for ip.access and
the osmocom project.
Diffstat (limited to 'src/osmo-bts-sysmo/oml_router.c')
-rw-r--r-- | src/osmo-bts-sysmo/oml_router.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/osmo-bts-sysmo/oml_router.c b/src/osmo-bts-sysmo/oml_router.c index 64b36840..4af20d50 100644 --- a/src/osmo-bts-sysmo/oml_router.c +++ b/src/osmo-bts-sysmo/oml_router.c @@ -24,6 +24,7 @@ #include <osmo-bts/bts.h> #include <osmo-bts/logging.h> #include <osmo-bts/oml.h> +#include <osmo-bts/msg_utils.h> #include <osmocom/core/socket.h> #include <osmocom/core/select.h> @@ -51,9 +52,22 @@ static int oml_router_read_cb(struct osmo_fd *fd, unsigned int what) goto err; } - msgb_put(msg, rc); + msg->l1h = msgb_put(msg, rc); + rc = msg_verify_ipa_structure(msg); + if (rc < 0) { + LOGP(DL1C, LOGL_ERROR, + "OML Router: Invalid IPA message rc(%d)\n", rc); + goto err; + } + + rc = msg_verify_oml_structure(msg); + if (rc < 0) { + LOGP(DL1C, LOGL_ERROR, + "OML Router: Invalid OML message rc(%d)\n", rc); + goto err; + } - /* todo analyze and dispatch message */ + /* todo dispatch message */ err: msgb_free(msg); |