]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-rsvp.c
CI: Add warning exemptions for Sun C (suncc-5.15) on Solaris 10
[tcpdump] / print-rsvp.c
index 2ff9fa96a94bc722fbd242267fa966f45970e2b2..153070e83537339e596dadc0051491b60b543897 100644 (file)
@@ -19,9 +19,7 @@
 
 /* specification: RFC 2205 */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
@@ -461,7 +459,7 @@ static const struct tok rsvp_obj_error_code_diffserv_te_values[] = {
     { 6,                      "CT/setup priority and CT/holding priority do not form a configured TE-Class" },
     { 7,                      "Inconsistency between signaled PSC and signaled CT" },
     { 8,                      "Inconsistency between signaled PHBs and signaled CT" },
-   { 0, NULL}
+    { 0, NULL}
 };
 
 /* rfc3473 / rfc 3471 */
@@ -514,7 +512,6 @@ rsvp_intserv_print(netdissect_options *ndo,
                    const u_char *tptr, u_int obj_tlen)
 {
     u_int parameter_id,parameter_length;
-    float bw;
 
     ND_ICHECK_U(obj_tlen, <, 4);
     parameter_id = GET_U_1(tptr);
@@ -551,8 +548,8 @@ rsvp_intserv_print(netdissect_options *ndo,
         * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         */
         if (parameter_length == 4) {
-            bw = GET_BE_F_4(tptr + 4);
-            ND_PRINT("\n\t\tPath b/w estimate: %.10g Mbps", bw / 125000);
+            ND_PRINT("\n\t\tPath b/w estimate: %.10g Mbps",
+                     GET_BE_F_4(tptr + 4) / 125000);
         }
         break;
 
@@ -604,12 +601,12 @@ rsvp_intserv_print(netdissect_options *ndo,
         */
 
         if (parameter_length == 20) {
-            bw = GET_BE_F_4(tptr + 4);
-            ND_PRINT("\n\t\tToken Bucket Rate: %.10g Mbps", bw / 125000);
-            bw = GET_BE_F_4(tptr + 8);
-            ND_PRINT("\n\t\tToken Bucket Size: %.10g bytes", bw);
-            bw = GET_BE_F_4(tptr + 12);
-            ND_PRINT("\n\t\tPeak Data Rate: %.10g Mbps", bw / 125000);
+            ND_PRINT("\n\t\tToken Bucket Rate: %.10g Mbps",
+                     GET_BE_F_4(tptr + 4) / 125000);
+            ND_PRINT("\n\t\tToken Bucket Size: %.10g bytes",
+                     GET_BE_F_4(tptr + 8));
+            ND_PRINT("\n\t\tPeak Data Rate: %.10g Mbps",
+                     GET_BE_F_4(tptr + 12) / 125000);
             ND_PRINT("\n\t\tMinimum Policed Unit: %u bytes",
                      GET_BE_U_4(tptr + 16));
             ND_PRINT("\n\t\tMaximum Packet Size: %u bytes",
@@ -629,8 +626,7 @@ rsvp_intserv_print(netdissect_options *ndo,
         */
 
         if (parameter_length == 8) {
-            bw = GET_BE_F_4(tptr + 4);
-            ND_PRINT("\n\t\tRate: %.10g Mbps", bw / 125000);
+            ND_PRINT("\n\t\tRate: %.10g Mbps", GET_BE_F_4(tptr + 4) / 125000);
             ND_PRINT("\n\t\tSlack Term: %u", GET_BE_U_4(tptr + 8));
         }
         break;
@@ -683,8 +679,7 @@ rsvp_obj_print(netdissect_options *ndo,
     u_short rsvp_obj_len,rsvp_obj_ctype,rsvp_obj_class_num;
     u_int obj_tlen,intserv_serv_tlen;
     int hexdump;
-    u_int processed,padbytes,error_code,error_value,i,sigcheck;
-    float bw;
+    u_int processed,padbytes,error_code,error_value,sigcheck;
     u_int namelen;
 
     u_int action, subchannel;
@@ -1207,8 +1202,7 @@ rsvp_obj_print(netdissect_options *ndo,
                 if (obj_tlen < 4+namelen)
                     goto obj_tooshort;
                 ND_PRINT("%s  Session Name: ", indent);
-                for (i = 0; i < namelen; i++)
-                    fn_print_char(ndo, GET_U_1(obj_tptr + 4 + i));
+                nd_printjn(ndo, obj_tptr + 4, namelen);
                 ND_PRINT("%s  Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)",
                        indent,
                        GET_U_1(obj_tptr),
@@ -1541,13 +1535,12 @@ rsvp_obj_print(netdissect_options *ndo,
             case RSVP_CTYPE_1: /* new style */
                 if (obj_tlen < sizeof(struct rsvp_obj_frr_t))
                     goto obj_tooshort;
-                bw = GET_BE_F_4(obj_ptr.rsvp_obj_frr->bandwidth);
                 ND_PRINT("%s  Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
                        indent,
                        GET_U_1(obj_ptr.rsvp_obj_frr->setup_prio),
                        GET_U_1(obj_ptr.rsvp_obj_frr->hold_prio),
                        GET_U_1(obj_ptr.rsvp_obj_frr->hop_limit),
-                       bw * 8 / 1000000);
+                       GET_BE_F_4(obj_ptr.rsvp_obj_frr->bandwidth) * 8 / 1000000);
                 ND_PRINT("%s  Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x",
                        indent,
                        GET_BE_U_4(obj_ptr.rsvp_obj_frr->include_any),
@@ -1560,13 +1553,12 @@ rsvp_obj_print(netdissect_options *ndo,
             case RSVP_CTYPE_TUNNEL_IPV4: /* old style */
                 if (obj_tlen < 16)
                     goto obj_tooshort;
-                bw = GET_BE_F_4(obj_ptr.rsvp_obj_frr->bandwidth);
                 ND_PRINT("%s  Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps",
                        indent,
                        GET_U_1(obj_ptr.rsvp_obj_frr->setup_prio),
                        GET_U_1(obj_ptr.rsvp_obj_frr->hold_prio),
                        GET_U_1(obj_ptr.rsvp_obj_frr->hop_limit),
-                       bw * 8 / 1000000);
+                       GET_BE_F_4(obj_ptr.rsvp_obj_frr->bandwidth) * 8 / 1000000);
                 ND_PRINT("%s  Include Colors: 0x%08x, Exclude Colors: 0x%08x",
                        indent,
                        GET_BE_U_4(obj_ptr.rsvp_obj_frr->include_any),