Error with GtpUserX2

Aperta
#253 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
cpp
Ambito
networking

Direzione di ricerca

Start with src/corenetwork/gtp/GtpUserX2.cc at the referenced insertion point and inspect the length handling in src/corenetwork/gtp/GtpUserMsgSerializer.cc. Compare the existing GTP serializers with the proposed X2HandoverDataMsg serializer, then reproduce the UDP emulation with two GNBs. Done means the setup no longer reports length errors or a missing X2HandoverDataMsg serializer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

In an emulation setup, sending UDP packets, with 2 GNBs, errors occur at the GtpUserMsgSerializer due to not setting the GtpUserMsg length here since it reads the default length of 1B and remainder become <0 here.

I have fixed it by setting gtpMsg->setChunkLenght(B(8)) before inserting and now it seems to work.

In addition, in this setting, errors also occur because there is no X2HandoverDataMsg serializer. I have added a X2HandoverDataMsgSerializer class as below and it fixes it.

using namespace inet;
Register_Serializer(X2HandoverDataMsg, X2HandoverDataMsgSerializer);

void X2HandoverDataMsgSerializer::serialize(inet::MemoryOutputStream &stream,
        const inet::Ptr<const inet::Chunk> &chunk) const {
       auto startPosition = stream.getLength();

        const auto& x2DataMsg = staticPtrCast<const X2HandoverDataMsg>(chunk);

        //We need to write to the stream exactly getChunkLength(), which is 11 for ltex2messages. If we write only 8,  then fill with remainders
        //We cannot write the length because we write 12 bytes and cannot change the ltex2message length

        stream.writeUint24Be(B(x2DataMsg->getChunkLength()).get());

        stream.writeUint32Be(x2DataMsg->getDestinationId());
        stream.writeUint32Be(x2DataMsg->getSourceId());

        int64_t remainders = B(x2DataMsg->getChunkLength() - (stream.getLength() - startPosition)).get();

        if (remainders < 0) {
            throw cRuntimeError("X2HandoverDataMsgSerializer length = %d smaller than required %d bytes", (int)B(x2DataMsg->getChunkLength()).get(), (int)B(stream.getLength() - startPosition).get());
        } else {
            stream.writeByteRepeatedly('?', remainders);
        }
}

const inet::Ptr<inet::Chunk> X2HandoverDataMsgSerializer::deserialize(
        inet::MemoryInputStream &stream) const {
      
       auto startPosition = stream.getPosition();
       auto x2DataMsg = makeShared<X2HandoverDataMsg>();
       B dataLength = B(stream.readUint24Be());

       x2DataMsg->setDestinationId(stream.readUint32Be());
       x2DataMsg->setSourceId(stream.readUint32Be());

       B remainders = dataLength - (stream.getPosition() - startPosition);
       ASSERT(remainders >= B(0));
       if (remainders.get()>=0) {
           stream.readByteRepeatedly('?', B(remainders).get());
       }
       return x2DataMsg;
}

Lingua principale
C++
Stelle
240
Fork
123
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Unipisa/Simu5G

Tutte le issue di Unipisa/Simu5G

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.