-
Notifications
You must be signed in to change notification settings - Fork 70
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
PKTC Config Hash #66
Comments
Hi @agentjdh, I do not have the same device you have. Let me explain what is going on in the code: That magical string you see in memcpy() is a TLV (Tag-Length-Value). For CableLabs, this is TLV 11, which is just a normal SNMP Object embedded in a config file. So in order to do your new hash, you need to start with, followed by the total length of the TLV, which is the OID and the hash itself plus some glue bytes here and there. As you say, the encoded OID is So if we put this all together, your magical string should be: 0x0b - the TLV type, So the total number of bytes we have here is: 1+1+1+1+1+1+11+1+1=19 Se we can add a new hash, and the code should look like this:
Now you will need to add the following code in main() in docsis.c to let you use this "special" encoding just after the "-eu" hash, so around line 358 in docsis.c
Then just run the same command with -spechash to try this out... So if you make these changes, you should get closer to get this to work. I might be off in the lengths ( I have a problem adding 1 to things for some reason). I don't have time to compile this right now, so let me know how this goes. Cheers... *Encoded OID... |
In the previous code, I inserted a space in the memcopy, please remove that in your code. This was a formatting mistake: memcpy (tlvbuf + tlvbuflen - 3, "\x0b\x25\x30\x23\x06\x0b\0x2b\0x06\0x01\0x02\0x01\0x81\0x0C\0x01\0x02\0x0B\0x00\x04\x14", 19); Thanks |
I'd come to the exact same numbers effectively from using xxd to take a hex dump of a working binary. So this part looks correct. The actual Docsis tool, with your modifications, compiles OK, but using the -spechash option when converting the text to binary does not insert the Hash entry. I got it (sort of) working by just modifying the existing -eu entry (hash ==2) - it works, but the generated binary is 1 byte larger than a working one, and the modem rejects the generated MTA file. The working ones are created on a Windows PC using Thomson ConfigBldr. |
Can you give the the working file and the one you generated that does not
work?
On Tue, Oct 15, 2019 at 02:08 agentjdh ***@***.***> wrote:
@stephb9959 <https://github.com/stephb9959>
I'd come to the exact same numbers effectively from using xxd to take a
hex dump of a working binary. So this part looks correct.
The actual Docsis tool, with your modifications, compiles OK, but using
the -spechash option when converting the text to binary does not insert the
Hash entry.
I got it (sort of) working by just modifying the existing -eu entry (hash
==2) - it works, but the generated binary is 1 byte larger than a working
one, and the modem rejects the generated MTA file.
The working ones are created on a Windows PC using Thomson ConfigBldr.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66?email_source=notifications&email_token=AAOF7RG2EJDLGXD2BM7KGCDQOWCCLA5CNFSM4I7WXYHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBIAUBY#issuecomment-542116359>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOF7RHBI3WLSZIS4QSWAC3QOWCCLANCNFSM4I7WXYHA>
.
--
Stéphane Bourque
|
Hi @agentjdh, I built a little app to parse the files in erlang and here is the output:
This shows that you have 2 mismatches OIDs. Forget the ".1.3.6.1.2.1.140.1.2.11.0" because that is the has and it should not match because the files do not match. The top shows you what the good file has that the bad file does not. And the bottom shows you what the bad file contains that is not in the good file. So I think you have OID problems. Both files passed the MTA decoder so they are both valid. Hope this helps. |
Here is the proper docsis.c file that compiles and will do the spechash and still lets you pick from NA/EU too (I had forgotten one more location to enable to hash being appended, it's in now)... Let me know how it goes. |
I've replaced docsis.c with the one you provided and re-compiled. Looks like something is going wrong - generating a binary using ./docsis -dialplan -spechash -p mta_WORKING.txt mta_WORKING.bin
Error: bad type returned (31) Running the same command with -nohash or -eu switches works OK (but the modem rejects the binary as there is no/wrong has OID used). |
I don't know how that code section got in above, ignore it. |
OK. I have it now. This was my mistake. Some debug stuff I added a while ago in docsis.c, now removed. Also generated some test to make sure the spechash could be encoded and decoded. Now that works. Also, my encoding was wrong with the memcpy(). Now fixed. ( It's amazing what happens when you actually compile and run tests! Who knew!!) Let me know if this finally fixes your problem. If it does, then I can submit for a pull request. This is the good file... Thanks |
I am not getting those errors now, but the generated file is still +1 byte, and is rejected by the modem. I've attached the files, here is what I'm doing - Decode the working binary (8480 bytes, not the TEST one), which generates the text configuration + dialplan text file ./docsis -d mta-working-2-lines--128_021.bin > mta-working-2-lines--128_021-TEST.txt Encode using the following command line - ./docsis -dialplan -spechash -p mta-working-2-lines--128_021-TEST.txt mta-working-2-lines--128_021-TEST.bin Resulting binary is 8481 and is rejected for - error - 4000950906 (table linkages in the configuration file could not be resolved) Resulting in critical - 4000950904 (mandatory parameter of the configuration file is missing) The dialplan.txt generated by decoding working vs non-working is identical. So is there something in the diaplan.txt file that is causing this? It could probably be simplified for a start, which I will work on this morning. |
There is a 1 byte difference but it's actually not that 5 bytes. The resulting file has 1 byte size difference but it's because the 4 mismatch OIDs have different sizes. You have 2 OIDs in the good file that are not in the non-working file, and you have 2 OIDs in the test file that are not in the good file. Here's that little analysis tool I ran on the working and non-working files:
So I decided to run my own tests with the docsis.c file I gave you. All based on your working mta-working-2-lines--128_021.bin
Then I remove the last line at the end of good-bin.txt, "SnmpMibObject mib-2.140.1.2.11.0...". That's the hash OID and we do not need it. Then I ran:
This gives me a file of 8480 bytes. When I run my own tool to compare the 2 bins, I get something like this:
Which tells me that the only difference is the hash. This is normal because the good file has the dialplan in the middle of the file, which the docsis tool puts the dialplan at the end of the file. I am attaching the file I produced this way. Maybe you can try it and tell me if it works? This is the good-bin.txt file I get too. Compare yours to this just to make sure that your setup is ok (i.e. you are not missing MIBs or you have old MIBS that would cause a problem. Other than that, this shows that the right has is getting in the file and that the docsis decode and reencodes to the same file. Let me know how this works. Thanks |
What you did there is exactly what I was doing - decoding a working binary to text + dialplan, deleting the hash line from the text file, then rebuilding the binary with exactly those switches. And the resulting binary did not match the original. So where are these mismatched OIDs coming from? I am not editing the file apart from Hash removal. Were you doing this with a release source code? I was using binary-master download, and replacing only docsis.c I'll clean out the sources and start again. |
That’s what I did.
I don’t know what to say. Maybe recompile the whole project? Make sure you
have all the right MIBs? Restart from a fresh directory to avoid any file
conflicts?
On Fri, Oct 18, 2019 at 00:22 agentjdh ***@***.***> wrote:
@stephb9959 <https://github.com/stephb9959>
What you did there is exactly what I was doing - decoding a working binary
to text + dialplan, deleting the hash line from the text file, then
rebuilding the binary with exactly those switches. And the resulting binary
did not match the
Were you doing this with a release source code? I was using binary-master
download, and replacing only docsis.c
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66?email_source=notifications&email_token=AAOF7RBDVGQ4JVOBDM7YCJDQPFP2PA5CNFSM4I7WXYHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBTCEHQ#issuecomment-543564318>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOF7RG7W6RIKBGF7J3KOVTQPFP2PANCNFSM4I7WXYHA>
.
--
Stéphane Bourque
|
Just clone the project to get the master and replace with the new DOCSIS.c |
I've done exactly that, with the same results. The bizarre thing is, once I have encoded the binary that is +1 byte ("wrong"), if I then decode this to a text file, and delete the hash, the resulting text file is identical to the one decode from the working binary. I have a lot of mib files so I am never entirely sure that I have the correct ones. Could you attach the mibs you have and/or your "working" binary? |
I have a OS X build on Catalina. I could build one for Debian if needed.
What do you need?
On Fri, Oct 18, 2019 at 01:02 agentjdh ***@***.***> wrote:
@stephb9959 <https://github.com/stephb9959>
I've done exactly that, with the same results.
The bizarre thing is, once I have encoded the binary that is +1 byte
("wrong"), if I then decode this to a text file, and delete the hash, the
resulting text file is identical to the one decode from the working binary.
I have a lot of mib files so I am never entirely sure that I have the
correct ones.
Could you attach the mibs you have and/or your "working" binary?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#66?email_source=notifications&email_token=AAOF7RFFEER57Z2XVAUNAVLQPFUPVA5CNFSM4I7WXYHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBTG2HI#issuecomment-543583517>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOF7RDUXCDFWC2GCMRMKYLQPFUPVANCNFSM4I7WXYHA>
.
--
Stéphane Bourque
|
Debian please |
Here is a Debian build for you... |
Thanks Stéphane, it looks like the file created is the same size (8481 bytes) as before. So I guess it is not the binary then. Which pretty much leaves my mibs - I have a 3rd party mib folder, .snmp/mibs, with a lot of mibs I have collected over the last year or so. If I move this folder, so the docsis application only uses the default installed mibs in /usr/share/snmp/mibs, I get another slightly different binary created this time 8483 bytes. I've updated the system installed mibs with download-mibs. If I diff the text files decoded from the binaries it shows
So something is still getting mixed up. SnmpMibObject .1.3.6.1.4.1.4491.2.2.1.1.1.7.0 Integer 1; Is not in the original binary - so how is it being inserted into the binary created by docsis tool? Actually, it looks like it might be modifying an IETC MIB (which works) into the equivalent Cable Labs MIB - which is what I've been trying to avoid with the hash MIB. I'll spend some more time on this tomorrow. Thanks for your help to date. |
Turns out it was the decoding to text file that was using the "wrong" OID for pktcMtaDevEnabled The particular modem I was using required the 1.3.6.1.2.1 OID from PKTC-IETF-MTA-MIB It also obviously required the IETF hash OID as well, which is what triggered this whole scenario. So just getting rid of the various MIBs - or using the -o option during decode the OIDs numerically worked. Anyway working binaries are now generated from the decoded text output. |
That's very good news. I was just about to send you my MIBs... So if you use the new executable with the -spechash all things work for you now? Thanks |
Yes, -spechash works properly. It is IETF spec, not NA or EU, to my knowledge. This is the first device I have seen that uses IETF mibs. |
In my case recompiling with -spechash or -eu it give me the same hexstring value Installation was made from your site and also replaced docsis.c as you provide on the link. First I'm decoding the working one Removing the last line from K_IP.txt and encoding again Hexstring(1.3.6.1.2.1.140.1.2.11.0) are not matched from original one (K_IP.BIN_) and compiled one (K_IP_spechash.bin) and in this case config is rejected . Tried with EU encoding i get same value for hexstring ( 1.3.6.1.4.1.7432.1.1.2.9.0 ) I dont think i should get same encoding values with eu and spechash which was supposed to be IETF . Any idea what is wrong with my compiler would be very helpful. |
Hi
I am using the 0.9.9-dev Docsis tool to generate a working MTA. I've used this in a past with a variety of modems. There is one modem that will not work though.
I've tracked the problem down to the OID used for pktcMtaDevProvConfigHash.0
It looks like there is more than just EU/NA - IETF as well? Anyway, in docsis.c, the relevant parts for generating the OID are -
NA (Hash == 1) - This corresponds with OID .1.3.6.1.4.1.4491.2.2.1.1.2.7.0 (pktcMtaDevProvConfigHash.0 from PKTC-MTA-MIB)
EU (Hash == 2) - This corresponds with OID .1.3.6.1.4.1.7432.1.1.2.9.0 - I believe this is an Excentis MIB
There appears to be a 3rd method. The OID is
.1.3.6.1.2.1.140.1.2.11.0
It is pktcMtaDevProvConfigHash.0 from PKTC-IETF-MTA-MIB. I need to use this OID for the modem I'm working on at the moment.
I have used OID converter from
[]((http://www.rtner.de/software/oid.html)
This generated
06 0C 01 03 06 01 02 01 81 0C 01 02 0B 00
Which is getting there, but there is a prefix that changes - the suffix looks like it is always \x04\x14
How is the string generated?
The text was updated successfully, but these errors were encountered: