aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2020-02-18 19:03:03 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2020-02-18 19:03:03 +0100
commit89602822e67c710210494275dda5c8f0335a83bd (patch)
treef94bbcb4cbfb15306a9259d0356f0898d573f9b9
parent69ef3b76bc9432f76069ac37319a2d7e59fdfcc7 (diff)
C-Netz: Correct check for valid channel numbers
-rw-r--r--src/cnetz/cnetz.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/cnetz/cnetz.c b/src/cnetz/cnetz.c
index c9b958e..da74bc6 100644
--- a/src/cnetz/cnetz.c
+++ b/src/cnetz/cnetz.c
@@ -273,23 +273,20 @@ int cnetz_create(const char *kanal, enum cnetz_chan_type chan_type, const char *
cnetz_t *cnetz;
int rc;
- if ((atoi(kanal) & 1) && atoi(kanal) < 1 && atoi(kanal) > 1147) {
- PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid.\n", kanal);
+ if ((atoi(kanal) & 1) && (atoi(kanal) < 3 || atoi(kanal) > 1147)) {
+ PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid. For odd channel numbers, use channel 3 ... 1147.\n", kanal);
return -EINVAL;
}
if ((atoi(kanal) & 1) && atoi(kanal) > 947) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You defined an extended frequency channel %s, only newer phones support this!\n", kanal);
}
- if (!(atoi(kanal) & 1) && atoi(kanal) < 2 && atoi(kanal) > 918) {
- PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid.\n", kanal);
+ if (!(atoi(kanal) & 1) && (atoi(kanal) < 4 || atoi(kanal) > 918)) {
+ PDEBUG(DCNETZ, DEBUG_ERROR, "Channel ('Kanal') number %s invalid. For even channel numbers, use channel 4 ... 918.\n", kanal);
return -EINVAL;
}
if (!(atoi(kanal) & 1) && atoi(kanal) > 758) {
PDEBUG(DCNETZ, DEBUG_NOTICE, "You defined an extended frequency %s, only newer phones support this!\n", kanal);
}
- if (atoi(kanal) == 1 || atoi(kanal) == 2) {
- PDEBUG(DCNETZ, DEBUG_NOTICE, "Channel ('Kanal') number %s is specified as 'unused', it might not work!\n", kanal);
- }
/* OgK must be on channel 131 */
if ((chan_type == CHAN_TYPE_OGK || chan_type == CHAN_TYPE_OGK_SPK) && atoi(kanal) != CNETZ_OGK_KANAL) {