hi all,

pls find attached a bugfix in order to properly
decode the IS_REACH TLV #2;

TLV #2 has typically the length of (N*11)+1 bytes;

i have read the spec wrong and i previously coded
the IS reach TLV to have a format of N *12 bytes;

sorry;

/hannes

Index: print-isoclns.c
===================================================================
RCS file: /tcpdump/master/tcpdump/print-isoclns.c,v
retrieving revision 1.35
diff -u -r1.35 print-isoclns.c
--- print-isoclns.c     2001/12/18 09:00:14     1.35
+++ print-isoclns.c     2002/01/08 13:56:39
@@ -202,7 +202,6 @@
 };
 
 struct isis_tlv_is_reach {
-    u_char virtual_flag;
     u_char metric_default;
     u_char metric_delay;
     u_char metric_expense;
@@ -1141,17 +1140,36 @@
             break;
         case TLV_IS_REACH:
             printf("IS Reachability (%u)",len);
-           tlv_is_reach = (const struct isis_tlv_is_reach *)pptr;
-           if (!TTEST(*tlv_is_reach))
-               goto trunctlv;
-           printf("\n\t\t\tIS Neighbor: ");
-            isis_print_nodeid(tlv_is_reach->neighbor_nodeid);
 
+           tptr=pptr;
+
+           if (!TTEST2(*tptr,1))  /* check if there is one byte left to read out the 
+virtual flag */
+                goto trunctlv;
+
+           switch (*tptr) {
+           case 0:
+             printf("\n\t\t\tIsNotVirtual");
+             break;
+           case 1:
+             printf("\n\t\t\tIsVirtual");
+             break;
+           default:
+             printf("\n\t\t\tbogus virtual flag 0x%02x",(*tptr));
+             break;     
+           }
+
+           tptr++;
+
+           tlv_is_reach = (const struct isis_tlv_is_reach *)tptr;
+
            tmp = len;
             while (tmp >= sizeof(struct isis_tlv_is_reach)) {
                if (!TTEST(*tlv_is_reach))
                    goto trunctlv;
 
+               printf("\n\t\t\tIS Neighbor: ");
+               isis_print_nodeid(tlv_is_reach->neighbor_nodeid);
+
                printf(", Default Metric: %d, %s",
                           ISIS_LSP_TLV_METRIC_VALUE(tlv_is_reach->metric_default),
                           ISIS_LSP_TLV_METRIC_IE(tlv_is_reach->metric_default) ? 
"External" : "Internal");
@@ -1170,18 +1188,6 @@
                    printf("\n\t\t\t  Error Metric: %d, %s",
                                   
ISIS_LSP_TLV_METRIC_VALUE(tlv_is_reach->metric_error),
                                   ISIS_LSP_TLV_METRIC_IE(tlv_is_reach->metric_error) 
? "External" : "Internal");
-
-               switch (tlv_is_reach->virtual_flag) {
-                   case 0:
-                       printf(", IsNotVirtual");
-                       break;
-                   case 1:
-                        printf(", IsVirtual");
-                        break;
-                    default:
-                        printf(", bogus virtual flag 
0x%02x",tlv_is_reach->virtual_flag);
-                        break;     
-                   }
 
                tmp -= sizeof(struct isis_tlv_is_reach);
                tlv_is_reach++;

Reply via email to