diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-05-19 16:48:12 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-05-19 16:48:12 +0200 |
commit | 869aaa401de430933d12e6974b49f2dbfaafa886 (patch) | |
tree | d8f29e35446706469d55eb8489e4794acddfe52b /openbsc | |
parent | 1100a9d1fa38fbd931c7acfacdf1f2fa1d26627e (diff) |
[GPRS] NS: properly parse FR DLCI on Rx
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/src/gprs/gprs_ns_frgre.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/openbsc/src/gprs/gprs_ns_frgre.c b/openbsc/src/gprs/gprs_ns_frgre.c index baa7e521..94f93745 100644 --- a/openbsc/src/gprs/gprs_ns_frgre.c +++ b/openbsc/src/gprs/gprs_ns_frgre.c @@ -56,7 +56,7 @@ static struct msgb *read_nsfrgre_msg(struct bsc_fd *bfd, int *error, struct iphdr *iph; struct gre_hdr *greh; uint8_t *frh; - uint32_t dlci; + uint16_t dlci; if (!msg) { *error = -ENOMEM; @@ -114,25 +114,19 @@ static struct msgb *read_nsfrgre_msg(struct bsc_fd *bfd, int *error, *error = -EIO; goto out_err; } - dlci = (frh[0] & 0xfc << 2); + dlci = ((frh[0] & 0xfc) << 2); if ((frh[1] & 0x0f) != 0x01) { LOGP(DNS, LOGL_NOTICE, "Unknown second FR octet 0x%02x\n", frh[1]); *error = -EIO; goto out_err; } - dlci |= frh[1] >> 4; - if (dlci > 0xffff) { - LOGP(DNS, LOGL_ERROR, "We don't support DLCI > 65535 (%u)\n", - dlci); - *error = -EINVAL; - goto out_err; - } + dlci |= (frh[1] >> 4); msg->l2h = frh+2; /* Store DLCI in NETWORK BYTEORDER in sockaddr port member */ - saddr->sin_port = htons(dlci & 0xffff); + saddr->sin_port = htons(dlci); return msg; |