]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Clean up types to squelch narrowing warnings.
authorGuy Harris <[email protected]>
Thu, 18 Apr 2019 02:53:00 +0000 (19:53 -0700)
committerGuy Harris <[email protected]>
Thu, 18 Apr 2019 02:53:00 +0000 (19:53 -0700)
18 files changed:
netdissect.h
print-babel.c
print-bgp.c
print-decnet.c
print-forces.c
print-icmp.c
print-icmp6.c
print-ip-demux.c
print-ip.c
print-ip6.c
print-isoclns.c
print-juniper.c
print-ldp.c
print-lldp.c
print-openflow-1.0.c
print-rsvp.c
print-sctp.c
print-udp.c

index c5b4ea04ce6706eb78de5618cb46f5e860010c70..822dd9c7be9929645ccaaf1921793be522d146de 100644 (file)
@@ -713,12 +713,12 @@ extern uint16_t in_cksum(const struct cksum_vec *, int);
 extern uint16_t in_cksum_shouldbe(uint16_t, uint16_t);
 
 /* IP protocol demuxing routines */
-extern void ip_print_demux(netdissect_options *, const u_char *, u_int, u_int, int, u_int, u_int, const u_char *);
+extern void ip_print_demux(netdissect_options *, const u_char *, u_int, u_int, int, u_int, uint8_t, const u_char *);
 
-extern uint16_t nextproto4_cksum(netdissect_options *, const struct ip *, const uint8_t *, u_int, u_int, u_int);
+extern uint16_t nextproto4_cksum(netdissect_options *, const struct ip *, const uint8_t *, u_int, u_int, uint8_t);
 
 /* in print-ip6.c */
-extern uint16_t nextproto6_cksum(netdissect_options *, const struct ip6_hdr *, const uint8_t *, u_int, u_int, u_int);
+extern uint16_t nextproto6_cksum(netdissect_options *, const struct ip6_hdr *, const uint8_t *, u_int, u_int, uint8_t);
 
 /* Utilities */
 extern void nd_print_trunc(netdissect_options *);
index 29865dd22c87f568f399b97b5c7c80e156f06732..00dcd14cb1fea7b3bd3570eba5f6d8c907a17b50 100644 (file)
@@ -364,7 +364,7 @@ babel_print_v2(netdissect_options *ndo,
     i = 0;
     while(i < bodylen) {
         const u_char *message;
-        u_int type, len;
+        uint8_t type, len;
 
         message = cp + 4 + i;
 
index 7b3985817389eab1c013986047129ae27e59ad11..a58041b7204680d12acf7c4577ab8d1fb22d44d2 100644 (file)
@@ -1540,7 +1540,7 @@ check_add_path(netdissect_options *ndo, const u_char *pptr, u_int length,
 
 static int
 bgp_attr_print(netdissect_options *ndo,
-               u_int atype, const u_char *pptr, u_int len)
+               uint8_t atype, const u_char *pptr, u_int len)
 {
     u_int i;
     uint16_t af;
@@ -2776,7 +2776,8 @@ bgp_update_print(netdissect_options *ndo,
     if (len) {
         /* do something more useful!*/
         while (len) {
-            u_int aflags, atype, alenlen, alen;
+            uint8_t aflags, atype, alenlen;
+            uint16_t alen;
 
             ND_TCHECK_2(p);
             if (length < 2)
index fcb85225750c95f530cf1724137bbcf053031167..2a19fd1cf1bdfb081db51b374e7e012646ba6e90 100644 (file)
@@ -502,7 +502,8 @@ decnet_print(netdissect_options *ndo,
 {
        const union routehdr *rhp;
        u_int mflags;
-       u_int dst, src, hops;
+       uint16_t dst, src;
+       u_int hops;
        u_int nsplen, pktlen;
        const u_char *nspp;
 
index 65d6e77f62015a1e89a420f5cb842df5020f553f..e05b5f7a78789c77223c89d1b9b0fe15187abf25 100644 (file)
@@ -1641,7 +1641,7 @@ forces_type_print(netdissect_options *ndo,
        /*XXX: 15 top level tlvs will probably be fine
           You are nuts if you send more ;-> */
        while (rlen != 0) {
-               u_int type, tlvl;
+               uint16_t type, tlvl;
 
                ND_TCHECK_SIZE(tltlv);
                type = GET_BE_U_2(tltlv->type);
index 2b8c1ff76e6311447d411169336523c300653c39..0f0e7a1069272458d7e70e9b7357aa8b9993d92e 100644 (file)
@@ -343,7 +343,8 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char *
         uint32_t raw_label;
         const u_char *snapend_save;
        const struct icmp_mpls_ext_object_header_t *icmp_mpls_ext_object_header;
-       u_int hlen, dport, mtu, obj_tlen, obj_class_num, obj_ctype;
+       u_int hlen, mtu, obj_tlen, obj_class_num, obj_ctype;
+       uint16_t dport;
        char buf[MAXHOSTNAMELEN + 100];
        struct cksum_vec vec[1];
 
index c5ce7ea5daa4c37016768286208ab5f142ee915b..9b6468f124a2daa9f15109bf7a628ea212e21899 100644 (file)
@@ -1031,7 +1031,7 @@ icmp6_print(netdissect_options *ndo,
        const struct ip6_hdr *ip;
        const struct ip6_hdr *oip;
        const struct udphdr *ouh;
-       u_int dport;
+       uint16_t dport;
        const u_char *ep;
        u_int prot;
 
index 2dae30d25f7200c562e55d82b1ec1418feaa71af..4cab6acce360ad2cb7cdccdfa7d3e3c4924b338a 100644 (file)
@@ -39,8 +39,8 @@
 void
 ip_print_demux(netdissect_options *ndo,
               const u_char *bp,
-              u_int length, u_int ver, int fragmented, u_int ttl_hl, u_int nh,
-              const u_char *iph)
+              u_int length, u_int ver, int fragmented, u_int ttl_hl,
+              uint8_t nh, const u_char *iph)
 {
        int advance;
        const char *p_name;
index a701fede62d5b0bfa844b27a31ed2551497372f0..ddc917d528c8099a1286db854cfa59186f86aa21 100644 (file)
@@ -141,13 +141,13 @@ trunc:
 uint16_t
 nextproto4_cksum(netdissect_options *ndo,
                  const struct ip *ip, const uint8_t *data,
-                 u_int len, u_int covlen, u_int next_proto)
+                 u_int len, u_int covlen, uint8_t next_proto)
 {
        struct phdr {
                uint32_t src;
                uint32_t dst;
-               u_char mbz;
-               u_char proto;
+               uint8_t mbz;
+               uint8_t proto;
                uint16_t len;
        } ph;
        struct cksum_vec vec[2];
index 9f8b4dbf63734ed7cf5f7fc3dd53eaf43723f36e..f8d234903719a199fe4156207fb1f5edb3246740 100644 (file)
@@ -174,7 +174,7 @@ trunc:
 uint16_t
 nextproto6_cksum(netdissect_options *ndo,
                  const struct ip6_hdr *ip6, const uint8_t *data,
-                u_int len, u_int covlen, u_int next_proto)
+                u_int len, u_int covlen, uint8_t next_proto)
 {
         struct {
                 struct in6_addr ph_src;
index fe2f225542291314663b4a1eec19150dbb174c1b..5ccd0b342a6b2fca14ccdc62f7b4876aff1654d1 100644 (file)
@@ -2108,7 +2108,7 @@ trunc:
  * it is called from various MT-TLVs (222,229,235,237)
  */
 
-static u_int
+static uint8_t
 isis_print_mtid(netdissect_options *ndo,
                 const uint8_t *tptr, const char *ident)
 {
@@ -2275,7 +2275,8 @@ isis_print(netdissect_options *ndo,
 
     uint8_t version, pdu_version, fixed_len;
     uint8_t pdu_type, pdu_max_area, max_area, pdu_id_length, id_length, tlv_type, tlv_len, tlen, alen, lan_alen, prefix_len;
-    u_int ext_is_len, ext_ip_len, mt_len;
+    u_int ext_is_len, ext_ip_len;
+    uint8_t mt_len;
     uint8_t isis_subtlv_idrp;
     const uint8_t *optr, *pptr, *tptr;
     u_int packet_len;
index 009897da49ed7b3c471b862ba5f9487d79354862..ba6c94a4ad21cd8a40b9f7ab8068c11bae36faef 100644 (file)
@@ -425,7 +425,7 @@ struct juniper_l2info_t {
     uint32_t caplen;
     uint32_t pictype;
     uint8_t direction;
-    uint8_t header_len;
+    u_int header_len;
     uint8_t cookie_len;
     uint8_t cookie_type;
     uint8_t cookie[8];
index 87805d2465437525e6c36155e4fe4d7ec021d84e..653ea37cbd5135018a54480aa67e63ccf0386b78 100644 (file)
@@ -233,7 +233,7 @@ static int ldp_pdu_print(netdissect_options *, const u_char *);
 #define TLV_TCHECK(minlen) \
     ND_TCHECK_LEN(tptr, minlen); if (tlv_tlen < minlen) goto badtlv;
 
-static int
+static u_int
 ldp_tlv_print(netdissect_options *ndo,
               const u_char *tptr,
               u_short msg_tlen)
@@ -567,7 +567,8 @@ ldp_pdu_print(netdissect_options *ndo,
     const struct ldp_msg_header *ldp_msg_header;
     const u_char *tptr,*msg_tptr;
     u_short tlen;
-    u_short pdu_len,msg_len,msg_type,msg_tlen;
+    u_short pdu_len,msg_len,msg_type;
+    u_int msg_tlen;
     int hexdump,processed;
 
     ldp_com_header = (const struct ldp_common_header *)pptr;
index 054a961782ddf8d35a3a41c1d77b17d581fd4d71..a16e08417df1f15b9ba7f1f07b43c52359d49059 100644 (file)
@@ -1166,7 +1166,8 @@ lldp_private_dcbx_print(netdissect_options *ndo,
     uint8_t tval;
     uint16_t tlv;
     uint32_t i, pgval, uval;
-    u_int tlen, tlv_type, tlv_len;
+    u_int tlen, tlv_type;
+    uint16_t tlv_len;
     const u_char *tptr, *mptr;
 
     if (len < 4) {
index 12051992a5504c27896f2140a0a95c36ee4cec39..d7ac8b248e3472a0012ff50ebab5bf277596d39e 100644 (file)
@@ -1351,7 +1351,7 @@ of10_match_print(netdissect_options *ndo,
        uint32_t wildcards;
        uint16_t dl_type;
        uint8_t nw_proto;
-       u_char nw_bits;
+       u_int nw_bits;
        const char *field_name;
 
        /* wildcards */
index 21b422f63e8e2c29cccfa8919b0913ba4267c38d..ed9373765509afdb99ea183624e625fe5ffd21d4 100644 (file)
@@ -673,8 +673,8 @@ rsvp_obj_print(netdissect_options *ndo,
         const struct rsvp_obj_frr_t *rsvp_obj_frr;
     } obj_ptr;
 
-    u_short rsvp_obj_len,rsvp_obj_ctype,rsvp_obj_class_num,obj_tlen;
-    u_int intserv_serv_tlen;
+    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;
     union {
index e0c22076edf9e76819c1cbeba7660d3ffa9705fb..9384a93d2847db82f76e468291ccea278471c8bf 100644 (file)
@@ -562,7 +562,7 @@ sctp_print(netdissect_options *ndo,
            const struct sctpDataPart *dataHdrPtr;
            uint8_t chunkFlg;
            uint32_t ppid;
-           u_int payload_size;
+           uint16_t payload_size;
 
            chunkFlg = GET_U_1(chunkDescPtr->chunkFlg);
            if ((chunkFlg & SCTP_DATA_UNORDERED) == SCTP_DATA_UNORDERED)
index 4878b7b47349f59cd236f3c0a0478da962e94050..646d414237b2f486625b0d40ada973385af511e3 100644 (file)
@@ -347,9 +347,9 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo
                        } else {
                                ND_PRINT("%s.%s > %s.%s: ",
                                        ip6addr_string(ndo, ip6->ip6_src),
-                                       udpport_string(ndo, sport),
+                                       udpport_string(ndo, (uint16_t)sport),
                                        ip6addr_string(ndo, ip6->ip6_dst),
-                                       udpport_string(ndo, dport));
+                                       udpport_string(ndo, (uint16_t)dport));
                        }
                } else {
                        if (sport != -1) {
@@ -367,15 +367,15 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo
                        } else {
                                ND_PRINT("%s.%s > %s.%s: ",
                                        ipaddr_string(ndo, ip->ip_src),
-                                       udpport_string(ndo, sport),
+                                       udpport_string(ndo, (uint16_t)sport),
                                        ipaddr_string(ndo, ip->ip_dst),
-                                       udpport_string(ndo, dport));
+                                       udpport_string(ndo, (uint16_t)dport));
                        }
                } else {
                        if (sport != -1) {
                                ND_PRINT("%s > %s: ",
-                                       udpport_string(ndo, sport),
-                                       udpport_string(ndo, dport));
+                                       udpport_string(ndo, (uint16_t)sport),
+                                       udpport_string(ndo, (uint16_t)dport));
                        }
                }
        }