The BSC/MS will send a Hello packet that includes the version number,
make LCR verify this version number and close the socket in case it
does not match a supported version.
int rc;
static char buf[sizeof(struct gsm_mncc)+1024];
struct gsm_mncc *mncc_prim = (struct gsm_mncc *) buf;
int rc;
static char buf[sizeof(struct gsm_mncc)+1024];
struct gsm_mncc *mncc_prim = (struct gsm_mncc *) buf;
+ struct gsm_mncc_hello *hello = (struct gsm_mncc_hello *) buf;
memset(buf, 0, sizeof(buf));
rc = recv(lfd->fd, buf, sizeof(buf), 0);
memset(buf, 0, sizeof(buf));
rc = recv(lfd->fd, buf, sizeof(buf), 0);
+ /* TODO: size check? */
+ switch (mncc_prim->msg_type) {
+ case MNCC_SOCKET_HELLO:
+ if (hello->version != MNCC_SOCK_VERSION) {
+ PERROR("MNCC version different. BSC version is %u\n", hello->version);
+ mncc_fd_close(lcr_gsm, lfd);
+ return 0;
+ }
+ break;
+ }
+
/* Hand the MNCC message into LCR */
switch (lcr_gsm->type) {
#ifdef WITH_GSM_BS
/* Hand the MNCC message into LCR */
switch (lcr_gsm->type) {
#ifdef WITH_GSM_BS
#define GSM_TCH_FRAME_AMR 0x0303
#define GSM_BAD_FRAME 0x03ff
#define GSM_TCH_FRAME_AMR 0x0303
#define GSM_BAD_FRAME 0x03ff
+#define MNCC_SOCKET_HELLO 0x0400
+
#define GSM_MAX_FACILITY 128
#define GSM_MAX_SSVERSION 128
#define GSM_MAX_USERUSER 128
#define GSM_MAX_FACILITY 128
#define GSM_MAX_SSVERSION 128
#define GSM_MAX_USERUSER 128
+#define MNCC_SOCK_VERSION 1
+struct gsm_mncc_hello {
+ u_int32_t msg_type;
+ u_int32_t version;
+};