Closed Sicarius128 closed 2 years ago
This patch caused warnings when compiling:
In file included from docsis.c:42:
docsis_symtable.h:1480:1: warning: excess elements in array initializer
{ 237, "SNMPv3AccessViewType", 4, 233, (encode_uchar), (decode_uchar), 1, 2 }, /* TLV 202.54.4 eRouter-I12 Annex B.4.6.4 */
^
docsis_symtable.h:1480:1: note: (near initialization for 'symtable')
docsis_symtable.h:1485:1: warning: excess elements in array initializer
{ 998, "GenericTLV", 0, 0, (encode_nothing), (decode_special), 0, 0 },
^
docsis_symtable.h:1485:1: note: (near initialization for 'symtable')
docsis_symtable.h:1487:1: warning: excess elements in array initializer
{ 157, "MtaConfigDelimiter", 254, 0, (encode_uchar), (decode_uchar), 1, 255 }, /* TLV 254 PKT-SP-PROV1.5-I04 Chapter 9.1 */
^
docsis_symtable.h:1487:1: note: (near initialization for 'symtable')
docsis_symtable.h:1488:1: warning: excess elements in array initializer
{ 999, "/*EndOfDataMkr*/", 255, 0, (encode_nothing), (decode_special), 0, 0 } /* TLV 255 MULPIv3.0-I24 Annex C.1.2.1 */
^
docsis_symtable.h:1488:1: note: (near initialization for 'symtable')
I think NUM_IDENTIFIERS in docsis_common.h must be incremented with 4 (clean compile with this change)
Hmm, odd. I didn't have to increment it myself and was able to compile it.
~/src/docsis/src$ grep "define NUM_IDENTIFIERS" docsis_common.h
#define NUM_IDENTIFIERS 1427
However, when checking the identifiers, there are more than that number:
~/src/docsis/src$ grep encode_ docsis_symtable.h | grep "[{]" | awk '{print $2}' | wc -l
1431
So, my 4 additions would put it over the max.
However, some of those are duplicates.
~/src/docsis/src$ grep encode_ docsis_symtable.h | grep "[{]" | awk '{print $2}' | sort -n | uniq | wc -l
1424
~/src/docsis/src$ grep encode_ docsis_symtable.h | grep "[{]" | awk '{print $2}' | sort -n | uniq -c | sort -n | grep -v " 1"
2 227,
2 239,
2 254,
2 340,
2 378,
2 998,
2 999,
It's possible they're getting optimized out when I'm compiling it. It's likely those need to get de-duplicated as they will probably be causing other issues.
@Sicarius128 Thank you for fast reply, and thank you for your patch :)
Just for the record, it did compile successfully without tweaking NUM_IDENTIFIERS, but there was the before mentioned warning with excess elements. I did not test the binary compiled with warnings.
The build platform i use is Docker "php:8-apache-buster" with following extra packages installed: iproute2 net-tools iputils-ping unzip automake libtool libsnmp-dev bison make gcc flex libglib2.0-dev libfl-dev
I did test docsis-files compiled with your patch + NUM_IDENTIFIERS incremented, and it seems to work just fine, the modems accept the docsis-files and TLV84 signaling seems to work just fine
This patch compiles without incrementing NUM_IDENTIFIERS, however, it causes some problems at runtime. Specifically, it causes an extra malformed TLV to appear at the end of decoded binaries:
GenericTLV TlvCode 255 TlvLength 0 TlvValue 0x;
When NUM_IDENTIFIERS is incremented, however, everything appears to work correctly.
I merged this.
Usual disclaimer: I am just doing a "rescue maintainer" job here. I do not use this software any more.
Thanks @Sicarius128 @kriip @prushik !
New TLV 84 as per MULPIv3.1-I19 Annex C.1.2.23
Old:
New:
Patch attached. Hopefully in a better format this time.
docsis_symtable.h.patch.txt