Przeglądaj źródła

Added support for TLV 62 UpstreamDropClassifierGroupID

AdrianSimionov 10 lat temu
rodzic
commit
6562bb2ee9

+ 1 - 1
src/docsis_common.h

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

+ 10 - 6
src/docsis_decode.c

@@ -230,13 +230,17 @@ void decode_dual_qtag (unsigned char *tlvbuf, symbol_type *sym, size_t length )
     printf("%s %d,%d;\n", sym->sym_ident, tlvbuf[0] * 256 + tlvbuf[1], tlvbuf[2]*256 + tlvbuf[3]);
 }
 
-void decode_dual_int (unsigned char *tlvbuf, symbol_type *sym, size_t length )
-{
-    if (length != 2 ) {
-        fprintf(stderr, "dual integers length mismatch\n");
-        exit(-45);
+void decode_char_list (unsigned char *tlvbuf, symbol_type *sym, size_t length )
+{
+    unsigned int i;
+    printf("%s ", sym->sym_ident);
+    for (i = 0; i < length; i++) {
+        printf("%d", tlvbuf[i]);
+        if (i < (length - 1) ) {
+            printf(",");
+        }
     }
-    printf("%s %d,%d;\n", sym->sym_ident, tlvbuf[0], tlvbuf[1]);
+    printf(";\n");
 }
 
 void decode_ethermask (unsigned char *tlvbuf, symbol_type *sym, size_t length)

+ 1 - 1
src/docsis_decode.h

@@ -44,7 +44,7 @@ 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 );
+void decode_char_list (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_ethermask (unsigned char *tlvbuf, symbol_type *sym, size_t length );
 void decode_md5 (unsigned char *tlvbuf, symbol_type *sym, size_t length);
 void decode_snmp_wd (unsigned char *tlvbuf, symbol_type *sym, size_t length);

+ 8 - 12
src/docsis_encode.c

@@ -444,29 +444,25 @@ int encode_dual_qtag ( unsigned char *buf, void *tval, struct symbol_entry *sym_
     return (sizeof(final));
 }
 
-int encode_dual_int ( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
+int encode_char_list ( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )
 {
-    short int i, final;
-    char *token;
-    char *array[2];
+    short int i;
+    char *token, final;
     const char s[2] = ",";
     union t_val *helper;
 
-#ifdef DEBUG
-    fprintf(stderr, "encode_dual_int: found '%s' on line %d\n", helper->strval, line );
-#endif /* DEBUG */
     helper = (union t_val *) tval;
     i = 0;
     token = strtok(helper->strval, s);
     while (token != NULL)
     {
-    	array[i++] = token;
-    	token = strtok (NULL, s);
+        final = (char)atoi(token);
+        memcpy (buf + i, &final, sizeof(char));
+        token = strtok (NULL, s);
+        i++;
     }
-    final = htons(atoi(array[0]) << 8 | atoi(array[1]));
-    memcpy (buf, &final, sizeof(final));
     free(helper->strval);
-    return(sizeof(final));
+    return(i * sizeof(char));
 }
 
 int encode_ethermask ( unsigned char *buf, void *tval, struct symbol_entry *sym_ptr )

+ 1 - 1
src/docsis_encode.h

@@ -40,7 +40,7 @@ int encode_ip_ip6_port  	(unsigned char *buf, void *tval, struct symbol_entry *s
 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 );
+int encode_char_list	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_ethermask	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_string 	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );
 int encode_strzero	(unsigned char *buf, void *tval, struct symbol_entry *sym_ptr );

Plik diff jest za duży
+ 1 - 3
src/docsis_lex.l


+ 5 - 4
src/docsis_symtable.h

@@ -162,7 +162,7 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 49,     "SrcMacAddress",                     2,      47,     (encode_ether),          (decode_ether),          0,           0             }, /* TLV 22.10.2 MULPIv3.0-I24 Annex C.2.1.8.2 */
 { 50,     "EtherType",                         3,      47,     (encode_hexstr),         (decode_hexstr),         3,           3             }, /* TLV 22.10.3 MULPIv3.0-I24 Annex C.2.1.8.3 */
 { 51,     "IEEE802Classifier",                 11,     28,     (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 22.11 MULPIv3.0-I24 Annex C.2.1.9 */
-{ 52,     "UserPriority",                      1,      51,     (encode_dual_int),       (decode_dual_int),       0,           0             }, /* TLV 22.11.1 MULPIv3.0-I24 Annex C.2.1.9.1 */
+{ 52,     "UserPriority",                      1,      51,     (encode_char_list),      (decode_char_list),      0,           0             }, /* TLV 22.11.1 MULPIv3.0-I24 Annex C.2.1.9.1 */
 { 53,     "VlanID",                            2,      51,     (encode_ushort),         (decode_ushort),         0,           4096          }, /* TLV 22.11.2 MULPIv3.0-I24 Annex C.2.1.9.2 */
 { 211,    "PcIPv6PacketClassification",        12,     28,     (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 22.12 MULPIv3.0-I24 Annex C.2.1.10 */
 { 212,    "PcIPv6TrafficClassRangeAndMask",    1,      211,    (encode_hexstr),         (decode_hexstr),         3,           3             }, /* TLV 22.12.1 MULPIv3.0-I24 Annex C.2.1.10.1 */
@@ -242,7 +242,7 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 380,    "SourceAttachmentIndividualID",      6,      202,    (encode_hexstr),         (decode_hexstr),         0,           0             }, /* TLV 22.43.5.6 L2VPN-I13 Annex B.3.6 */
 { 381,    "TargetAttachmentIndividualID",      7,      202,    (encode_hexstr),         (decode_hexstr),         0,           0             }, /* TLV 22.43.5.7 L2VPN-I13 Annex B.3.7 */
 { 382,    "IngressUserPriority",               8,      202,    (encode_uchar),          (decode_uchar),          0,           7             }, /* TLV 22.43.5.8 L2VPN-I13 Annex B.3.8 */
-{ 383,    "UserPriorityRange",                 9,      202,    (encode_dual_int),       (decode_dual_int),       0,           0             }, /* TLV 22.43.5.9 L2VPN-I13 Annex B.3.9 */
+{ 383,    "UserPriorityRange",                 9,      202,    (encode_char_list),      (decode_char_list),      0,           0             }, /* TLV 22.43.5.9 L2VPN-I13 Annex B.3.9 */
 { 385,    "L2VPNSADescriptorSubtype",          10,     202,    (encode_hexstr),         (decode_hexstr),         14,          14            }, /* TLV 22.43.5.10 L2VPN-I13 Annex B.3.10 */
 { 386,    "PseudowireType",                    12,     202,    (encode_uchar),          (decode_uchar),          4,           5             }, /* TLV 22.43.5.12 L2VPN-I13 Annex B.3.13 */
 { 387,    "L2VPNMode",                         13,     202,    (encode_uchar),          (decode_uchar),          0,           1             }, /* TLV 22.43.5.13 L2VPN-I13 Annex B.3.14 */
@@ -362,7 +362,7 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 { 75,     "SrcMacAddress",                     2,      73,     (encode_ether),          (decode_ether),          0,           0             }, /* TLV 23.10.2 MULPIv3.0-I24 Annex C.2.1.8.2 */
 { 76,     "EtherType",                         3,      73,     (encode_hexstr),         (decode_hexstr),         0,           3             }, /* TLV 23.10.3 MULPIv3.0-I24 Annex C.2.1.8.3 */
 { 77,     "IEEE802Classifier",                 11,     54,     (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 23.11 MULPIv3.0-I24 Annex C.2.1.9 */
-{ 78,     "UserPriority",                      1,      77,     (encode_dual_int),       (decode_dual_int),       0,           0             }, /* TLV 23.11.1 MULPIv3.0-I24 Annex C.2.1.9.1 */
+{ 78,     "UserPriority",                      1,      77,     (encode_char_list),      (decode_char_list),      0,           0             }, /* TLV 23.11.1 MULPIv3.0-I24 Annex C.2.1.9.1 */
 { 79,     "VlanID",                            2,      77,     (encode_ushort),         (decode_ushort),         0,           0             }, /* TLV 23.11.2 MULPIv3.0-I24 Annex C.2.1.9.2 */
 { 220,    "PcIPv6PacketClassification",        12,     54,     (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 23.12 MULPIv3.0-I24 Annex C.2.1.10 */
 { 221,    "PcIPv6TrafficClassRangeAndMask",    1,      220,    (encode_hexstr),         (decode_hexstr),         0,           0             }, /* TLV 23.12.1 MULPIv3.0-I24 Annex C.2.1.10.1 */
@@ -544,7 +544,8 @@ symbol_type symtable[NUM_IDENTIFIERS] =  {
 /* IPv6 */
 { 173,    "SwUpgradeServer6",                  58,     0,      (encode_ip6),            (decode_ip6),            0,           0             }, /* TLV 58 MULPIv3.0-I24 Annex C.1.2.8 */
 
-{ 174,    "SubMgmtCPEIPv6PrefixList",          61,     0,      (encode_ip6_prefix_list), (decode_ip6_prefix_list), 0,         0             }, /* TLV 61 MULPIv3.0-I24 Annex C.1.1.19.3 */
+{ 528,    "SubMgmtCPEIPv6PrefixList",          61,     0,      (encode_ip6_prefix_list), (decode_ip6_prefix_list), 0,         0             }, /* TLV 61 MULPIv3.0-I24 Annex C.1.1.19.3 */
+{ 529,    "UpstreamDropClassifierGroupID",     62,     0,      (encode_char_list),      (decode_char_list),      0,           0             }, /* TLV 62 MULPIv3.0-I24 Annex C.1.1.26 */
 { 174,    "SubMgmtControl6",                   63,     0,      (encode_ushort),         (decode_ushort),         0,           0             }, /* TLV 63 MULPIv3.0-I24 Annex C.1.1.19.5 */
 { 341,    "CMTSStaticMulticastSessionEncodings",  64,  0,      (encode_nothing),        (decode_aggregate),      0,           0             }, /* TLV 64 MULPIv3.0-I24 Annex C.1.1.27 */
 { 342,    "CMTSStaticMulticastSessionGroup",   1,      341,    (encode_ip_ip6),         (decode_ip_ip6),         0,           0             }, /* TLV 64.1 MULPIv3.0-I24 Annex C.1.1.27.1 */

+ 0 - 3
src/docsis_yy.y

@@ -98,7 +98,6 @@ struct tlv *_my_tlvtree_head;
 %token <uintval>  T_TLV_STR_VALUE
 %token <uintval>  T_TLV_STRZERO_VALUE
 %token <uintval>  T_TLV_TYPE
-%token <uintval>  T_DUAL_TAG
 %token <uintval>  T_IP_IP6_PORT
 
 %type <tlvptr>  assignment_stmt
@@ -181,8 +180,6 @@ assignment_stmt:  T_IDENTIFIER T_INTEGER ';' {
 			$$ = create_tlv ($1, (union t_val *)&$2);}
 		| T_IDENTIFIER T_IP6_PREFIX_LIST ';' {
 			$$ = create_tlv ($1, (union t_val *)&$2);}
-		| T_IDENTIFIER T_DUAL_TAG ';' {
-			$$ = create_tlv ($1, (union t_val *)&$2);}
 		| T_IDENTIFIER T_IP_IP6_PORT ';' {
 			$$ = create_tlv ($1, (union t_val *)&$2);}
 		| T_IDENTIFIER T_MAC ';' {

+ 30 - 33
tests/TLV_22_43_5_3_to_9.txt

@@ -1,36 +1,33 @@
 Main 
 {
-	UsPacketClass
-	{
-		VendorSpecific
-		{
-			VendorIdentifier 0xffffff;
-			L2VPNEncoding
-			{
-				eSAFEDHCPSnooping 0x000000;
-				CMInterfaceMaskCMIMSubtype 0x000080;
-				AttachmentGroupID 0x0102;
-				SourceAttachmentIndividualID 0x0102;
-				TargetAttachmentIndividualID 0x0102;
-				IngressUserPriority 1;
-				UserPriorityRange 1,2;
-			}
-		}
-		ClassifierRef 1;
-		ServiceFlowRef 1;
-	}
-	NetworkAccess 1;
-	UsServiceFlow
-	{
-		UsServiceFlowRef 1;
-		QosParamSetType 7;
-	}
-	DsServiceFlow
-	{
-		DsServiceFlowRef 2;
-		QosParamSetType 7;
-	}
-	/* CmMic 19ae4d2be718fe71c7932d9da214ca90; */
-	/* CmtsMic 86fb411d1a930d87b27f8a5e06e3ab0f; */
-	/*EndOfDataMkr*/
+UsPacketClass
+{
+VendorSpecific
+{
+VendorIdentifier 0xffffff;
+L2VPNEncoding
+{
+eSAFEDHCPSnooping 0x000000;
+CMInterfaceMaskCMIMSubtype 0x000080;
+AttachmentGroupID 0x0102;
+SourceAttachmentIndividualID 0x0102;
+TargetAttachmentIndividualID 0x0102;
+IngressUserPriority 1;
+UserPriorityRange 1,2;
+}
+}
+ClassifierRef 1;
+ServiceFlowRef 1;
+}
+NetworkAccess 1;
+UsServiceFlow
+{
+UsServiceFlowRef 1;
+QosParamSetType 7;
+}
+DsServiceFlow
+{
+DsServiceFlowRef 2;
+QosParamSetType 7;
+}
 }

BIN
tests/TLV_62_UpstreamDropClassifierGroupID.cm


+ 19 - 0
tests/TLV_62_UpstreamDropClassifierGroupID.conf

@@ -0,0 +1,19 @@
+Main 
+{
+	NetworkAccess 1;
+	UsServiceFlow
+	{
+		UsServiceFlowRef 1;
+		QosParamSetType 7;
+	}
+	DsServiceFlow
+	{
+		DsServiceFlowRef 2;
+		QosParamSetType 7;
+	}
+	UpstreamDropClassifierGroupID 1,2,3,4,5,6;
+	/* CmMic cb1f8900ade68c381bf27acd603dab9d; */
+	/* CmtsMic a3f9a9360085e37a62bd1b599fb424b7; */
+	/*EndOfDataMkr*/
+	/* Pad */
+}

+ 15 - 0
tests/TLV_62_UpstreamDropClassifierGroupID.txt

@@ -0,0 +1,15 @@
+Main 
+{
+NetworkAccess 1;
+UsServiceFlow
+{
+UsServiceFlowRef 1;
+QosParamSetType 7;
+}
+DsServiceFlow
+{
+DsServiceFlowRef 2;
+QosParamSetType 7;
+}
+UpstreamDropClassifierGroupID 1,2,3,4,5,6;
+}