Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spaces are stripped from SNMP OctetStrings. #43

Open
ctdearborn opened this issue Aug 25, 2015 · 7 comments
Open

spaces are stripped from SNMP OctetStrings. #43

ctdearborn opened this issue Aug 25, 2015 · 7 comments
Assignees
Labels

Comments

@ctdearborn
Copy link

Spaces are being stripped from SNMP strings.
For example:

  • Snmp11 iso.3.6.1.2.1.1.6.0 OctetString "RSC: Calgary DOCSIS"; /\* TLV: [11]*/

    after compiling then de-compiling becomes:

  • Snmp11 iso.3.6.1.2.1.1.6.0 OctetString "RSC:CalgaryDOCSIS"; /\* TLV: [11]*/
  • @ctdearborn ctdearborn changed the title spaces are stripped from SNMP Octettrings. spaces are stripped from SNMP OctetStrings. Aug 25, 2015
    @ctdearborn
    Copy link
    Author

    Also, de-compiling binary files with spaces in an Octetstring results in the following output:

    $ oscar -d -i /tftpboot/CM-Data/64-55-b1-d1-81-c3\ (15)
    /* OSCAR -> OpenSource Cable modem file AssembleR v2.1.3.1pre */
    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    Caused by: java.lang.IllegalArgumentException: DataTypeFormatConversion.byteArrayToMacAddress() ByteArray Must be a Multiple of 6 Bytes: ByteLength: 17
    at com.comcast.oscar.datatype.DataTypeFormatConversion.byteArrayToMacAddressFormat(DataTypeFormatConversion.java:650)
    at com.comcast.oscar.tlv.TlvDisassemble.loadTlvValuesIntoTlvDictionary(TlvDisassemble.java:709)
    at com.comcast.oscar.tlv.TlvDisassemble.loadTlvValuesIntoTlvDictionary(TlvDisassemble.java:400)
    at com.comcast.oscar.tlv.TlvDisassemble.loadTlvValuesIntoTlvDictionary(TlvDisassemble.java:390)
    at com.comcast.oscar.tlv.TlvDisassemble.loadTlvValuesIntoTlvDictionary(TlvDisassemble.java:390)
    at com.comcast.oscar.tlv.TlvDisassemble.loadTlvValuesIntoTlvDictionary(TlvDisassemble.java:461)
    at com.comcast.oscar.tlv.TlvDisassemble.getTlvDictionary(TlvDisassemble.java:268)
    at com.comcast.oscar.configurationfile.ConfigurationFileExport.tlvToDictionary(ConfigurationFileExport.java:1013)
    at com.comcast.oscar.configurationfile.ConfigurationFileExport.(ConfigurationFileExport.java:196)
    at com.comcast.oscar.cli.CommandRun.decompile(CommandRun.java:337)
    at com.comcast.oscar.cli.CommandRun.run(CommandRun.java:215)
    at com.comcast.oscar.cli.Main.main(Main.java:50)
    ... 5 more

    @mgarcia01752 mgarcia01752 self-assigned this Aug 25, 2015
    @mgarcia01752
    Copy link
    Collaborator

    Can you do a HexDump of the input file that is causing the above error and post it in the issues.

    @ctdearborn
    Copy link
    Author

    It actually looks like it's something else that's causing the error, so I'm going to track that down some more (the original binary was created with a different compiler, no guarantee this isn't a bug with that compiler). I used a third compiler to create a new file from scratch, and I can decode (using oscar) with spaces intact, but when I encode (with oscar), the spaces get stripped.

    @mgarcia01752
    Copy link
    Collaborator

    I will look into the spaces issue and treat the compiler error as a different issue, if it is a real issue.

    @ctdearborn
    Copy link
    Author

    Found the reason for the compiler error. The compiler I used to create the original file was not padding the file with zero's. Let me know if you'd like more detail, but not a failing of the OSCAR compiler. The only thing would be for oscar to gracefully fail in this situation, but it shouldn't happen that often. :)

    @mgarcia01752
    Copy link
    Collaborator

    Can you paste the hexdump of the Input file.

    @ctdearborn
    Copy link
    Author

    Input file:

    Docsis{
    Snmp11 iso.3.6.1.2.1.1.6.0 OctetString "Docsis LAB 1"; /* TLV: [11]/
    NetworkAccess 1; /
    TLV: [3]/
    MaxCPEAllowed 2; /
    TLV: [18]/
    PrivacyEnable 1; /
    TLV: [29]/
    DownstreamServiceFlow {
    ServiceFlowReference 11; /
    TLV: [25.1]/
    QualityOfServiceParameterSetType 07; /
    TLV: [25.6]/
    TrafficPriority 0; /
    TLV: [25.7]/
    MaxSubstainedTrafficRate 5120000; /
    TLV: [25.8]/
    MaxTrafficBurst 1522; /
    TLV: [25.9]/
    TimeoutForActiveQoS 0; /
    TLV: [25.12]/
    TimeoutForAdmittedQoS 0; /
    TLV: [25.13]/
    TimeoutForAdmittedQoS 0; /
    TLV: [25.14]/
    }
    UpstreamServiceFlow {
    ServiceFlowReference 21; /
    TLV: [24.1]/
    QualityOfServiceParameterSetType 07; /
    TLV: [24.6]/
    TrafficPriority 0; /
    TLV: [24.7]/
    MaxSubstainedTrafficRate 536200; /
    TLV: [24.8]/
    MaxTrafficBurst 3044; /
    TLV: [24.9]/
    TimeoutForActiveQoS 0; /
    TLV: [24.12]/
    TimeoutForAdmittedQoS 200; /
    TLV: [24.13]/
    MaxConcatenatedBurst 3044; /
    TLV: [24.14]/
    SchedulingType 2; /
    TLV: [24.15]/
    RequestTransmissionPolicy (00000000)(00000000)(00000000)(10000000); /
    TLV: [24.16]/
    }
    CmMic D2:1B:2E:73:9F:EC:95:B4:63:44:F6:70:59:3F:A1:D7; /
    TLV: [6]/
    CmtsMic 1A:21:22:B0:50:3B:6B:32:BB:6A:66:03:5D:80:1C:C7; /
    TLV: [7]*/
    }

    hexdump of input file:

    00000000 20 44 6f 63 73 69 73 7b 0a 09 20 53 6e 6d 70 31 | Docsis{.. Snmp1|
    00000010 31 20 69 73 6f 2e 33 2e 36 2e 31 2e 32 2e 31 2e |1 iso.3.6.1.2.1.|
    00000020 31 2e 36 2e 30 20 4f 63 74 65 74 53 74 72 69 6e |1.6.0 OctetStrin|
    00000030 67 20 22 44 6f 63 73 69 73 20 4c 41 42 20 31 22 |g "Docsis LAB 1"|
    00000040 3b 09 20 2f 2a 20 54 4c 56 3a 20 5b 31 31 5d 2a |;. /* TLV: [11]|
    00000050 2f 0a 09 20 4e 65 74 77 6f 72 6b 41 63 63 65 73 |/.. NetworkAcces|
    00000060 73 20 31 3b 09 20 2f 2a 20 54 4c 56 3a 20 5b 33 |s 1;. /
    TLV: [3|
    00000070 5d 2a 2f 0a 09 20 4d 61 78 43 50 45 41 6c 6c 6f |]/.. MaxCPEAllo|
    00000080 77 65 64 20 32 3b 09 20 2f 2a 20 54 4c 56 3a 20 |wed 2;. /
    TLV: |
    00000090 5b 31 38 5d 2a 2f 0a 09 20 50 72 69 76 61 63 79 |[18]/.. Privacy|
    000000a0 45 6e 61 62 6c 65 20 31 3b 09 20 2f 2a 20 54 4c |Enable 1;. /
    TL|
    000000b0 56 3a 20 5b 32 39 5d 2a 2f 0a 09 20 44 6f 77 6e |V: [29]/.. Down|
    000000c0 73 74 72 65 61 6d 53 65 72 76 69 63 65 46 6c 6f |streamServiceFlo|
    000000d0 77 09 7b 0a 09 09 20 53 65 72 76 69 63 65 46 6c |w.{... ServiceFl|
    000000e0 6f 77 52 65 66 65 72 65 6e 63 65 20 31 31 3b 09 |owReference 11;.|
    000000f0 20 2f 2a 20 54 4c 56 3a 20 5b 32 35 2e 31 5d 2a | /
    TLV: [25.1]|
    00000100 2f 0a 09 09 20 51 75 61 6c 69 74 79 4f 66 53 65 |/... QualityOfSe|
    00000110 72 76 69 63 65 50 61 72 61 6d 65 74 65 72 53 65 |rviceParameterSe|
    00000120 74 54 79 70 65 20 30 37 3b 09 20 2f 2a 20 54 4c |tType 07;. /
    TL|
    00000130 56 3a 20 5b 32 35 2e 36 5d 2a 2f 0a 09 09 20 54 |V: [25.6]/... T|
    00000140 72 61 66 66 69 63 50 72 69 6f 72 69 74 79 20 30 |rafficPriority 0|
    00000150 3b 09 20 2f 2a 20 54 4c 56 3a 20 5b 32 35 2e 37 |;. /
    TLV: [25.7|
    00000160 5d 2a 2f 0a 09 09 20 4d 61 78 53 75 62 73 74 61 |]/... MaxSubsta|
    00000170 69 6e 65 64 54 72 61 66 66 69 63 52 61 74 65 20 |inedTrafficRate |
    00000180 35 31 32 30 30 30 30 3b 09 20 2f 2a 20 54 4c 56 |5120000;. /
    TLV|
    00000190 3a 20 5b 32 35 2e 38 5d 2a 2f 0a 09 09 20 4d 61 |: [25.8]/... Ma|
    000001a0 78 54 72 61 66 66 69 63 42 75 72 73 74 20 31 35 |xTrafficBurst 15|
    000001b0 32 32 3b 09 20 2f 2a 20 54 4c 56 3a 20 5b 32 35 |22;. /
    TLV: [25|
    000001c0 2e 39 5d 2a 2f 0a 09 09 20 54 69 6d 65 6f 75 74 |.9]/... Timeout|
    000001d0 46 6f 72 41 63 74 69 76 65 51 6f 53 20 30 3b 09 |ForActiveQoS 0;.|
    000001e0 20 2f 2a 20 54 4c 56 3a 20 5b 32 35 2e 31 32 5d | /
    TLV: [25.12]|
    000001f0 2a 2f 0a 09 09 20 54 69 6d 65 6f 75 74 46 6f 72 |/... TimeoutFor|
    00000200 41 64 6d 69 74 74 65 64 51 6f 53 20 30 3b 09 20 |AdmittedQoS 0;. |
    00000210 2f 2a 20 54 4c 56 3a 20 5b 32 35 2e 31 33 5d 2a |/
    TLV: [25.13]|
    00000220 2f 0a 09 09 20 54 69 6d 65 6f 75 74 46 6f 72 41 |/... TimeoutForA|
    00000230 64 6d 69 74 74 65 64 51 6f 53 20 30 3b 09 20 2f |dmittedQoS 0;. /|
    00000240 2a 20 54 4c 56 3a 20 5b 32 35 2e 31 34 5d 2a 2f |
    TLV: [25.14]/|
    00000250 0a 09 7d 0a 09 20 55 70 73 74 72 65 61 6d 53 65 |..}.. UpstreamSe|
    00000260 72 76 69 63 65 46 6c 6f 77 09 7b 0a 09 09 20 53 |rviceFlow.{... S|
    00000270 65 72 76 69 63 65 46 6c 6f 77 52 65 66 65 72 65 |erviceFlowRefere|
    00000280 6e 63 65 20 32 31 3b 09 20 2f 2a 20 54 4c 56 3a |nce 21;. /
    TLV:|
    00000290 20 5b 32 34 2e 31 5d 2a 2f 0a 09 09 20 51 75 61 | [24.1]/... Qua|
    000002a0 6c 69 74 79 4f 66 53 65 72 76 69 63 65 50 61 72 |lityOfServicePar|
    000002b0 61 6d 65 74 65 72 53 65 74 54 79 70 65 20 30 37 |ameterSetType 07|
    000002c0 3b 09 20 2f 2a 20 54 4c 56 3a 20 5b 32 34 2e 36 |;. /
    TLV: [24.6|
    000002d0 5d 2a 2f 0a 09 09 20 54 72 61 66 66 69 63 50 72 |]/... TrafficPr|
    000002e0 69 6f 72 69 74 79 20 30 3b 09 20 2f 2a 20 54 4c |iority 0;. /
    TL|
    000002f0 56 3a 20 5b 32 34 2e 37 5d 2a 2f 0a 09 09 20 4d |V: [24.7]/... M|
    00000300 61 78 53 75 62 73 74 61 69 6e 65 64 54 72 61 66 |axSubstainedTraf|
    00000310 66 69 63 52 61 74 65 20 35 33 36 32 30 30 3b 09 |ficRate 536200;.|
    00000320 20 2f 2a 20 54 4c 56 3a 20 5b 32 34 2e 38 5d 2a | /
    TLV: [24.8]|
    00000330 2f 0a 09 09 20 4d 61 78 54 72 61 66 66 69 63 42 |/... MaxTrafficB|
    00000340 75 72 73 74 20 33 30 34 34 3b 09 20 2f 2a 20 54 |urst 3044;. /
    T|
    00000350 4c 56 3a 20 5b 32 34 2e 39 5d 2a 2f 0a 09 09 20 |LV: [24.9]/... |
    00000360 54 69 6d 65 6f 75 74 46 6f 72 41 63 74 69 76 65 |TimeoutForActive|
    00000370 51 6f 53 20 30 3b 09 20 2f 2a 20 54 4c 56 3a 20 |QoS 0;. /
    TLV: |
    00000380 5b 32 34 2e 31 32 5d 2a 2f 0a 09 09 20 54 69 6d |[24.12]/... Tim|
    00000390 65 6f 75 74 46 6f 72 41 64 6d 69 74 74 65 64 51 |eoutForAdmittedQ|
    000003a0 6f 53 20 32 30 30 3b 09 20 2f 2a 20 54 4c 56 3a |oS 200;. /
    TLV:|
    000003b0 20 5b 32 34 2e 31 33 5d 2a 2f 0a 09 09 20 4d 61 | [24.13]/... Ma|
    000003c0 78 43 6f 6e 63 61 74 65 6e 61 74 65 64 42 75 72 |xConcatenatedBur|
    000003d0 73 74 20 33 30 34 34 3b 09 20 2f 2a 20 54 4c 56 |st 3044;. /
    TLV|
    000003e0 3a 20 5b 32 34 2e 31 34 5d 2a 2f 0a 09 09 20 53 |: [24.14]/... S|
    000003f0 63 68 65 64 75 6c 69 6e 67 54 79 70 65 20 32 3b |chedulingType 2;|
    00000400 09 20 2f 2a 20 54 4c 56 3a 20 5b 32 34 2e 31 35 |. /
    TLV: [24.15|
    00000410 5d 2a 2f 0a 09 09 20 52 65 71 75 65 73 74 54 72 |]/... RequestTr|
    00000420 61 6e 73 6d 69 73 73 69 6f 6e 50 6f 6c 69 63 79 |ansmissionPolicy|
    00000430 20 28 30 30 30 30 30 30 30 30 29 28 30 30 30 30 | (00000000)(0000|
    00000440 30 30 30 30 29 28 30 30 30 30 30 30 30 30 29 28 |0000)(00000000)(|
    00000450 31 30 30 30 30 30 30 30 29 3b 09 20 2f 2a 20 54 |10000000);. /
    T|
    00000460 4c 56 3a 20 5b 32 34 2e 31 36 5d 2a 2f 0a 09 7d |LV: [24.16]/..}|
    00000470 0a 09 20 43 6d 4d 69 63 20 44 32 3a 31 42 3a 32 |.. CmMic D2:1B:2|
    00000480 45 3a 37 33 3a 39 46 3a 45 43 3a 39 35 3a 42 34 |E:73:9F:EC:95:B4|
    00000490 3a 36 33 3a 34 34 3a 46 36 3a 37 30 3a 35 39 3a |:63:44:F6:70:59:|
    000004a0 33 46 3a 41 31 3a 44 37 3b 09 20 2f 2a 20 54 4c |3F:A1:D7;. /
    TL|
    000004b0 56 3a 20 5b 36 5d 2a 2f 0a 09 20 43 6d 74 73 4d |V: [6]/.. CmtsM|
    000004c0 69 63 20 31 41 3a 32 31 3a 32 32 3a 42 30 3a 35 |ic 1A:21:22:B0:5|
    000004d0 30 3a 33 42 3a 36 42 3a 33 32 3a 42 42 3a 36 41 |0:3B:6B:32:BB:6A|
    000004e0 3a 36 36 3a 30 33 3a 35 44 3a 38 30 3a 31 43 3a |:66:03:5D:80:1C:|
    000004f0 43 37 3b 09 20 2f 2a 20 54 4c 56 3a 20 5b 37 5d |C7;. /
    TLV: [7]|
    00000500 2a 2f 0a 7d 0a 0a |*/.}..|
    00000506

    hexdump of output file:

    00000000 0b 18 30 16 06 08 2b 06 01 02 01 01 06 00 04 0a |..0...+.........|
    00000010 44 6f 63 73 69 73 4c 41 42 31 03 01 01 12 01 02 |DocsisLAB1......|
    00000020 1d 01 01 19 24 01 02 00 0b 06 01 07 07 01 00 08 |....$...........|
    00000030 04 00 4e 20 00 09 04 00 00 05 f2 0c 02 00 00 0d |..N ............|
    00000040 02 00 00 0e 04 00 00 00 00 18 2b 01 02 00 15 06 |..........+.....|
    00000050 01 07 07 01 00 08 04 00 08 2e 88 09 04 00 00 0b |................|
    00000060 e4 0c 02 00 00 0d 02 00 c8 0e 02 0b e4 0f 01 02 |................|
    00000070 10 04 00 00 00 80 06 10 15 bc b9 63 ac cb bc 09 |...........c....|
    00000080 eb bc ed 77 c6 5c de cc 07 10 73 b1 67 28 c4 39 |...w.....s.g(.9|
    00000090 21 cc a3 d4 89 80 2d 72 2e ec ff 00 |!.....-r....|
    0000009c

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants