rohitashokchaudhari / jss7

Automatically exported from code.google.com/p/jss7
0 stars 0 forks source link

returnLastResult sendRoutingInfoForSM V3 mwd-Set issue + bugfix #335

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Version: 2.0.0.FINAL

When receiving a sendRoutingInfoForSM V3 from the network and returning the 
response I've noticed that parameter 0x02 was returned which caused some SMSCs 
to not send the forwardSM, since they consider the response to be invalid:

Transaction Capabilities Application Part
    end
        Destination Transaction ID
            dtid: 0617ab1f
        components: 1 item
            Component: returnResultLast (2)
                returnResultLast
                    invokeID: 0
                    resultretres
                        opCode: localValue (0)
                            localValue: 45
                        CONSTRUCTOR
                            CONSTRUCTOR Tag
                            Tag: 0x00
                            Length: 24
                            Parameter (0x04)
                                Tag: 0x04
                                Length: 8
                            Data: 72
                            CONSTRUCTOR
                                CONSTRUCTOR Tag
                                Tag: 0x02
                                Length: 9
                                Parameter (0x01)
                                    Tag: 0x01
                                    Length: 7
                                Data: 91
                            Parameter (0x02)
                                Tag: 0x02
                                Length: 1
                            Data: 00

This 0x02 is the mwd-Set parameter and is not valid for V3:

V1:
RoutingInfoForSM-Res::= SEQUENCE {
    imsi            IMSI,
    locationInfoWithLMSI        [0] LocationInfoWithLMSI,
    mwd-Set     [2] BOOLEAN OPTIONAL,
    ...}

V3:
RoutingInfoForSM-Res ::= SEQUENCE {
        imsi                    IMSI,
        locationInfoWithLMSI    [0] LocationInfoWithLMSI,
        extensionContainer      [4] ExtensionContainer  OPTIONAL,
        ...} 

Diving into the code I found the following piece of code:

SendRoutingInfoForSMResponseImpl.java#237

237        if (this.mwdSet != null)
238            try {
239                asnOs.writeBoolean(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_mwdSet, 
this.mwdSet);
240            } catch (IOException e) {
241                throw new MAPException("IOException when encoding " + 
_PrimitiveName + ": " + e.getMessage(), e);
242            } catch (AsnException e) {
243                throw new MAPException("AsnException when encoding " + 
_PrimitiveName + ": " + e.getMessage(), e);
244            }

Since there are no encapsulating parentheses (i.e. { } ) on the if-statement it 
will always write the mdw-Set parameter regardless whether this.mwdSet is null 
or not, simply adding parentheses will fix this bug:

237        if (this.mwdSet != null) {
238            try {
239                asnOs.writeBoolean(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_mwdSet, 
this.mwdSet);
240            } catch (IOException e) {
241                throw new MAPException("IOException when encoding " + 
_PrimitiveName + ": " + e.getMessage(), e);
242            } catch (AsnException e) {
243                throw new MAPException("AsnException when encoding " + 
_PrimitiveName + ": " + e.getMessage(), e);
244            }
245       }

Original issue reported on code.google.com by mvdvl...@gmail.com on 7 Oct 2014 at 12:01