]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix compilation warnings: set but unused variables. 344/head
authorGleb Smirnoff <[email protected]>
Mon, 25 Nov 2013 20:16:47 +0000 (00:16 +0400)
committerGleb Smirnoff <[email protected]>
Mon, 25 Nov 2013 20:16:47 +0000 (00:16 +0400)
print-esp.c
print-icmp6.c
print-pgm.c
print-pim.c

index 2c143cd6a575431ead790d71ce8a8aef5454743b..407fdb361193a4cb97901f57f4235a93c57e0a35 100644 (file)
@@ -225,7 +225,6 @@ static int
 espprint_decode_encalgo(netdissect_options *ndo,
                        char *decode, struct sa_list *sa)
 {
-       int len;
        size_t i;
        const EVP_CIPHER *evp;
        int authlen = 0;
@@ -238,7 +237,6 @@ espprint_decode_encalgo(netdissect_options *ndo,
        }
        *colon = '\0';
        
-       len = colon - decode;
        if (strlen(decode) > strlen("-hmac96") &&
            !strcmp(decode + strlen(decode) - strlen("-hmac96"),
                    "-hmac96")) {
@@ -550,7 +548,6 @@ esp_print(netdissect_options *ndo,
 #ifdef HAVE_LIBCRYPTO
        struct ip *ip;
        struct sa_list *sa = NULL;
-       int espsecret_keylen;
 #ifdef INET6
        struct ip6_hdr *ip6 = NULL;
 #endif
@@ -561,7 +558,6 @@ esp_print(netdissect_options *ndo,
        u_char *ivoff;
        u_char *p;
        EVP_CIPHER_CTX ctx;
-       int blocksz;
 #endif
 
        esp = (struct newesp *)bp;
@@ -665,7 +661,6 @@ esp_print(netdissect_options *ndo,
        ivoff = (u_char *)(esp + 1) + 0;
        ivlen = sa->ivlen;
        secret = sa->secret;
-       espsecret_keylen = sa->secretlen;
        ep = ep - sa->authlen;
 
        if (sa->evp) {
@@ -673,8 +668,6 @@ esp_print(netdissect_options *ndo,
                if (EVP_CipherInit(&ctx, sa->evp, secret, NULL, 0) < 0)
                        (*ndo->ndo_warning)(ndo, "espkey init failed");
 
-               blocksz = EVP_CIPHER_CTX_block_size(&ctx);
-
                p = ivoff;
                EVP_CipherInit(&ctx, NULL, NULL, p, 0);
                EVP_Cipher(&ctx, p + ivlen, p + ivlen, ep - (p + ivlen));
index 0b38c43e1d78c926d2b734b3b6f90c74d64cccc2..811e5a06d552310c40346f65ff52a1cef0c2eb19 100644 (file)
@@ -669,9 +669,7 @@ static void
 icmp6_opt_print(const u_char *bp, int resid)
 {
        const struct nd_opt_hdr *op;
-       const struct nd_opt_hdr *opl;   /* why there's no struct? */
        const struct nd_opt_prefix_info *opp;
-       const struct icmp6_opts_redirect *opr;
        const struct nd_opt_mtu *opm;
        const struct nd_opt_rdnss *oprd;
        const struct nd_opt_dnssl *opds;
@@ -708,12 +706,10 @@ icmp6_opt_print(const u_char *bp, int resid)
 
                switch (op->nd_opt_type) {
                case ND_OPT_SOURCE_LINKADDR:
-                       opl = (struct nd_opt_hdr *)op;
                        l = (op->nd_opt_len << 3) - 2;
                        print_lladdr(cp + 2, l);
                        break;
                case ND_OPT_TARGET_LINKADDR:
-                       opl = (struct nd_opt_hdr *)op;
                        l = (op->nd_opt_len << 3) - 2;
                        print_lladdr(cp + 2, l);
                        break;
@@ -729,7 +725,6 @@ icmp6_opt_print(const u_char *bp, int resid)
                         printf(", pref. time %s", get_lifetime(EXTRACT_32BITS(&opp->nd_opt_pi_preferred_time)));
                        break;
                case ND_OPT_REDIRECTED_HEADER:
-                       opr = (struct icmp6_opts_redirect *)op;
                         print_unknown_data(bp,"\n\t    ",op->nd_opt_len<<3);
                        /* xxx */
                        break;
index 72c80d9a5da98a3333244bc3792d29267a247677..b6138c6fdd4a6d76314381eee68b5095eb847914 100644 (file)
@@ -171,7 +171,7 @@ pgm_print(register const u_char *bp, register u_int length,
 #else
        char nla_buf[INET_ADDRSTRLEN];
 #endif
-       u_int8_t opt_type, opt_len, flags1, flags2;
+       u_int8_t opt_type, opt_len;
        u_int32_t seq, opts_len, len, offset;
 
        pgm = (struct pgm_header *)bp;
@@ -542,8 +542,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_FRAGMENT option, length %u != 16]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    seq = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    offset = EXTRACT_32BITS(bp);
@@ -555,8 +554,7 @@ pgm_print(register const u_char *bp, register u_int length,
                    break;
 
                case PGM_OPT_NAK_LIST:
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    opt_len -= sizeof(u_int32_t);       /* option header */
                    (void)printf(" NAK LIST");
                    while (opt_len) {
@@ -577,8 +575,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_JOIN option, length %u != 8]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    seq = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    (void)printf(" JOIN %u", seq);
@@ -590,8 +587,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_NAK_BO_IVL option, length %u != 12]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    offset = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    seq = EXTRACT_32BITS(bp);
@@ -605,8 +601,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_NAK_BO_RNG option, length %u != 12]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    offset = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    seq = EXTRACT_32BITS(bp);
@@ -616,8 +611,7 @@ pgm_print(register const u_char *bp, register u_int length,
                    break;
 
                case PGM_OPT_REDIRECT:
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    switch (EXTRACT_16BITS(bp)) {
                    case AFI_IP:
                        addr_size = sizeof(struct in_addr);
@@ -652,8 +646,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_PARITY_PRM option, length %u != 8]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    len = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    (void)printf(" PARITY MAXTGS %u", len);
@@ -665,8 +658,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_PARITY_GRP option, length %u != 8]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    seq = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    (void)printf(" PARITY GROUP %u", seq);
@@ -678,8 +670,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_CURR_TGSIZE option, length %u != 8]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    len = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    (void)printf(" PARITY ATGS %u", len);
@@ -691,8 +682,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_NBR_UNREACH option, length %u != 4]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    (void)printf(" NBR_UNREACH");
                    opts_len -= 4;
                    break;
@@ -708,8 +698,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_SYN option, length %u != 4]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    (void)printf(" SYN");
                    opts_len -= 4;
                    break;
@@ -719,8 +708,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_FIN option, length %u != 4]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    (void)printf(" FIN");
                    opts_len -= 4;
                    break;
@@ -730,8 +718,7 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_RST option, length %u != 4]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    (void)printf(" RST");
                    opts_len -= 4;
                    break;
@@ -747,15 +734,13 @@ pgm_print(register const u_char *bp, register u_int length,
                        (void)printf("[Bad OPT_CRQST option, length %u != 4]", opt_len);
                        return;
                    }
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    (void)printf(" CRQST");
                    opts_len -= 4;
                    break;
 
                case PGM_OPT_PGMCC_DATA:
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    offset = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    switch (EXTRACT_16BITS(bp)) {
@@ -788,8 +773,7 @@ pgm_print(register const u_char *bp, register u_int length,
                    break;
 
                case PGM_OPT_PGMCC_FEEDBACK:
-                   flags1 = *bp++;
-                   flags2 = *bp++;
+                   bp += 2;
                    offset = EXTRACT_32BITS(bp);
                    bp += sizeof(u_int32_t);
                    switch (EXTRACT_16BITS(bp)) {
index 3cd681090d457f14871ff7fa12c7f574ca1ffdda..713608369b0bfeb23149513430eecb6b0a8e5b97 100644 (file)
@@ -121,7 +121,7 @@ static void pimv2_print(register const u_char *bp, register u_int len, u_int cks
 static void
 pimv1_join_prune_print(register const u_char *bp, register u_int len)
 {
-       int maddrlen, addrlen, ngroups, njoin, nprune;
+       int ngroups, njoin, nprune;
        int njp;
 
        /* If it's a single group and a single source, use 1-line output. */
@@ -162,8 +162,6 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len)
        len -= 8;
 
        TCHECK2(bp[0], 4);
-       maddrlen = bp[1];
-       addrlen = bp[2];
        ngroups = bp[3];
        bp += 4;
        len -= 4;