From 803647e4afbf07e42fc23f7b16bb1640fe43b249 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 12 May 2010 13:51:08 +0000 Subject: NS: Send STATUS or RESET when receiving NS_ALIVE on unknown NSVC --- openbsc/src/gprs/gprs_ns.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'openbsc') diff --git a/openbsc/src/gprs/gprs_ns.c b/openbsc/src/gprs/gprs_ns.c index fd0b27a6..13ea92dd 100644 --- a/openbsc/src/gprs/gprs_ns.c +++ b/openbsc/src/gprs/gprs_ns.c @@ -582,13 +582,25 @@ int gprs_ns_rcvmsg(struct gprs_ns_inst *nsi, struct msgb *msg, uint16_t nsei; /* Only the RESET procedure creates a new NSVC */ if (nsh->pdu_type != NS_PDUT_RESET) { + struct gprs_nsvc fake_nsvc; LOGP(DNS, LOGL_INFO, "Ignoring NS PDU type 0x%0x " "from %s:%u for non-existing NS-VC\n", nsh->pdu_type, inet_ntoa(saddr->sin_addr), ntohs(saddr->sin_port)); - /* FIXME: send STATUS (but we have no NSVC!) */ - //gprs_ns_tx_reset(nsvc, NS_CAUSE_NSVC_UNKNOWN); - return -EIO; + /* Since we have no NSVC, we have to create a fake */ + fake_nsvc.nsvci = fake_nsvc.nsei = 0; + fake_nsvc.nsi = nsi; + fake_nsvc.ip.bts_addr = *saddr; + fake_nsvc.state = NSE_S_ALIVE; +#if 0 + return gprs_ns_tx_status(&fake_nsvc, + NS_CAUSE_PDU_INCOMP_PSTATE, 0, + msg); +#else + /* BS+ Gb implementation ignores STATUS, so we try + * our luck with a RESET incompatible with the spec */ + return gprs_ns_tx_simple(&fake_nsvc, NS_PDUT_RESET); +#endif } rc = tlv_parse(&tp, &ns_att_tlvdef, nsh->data, msgb_l2len(msg), 0, 0); @@ -785,8 +797,6 @@ static int nsip_fd_cb(struct bsc_fd *bfd, unsigned int what) return rc; } - -/* FIXME: this is currently in input/ipaccess.c */ extern int make_sock(struct bsc_fd *bfd, int proto, uint16_t port, int (*cb)(struct bsc_fd *fd, unsigned int what)); -- cgit v1.2.3