aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-09-11 12:55:37 +0200
committerHarald Welte <laforge@osmocom.org>2020-09-11 12:56:18 +0200
commitd5ea3eb9c19c17d5e46ff20681439694006baaa6 (patch)
tree3206ba0ea4702e2eea17839610f063d9c9f4eadd
parent51e12ad60315c2447050ecf97a4a4894777a7fd1 (diff)
src/ctl.c: Log NOTICE messages whenever client send unexpected requests
-rw-r--r--src/ctl.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/ctl.c b/src/ctl.c
index fee96f8..8da21fd 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -360,16 +360,22 @@ _e1d_ctl_ts_open(void *data, struct msgb *msgb, struct msgb *rmsgb, int *rfd)
/* Process query and find timeslot */
intf = e1d_find_intf(e1d, hdr->intf);
- if (!intf)
+ if (!intf) {
+ LOGP(DE1D, LOGL_NOTICE, "Client request for non-existant Interface %u\n", hdr->intf);
return 0;
+ }
line = e1_intf_find_line(intf, hdr->line);
- if (!line)
+ if (!line) {
+ LOGPIF(intf, DE1D, LOGL_NOTICE, "Client request for non-existant line %u\n", hdr->line);
return 0;
+ }
ts = _e1d_get_ts(line, hdr->ts);
- if (!ts)
+ if (!ts) {
+ LOGPLI(line, DE1D, LOGL_NOTICE, "Client request for non-existant ts %u\n", hdr->ts);
return 0;
+ }
/* Select mode */
switch (cfg->mode) {
@@ -380,19 +386,24 @@ _e1d_ctl_ts_open(void *data, struct msgb *msgb, struct msgb *rmsgb, int *rfd)
mode = E1_TS_MODE_HDLCFCS;
break;
default:
+ LOGPTS(ts, DE1D, LOGL_NOTICE, "Client request for unknown mode %u\n", cfg->mode);
return 0;
}
- if (cfg->read_bufsize == 0)
+ if (cfg->read_bufsize == 0) {
+ LOGPTS(ts, DE1D, LOGL_NOTICE, "Client request for invalid bufsize %u\n", cfg->read_bufsize);
return 0;
+ }
/* If already open, close previous */
e1_ts_stop(ts);
/* Init */
ret = _e1d_ts_start(ts, mode, cfg->read_bufsize);
- if (ret < 0)
+ if (ret < 0) {
+ LOGPTS(ts, DE1D, LOGL_ERROR, "Unable to start timeslot: %d\n", ret);
return ret;
+ }
*rfd = ret;