Forráskód Böngészése

Added decode support for TLV 202.53.2.1 and 202.53.2.2

AdrianSimionov 10 éve
szülő
commit
bd2e80ff04
3 módosított fájl, 6 hozzáadás és 5 törlés
  1. 1 1
      src/docsis_common.h
  2. 2 2
      src/docsis_decode.c
  3. 3 2
      src/docsis_symtable.h

+ 1 - 1
src/docsis_common.h

@@ -31,7 +31,7 @@
 
 
 #ifndef NUM_IDENTIFIERS
-#define NUM_IDENTIFIERS 355
+#define NUM_IDENTIFIERS 356
 #endif /*  NUM_IDENTIFIERS, needed in docsis_symtable.h  */
 
 #define MAXINT 2000000000

+ 2 - 2
src/docsis_decode.c

@@ -111,13 +111,13 @@ void decode_ip6 (unsigned char *tlvbuf, symbol_type *sym, size_t length )
 
 void decode_ip_ip6_port (unsigned char *tlvbuf, symbol_type *sym, size_t length )
 {
+  static char ip6_addr[INET6_ADDRSTRLEN];
+  char ipstr[INET6_ADDRSTRLEN];
   static struct in_addr ip_addr;
   if (length == 6 ) {
     memcpy (&ip_addr, tlvbuf, 4);
     printf("%s %s/%d;\n", sym->sym_ident, inet_ntoa(ip_addr), tlvbuf[4] * 256 + tlvbuf[5] );
   }
-  static char ip6_addr[INET6_ADDRSTRLEN];
-  char ipstr[INET6_ADDRSTRLEN];
   if (length == 18 ) {
       memcpy (&ip6_addr, tlvbuf, INET6_ADDRSTRLEN);
       printf("%s %s/%d;\n", sym->sym_ident, inet_ntop(AF_INET6,ip6_addr,ipstr,sizeof ipstr), tlvbuf[16] * 256 + tlvbuf[17] );

+ 3 - 2
src/docsis_symtable.h

@@ -444,7 +444,8 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 228,    "SNMPv1v2cCoexistenceConfig",        53,     175,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 202.53 eRouter-I12 Annex B.4.5 */
 { 229,    "SNMPv1v2cCommunityName",            1,      228,    (encode_string),         (decode_string),         0,           0             }, /* TLV 202.53.1 eRouter-I12 Annex B.4.5.1 */
 { 230,    "SNMPv1v2cTransportAddressAccess",   2,      228,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 202.53.2 eRouter-I12 Annex B.4.5.2 */
-{ 340,    "SNMPv1v2cTransportAddress",         1,      230,    (encode_nothing),        (decode_ip_ip6_port),    0,           0             }, /* TLV 202.53.2.1 */
+{ 340,    "SNMPv1v2cTransportAddress",         1,      230,    (encode_nothing),        (decode_ip_ip6_port),    0,           0             }, /* TLV 202.53.2.1 eRouter-I12 Annex B.4.5.2.1 */
+{ 349,    "SNMPv1v2cTransportAddressMask",     2,      230,    (encode_nothing),        (decode_ip_ip6_port),    0,           0             }, /* TLV 202.53.2.2 eRouter-I12 Annex B.4.5.2.2 */
 { 231,    "SNMPv1v2cAccessViewType",           3,      228,    (encode_uchar),          (decode_uchar),          1,           2             }, /* TLV 202.53.3 eRouter-I12 Annex B.4.5.3 */
 { 232,    "SNMPv1v2cAccessViewName",           4,      228,    (encode_string),         (decode_string),         0,           0             }, /* TLV 202.53.4 eRouter-I12 Annex B.4.5.4 */
 { 233,    "SNMPv3AccessViewConfiguration",     54,     175,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 202.54 eRouter-I12 Annex B.4.6 */
@@ -453,7 +454,7 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 236,    "SNMPv3AccessViewMask",              3,      233,    (encode_hexstr),         (decode_hexstr),         2,           2             }, /* TLV 202.54.3 eRouter-I12 Annex B.4.6.3 */
 { 237,    "SNMPv3AccessViewType",              4,      233,    (encode_uchar),          (decode_uchar),          1,           2             }, /* TLV 202.54.4 eRouter-I12 Annex B.4.6.4 */
 
-/* A little more organized -> Start with 349 */
+/* A little more organized -> Start with 350 */
 
 /* Generic TLV ... we only use the limits, code and length don't matter ...*/
 { 998,    "GenericTLV",                        0,      0,      (encode_nothing),        (decode_special),        0,           0             },