Browse Source

Added support for TLV 22.43.5.2.1 and TLV length zero (weird length).

AdrianSimionov 10 years ago
parent
commit
cf0b19b054
7 changed files with 19 additions and 3 deletions
  1. 1 1
      src/docsis_common.h
  2. 5 0
      src/docsis_decode.c
  3. 1 0
      src/docsis_decode.h
  4. 5 0
      src/docsis_encode.c
  5. 1 0
      src/docsis_encode.h
  6. 4 0
      src/docsis_symtable.h
  7. 2 2
      src/docsis_yy.y

+ 1 - 1
src/docsis_common.h

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

+ 5 - 0
src/docsis_decode.c

@@ -139,6 +139,11 @@ void decode_ip_ip6_port (unsigned char *tlvbuf, symbol_type *sym, size_t length
   }
 }
 
+void decode_lenzero (unsigned char *tlvbuf, symbol_type *sym, size_t length )
+{
+  printf("%s 0x00;\n", sym->sym_ident );
+}
+
 void decode_ether (unsigned char *tlvbuf, symbol_type *sym, size_t length )
 {
 

+ 1 - 0
src/docsis_decode.h

@@ -36,6 +36,7 @@ void decode_ip (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ip6 (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ip_ip6 (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ip_ip6_port (unsigned char *tlvbuf, symbol_type *sym, size_t length );
+void decode_lenzero (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ether (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_dual_qtag (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_dual_int (unsigned char *tlvbuf, symbol_type *sym, size_t length );

+ 5 - 0
src/docsis_encode.c

@@ -213,6 +213,11 @@ int encode_ip_ip6( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr
   }
 }
 
+int encode_lenzero( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
+{
+  return (0);
+}
+
 int encode_ether ( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
 {
 int retval; 	     /* return value of inet_aton */

+ 1 - 0
src/docsis_encode.h

@@ -31,6 +31,7 @@ int encode_uchar  	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr
 int encode_ip     	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_ip6     	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_ip_ip6  	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
+int encode_lenzero  	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_ether	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_dual_qtag	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_dual_int	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );

+ 4 - 0
src/docsis_symtable.h

@@ -207,6 +207,10 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 200,    "VendorSpecific",                    43,     28,     (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 22.43 MULPIv3.0-I24 Annex C.2.1.11 */
 { 202,    "L2VPNEncoding",                     5,      200,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 22.43.5 MULPIv3.0-I24 Annex C.1.1.18.1.5 */
 { 203,    "VPNIdentifier",                     1,      202,    (encode_hexstr),         (decode_hexstr),         4,           255           }, /* TLV 22.43.5.1 L2VPN-I13 Annex B.3.1 */
+/* 22.43.5.2 */
+{ 350,    "NSIEncapsulationSubtype",           2,      202,    (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 22.43.5.2 */
+/* 22.43.5.2.1 */
+{ 351,    "ServiceMultiplexingValueOther",     1,      350,    (encode_lenzero),        (decode_lenzero),        0,           0             }, /* TLV 22.43.5.2.1 */
 { 201,    "VendorIdentifier",                  8,      200,    (encode_hexstr),         (decode_hexstr),         3,           3             }, /* TLV 22.43.8 */
 
 /* TODO: Vendor Specific support in the IEEE802Classifier */

+ 2 - 2
src/docsis_yy.y

@@ -246,10 +246,10 @@ create_tlv(struct symbol_entry *sym_ptr, union t_val *value)
   TLVINIT(tlvbuf);
   tlvbuf->docs_code = sym_ptr->docsis_code;
   tlvbuf->tlv_len = sym_ptr->encode_func(tlvbuf->tlv_value,value,sym_ptr);
-		if (tlvbuf->tlv_len <= 0 ) {
+/*		if (tlvbuf->tlv_len <= 0 ) {
 			fprintf(stderr, "Got 0-length value while scanning for %s at line %d\n",sym_ptr->sym_ident,line );
 			exit (-1);
-   		}
+   		} */
   return tlvbuf;
 }