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

New TLV: 84 Diplexer Band Edge #68

Closed
Sicarius128 opened this issue Jan 6, 2020 · 6 comments
Closed

New TLV: 84 Diplexer Band Edge #68

Sicarius128 opened this issue Jan 6, 2020 · 6 comments

Comments

@Sicarius128
Copy link

New TLV 84 as per MULPIv3.1-I19 Annex C.1.2.23

Old:

GenericTLV TlvCode 84 TlvLength 9 TlvValue 0x010102020100030102;

New:

DiplexerBandEdge
{
	DiplexerUpstreamUpperBandEdge 2;
	DiplexerDownstreamLowerBandEdge 0;
	DiplexerDownstreamUpperBandEdge 2;
}

Patch attached. Hopefully in a better format this time.

docsis_symtable.h.patch.txt

@kriip
Copy link

kriip commented May 6, 2021

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)

@Sicarius128
Copy link
Author

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.

@kriip
Copy link

kriip commented May 10, 2021

@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

@prushik
Copy link

prushik commented Oct 12, 2022

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.

rlaager added a commit that referenced this issue Oct 12, 2022
I have no idea what this comment is trying to indicate.  In the patch
in #68, Sicarius128 changed the 1422 to 1426 to match the addition of
more options.  I'm just going to remove it instead.
@rlaager
Copy link
Owner

rlaager commented Oct 12, 2022

I merged this.

Usual disclaimer: I am just doing a "rescue maintainer" job here. I do not use this software any more.

@rlaager
Copy link
Owner

rlaager commented Oct 12, 2022

Thanks @Sicarius128 @kriip @prushik !

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

No branches or pull requests

4 participants