]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Put "}" at beginning of line with "else" to keep a consistent style
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 21 Apr 2023 12:44:55 +0000 (14:44 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 21 Apr 2023 12:45:18 +0000 (14:45 +0200)
[skip ci]

22 files changed:
addrtoname.c
addrtostr.c
missing/getopt_long.c
parsenfsfh.c
print-bgp.c
print-cdp.c
print-domain.c
print-fddi.c
print-fr.c
print-geneve.c
print-icmp6.c
print-ip.c
print-ldp.c
print-mobility.c
print-nfs.c
print-nsh.c
print-olsr.c
print-openflow-1.0.c
print-pim.c
print-radius.c
print-rpki-rtr.c
print-udp.c

index b83d1ee2500f2283f9aa11d051b0e73d526df053..b60384cb74ca24ed93adb539c036816751c4d5fc 100644 (file)
@@ -531,8 +531,7 @@ lookup_nsap(netdissect_options *ndo, const u_char *nsap,
                k = (ensap[0] << 8) | ensap[1];
                j = (ensap[2] << 8) | ensap[3];
                i = (ensap[4] << 8) | ensap[5];
-       }
-       else
+       } else
                i = j = k = 0;
 
        tp = &nsaptable[(i ^ j) & (HASHNAMESIZE-1)];
index f1ccf797b04553fe4d53595ffabf2318552d2b53..5a08929a4c23dfd0b2bfca2bd9ec369626426343 100644 (file)
@@ -132,8 +132,7 @@ addrtostr6 (const void *src, char *dst, size_t size)
       if (cur.base == -1)
            cur.base = i, cur.len = 1;
       else cur.len++;
-    }
-    else if (cur.base != -1) {
+    } else if (cur.base != -1) {
       if (best.base == -1 || cur.len > best.len)
          best = cur;
       cur.base = -1;
index ece0006235344270a561fbccf2e7e5870fd940cf..e9b1ef5770a132fb546c09ddde2bf29c3c5b1f96 100644 (file)
@@ -419,8 +419,7 @@ start:
                                permute_args(nonopt_start, nonopt_end,
                                    optind, nargv);
                                optind -= nonopt_end - nonopt_start;
-                       }
-                       else if (nonopt_start != -1) {
+                       } else if (nonopt_start != -1) {
                                /*
                                 * If we skipped non-options, set optind
                                 * to the first of them.
index cd9436992d7762156439b99578cc85e663cd1e66..594177c1e02d2b79483b5b07f464e50972696549 100644 (file)
@@ -138,8 +138,7 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
                        /* bytes[2,3] == (0,0); must be Auspex */
                        /* XXX or could be Ultrix+MASSBUS "hp" disk? */
                        fhtype = FHT_AUSPEX;
-                   }
-                   else {
+                   } else {
                        /*
                         * bytes[2,3] != (0,0); rules out Auspex, could be
                         * DECOSF, SUNOS4, or IRIX4
@@ -148,23 +147,20 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
                                (GET_U_1(fhp + 8) == 12) && (GET_U_1(fhp + 9) == 0)) {
                            /* seems to be DECOSF, with minor == 0 */
                            fhtype = FHT_DECOSF;
-                       }
-                       else {
+                       } else {
                            /* could be SUNOS4 or IRIX4 */
                            /* XXX the test of fhp[5] == 8 could be wrong */
                            if ((GET_U_1(fhp + 4) == 0) && (GET_U_1(fhp + 5) == 8) && (GET_U_1(fhp + 6) == 0) &&
                                (GET_U_1(fhp + 7) == 0)) {
                                /* looks like a length, not a file system typecode */
                                fhtype = FHT_IRIX4;
-                           }
-                           else {
+                           } else {
                                /* by elimination */
                                fhtype = FHT_SUNOS4;
                            }
                        }
                    }
-               }
-               else {
+               } else {
                    /*
                     * bytes[0,1] != (0,0); rules out Auspex, IRIX4, SUNOS4
                     * could be IRIX5, DECOSF, UCX, Ultrix, SUNOS5
@@ -183,35 +179,30 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
                        /*XXX we probably only need to test of these two bytes */
                        else if ((len >= 24/4) && (GET_U_1(fhp + 21) == 0) && (GET_U_1(fhp + 23) == 0)) {
                            fhtype = FHT_ULTRIX;
-                       }
-                       else {
+                       } else {
                            /* Could be SUNOS5/IRIX5, maybe AIX */
                            /* XXX no obvious difference between SUNOS5 and IRIX5 */
                            if (GET_U_1(fhp + 9) == 10)
                                fhtype = FHT_SUNOS5;
                            /* XXX what about AIX? */
                        }
-                   }
-                   else {
+                   } else {
                        /*
                         * bytes[2,3] != (0,0); rules out Ultrix, could be
                         * DECOSF, SUNOS5, IRIX5, AIX, HP-UX, or UCX
                         */
                        if ((GET_U_1(fhp + 8) == 12) && (GET_U_1(fhp + 9) == 0)) {
                            fhtype = FHT_DECOSF;
-                       }
-                       else if ((GET_U_1(fhp + 8) == 0) && (GET_U_1(fhp + 9) == 10)) {
+                       } else if ((GET_U_1(fhp + 8) == 0) && (GET_U_1(fhp + 9) == 10)) {
                            /* could be SUNOS5/IRIX5, AIX, HP-UX */
                            if ((GET_U_1(fhp + 7) == 0) && (GET_U_1(fhp + 6) == 0) &&
                                (GET_U_1(fhp + 5) == 0) && (GET_U_1(fhp + 4) == 0)) {
                                /* XXX is this always true of HP-UX? */
                                fhtype = FHT_HPUX9;
-                           }
-                           else if (GET_U_1(fhp + 7) == 2) {
+                           } else if (GET_U_1(fhp + 7) == 2) {
                                /* This would be MNT_NFS on AIX, which is impossible */
                                fhtype = FHT_SUNOS5;    /* or maybe IRIX5 */
-                           }
-                           else {
+                           } else {
                                /*
                                 * XXX Could be SUNOS5/IRIX5 or AIX.  I don't
                                 * XXX see any way to disambiguate these, so
@@ -220,12 +211,10 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
                                 */
                                fhtype = FHT_SUNOS5;    /* or maybe IRIX5 */
                            }
-                       }
-                       else {
+                       } else {
                            if (is_UCX(ndo, fhp, len)) {
                                fhtype = FHT_VMSUCX;
-                           }
-                           else {
+                           } else {
                                fhtype = FHT_UNKNOWN;
                            }
                        }
@@ -346,8 +335,7 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
                    memset((char *)fsidp, 0, sizeof(*fsidp));
                /* just use the whole thing */
                memcpy((char *)fsidp, (const char *)fh, 14);
-           }
-           else {
+           } else {
                uint32_t tempa[4];      /* at least 16 bytes, maybe more */
 
                memset((char *)tempa, 0, sizeof(tempa));
@@ -449,12 +437,10 @@ is_UCX(netdissect_options *ndo, const unsigned char *fhp, u_int len)
                   return(0);
                else
                   continue;
-           }
-           else if (GET_U_1(fhp + i) == 0) {
+           } else if (GET_U_1(fhp + i) == 0) {
                seen_null = 1;
                continue;
-           }
-           else
+           } else
                return(0);
        }
 
index 59b080f2ae5445db7f36668259410350b9ead2a9..694346d733205956ce83733dc7c396eba0c0a3c3 100644 (file)
@@ -3206,8 +3206,7 @@ bgp_notification_print_code(netdissect_options *ndo,
             /* garbage, hexdump it all */
             if (shutdown_comm_length > length - 1) {
                 ND_PRINT(", invalid Shutdown Communication length");
-            }
-            else if (shutdown_comm_length == 0) {
+            } else if (shutdown_comm_length == 0) {
                 ND_PRINT(", empty Shutdown Communication");
                 remainder_offset += 1;
             }
index 0e88929b75352a024c8620f37eef917316fe40b7..c66c0d11d962f43efe92f2400d72a66911713076 100644 (file)
@@ -415,8 +415,7 @@ cdp_print_addr(netdissect_options *ndo,
                        ND_PRINT("IPv4 (%u) %s", num, GET_IPADDR_STRING(p));
                        p += al;
                        l -= al;
-               }
-               else if (pt == PT_IEEE_802_2 && pl == 8 &&
+               } else if (pt == PT_IEEE_802_2 && pl == 8 &&
                         memcmp(p, prot_ipv6, 8) == 0 && al == 16) {
                        /*
                         * IPv6: protocol type = IEEE 802.2 header,
@@ -434,8 +433,7 @@ cdp_print_addr(netdissect_options *ndo,
                        ND_PRINT("IPv6 (%u) %s", num, GET_IP6ADDR_STRING(p));
                        p += al;
                        l -= al;
-               }
-               else {
+               } else {
                        /*
                         * Generic case: just print raw data
                         */
index d2275a5e2a30efdff142b6185108f6874e8a9b27..d98cd11c00544198eb8c320c570e8e2346f57756 100644 (file)
@@ -1070,8 +1070,7 @@ domain_print(netdissect_options *ndo,
                        if (arcount)
                                goto trunc;
                }
-       }
-       else {
+       } else {
                /* this is a request */
                ND_PRINT("%u%s%s%s", GET_BE_U_2(np->id),
                          ns_ops[DNS_OPCODE(flags)],
@@ -1088,8 +1087,7 @@ domain_print(netdissect_options *ndo,
                                ND_PRINT(" [%uq]", qdcount);
                        if (ancount != 1)
                                ND_PRINT(" [%ua]", ancount);
-               }
-               else {
+               } else {
                        if (ancount)
                                ND_PRINT(" [%ua]", ancount);
                        if (qdcount != 1)
index fb8d3ed57ca1e113ad270deff78c7c3c84cc7acb..75a1055fc4832c51d83af4f5e67960c076574cfc 100644 (file)
@@ -240,8 +240,7 @@ extract_fddi_addrs(const struct fddi_header *fddip, char *fsrc, char *fdst)
                        fdst[i] = fddi_bit_swap[fddip->fddi_dhost[i]];
                for (i = 0; i < 6; ++i)
                        fsrc[i] = fddi_bit_swap[fddip->fddi_shost[i]];
-       }
-       else {
+       } else {
                memcpy(fdst, (const char *)fddip->fddi_dhost, 6);
                memcpy(fsrc, (const char *)fddip->fddi_shost, 6);
        }
index f0d7fbeb12b38d4019a4f0bfa618e6124ec74966..853dc2f48637dffca10e9901f38e041ff65219b8 100644 (file)
@@ -1142,8 +1142,7 @@ fr_q933_print_ie_codeset_0_5(netdissect_options *ndo, u_int iecode,
             dlci = ((GET_U_1(p) & 0x3F) << 4) | ((GET_U_1(p + 1) & 0x78) >> 3);
             if (ielength == 4) {
                 dlci = (dlci << 6) | ((GET_U_1(p + 2) & 0x7E) >> 1);
-           }
-            else if (ielength == 5) {
+           } else if (ielength == 5) {
                 dlci = (dlci << 13) | (GET_U_1(p + 2) & 0x7F) | ((GET_U_1(p + 3) & 0x7E) >> 1);
            }
 
index 364941adc1b79671aab746d81f215d42ba5ad8d8..59dca93e047823de2ef2906decc6e7a314880a56 100644 (file)
@@ -274,8 +274,7 @@ geneve_print(netdissect_options *ndo, const u_char *bp, u_int len)
         if (ndo->ndo_vflag) {
             if (! geneve_opts_print(ndo, bp, opts_len))
                 goto invalid;
-        }
-        else {
+        } else {
             ND_TCHECK_LEN(bp, opts_len);
             ND_PRINT("%u bytes", opts_len);
         }
index d642f83106a8c6500c3fa476b2112a88c0cba72f..ae2596aca37fd0d6a9acd517a2cabd88c8e57dd3 100644 (file)
@@ -1328,8 +1328,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot)
                        if (ND_TTEST_2(uh->uh_dport)) {
                                *prot = nh;
                                return(uh);
-                       }
-                       else
+                       } else
                                return(NULL);
                        /* NOTREACHED */
 
index 23ba99c970075099b9e5a80a598967e2c4081b6e..f90c58a041a8b1987724987d4134ec11141841e6 100644 (file)
@@ -363,8 +363,7 @@ ip_print(netdissect_options *ndo,
             if (len) {
                 ND_PRINT("bad-len %u", len);
                 return;
-            }
-            else {
+            } else {
                 /* we guess that it is a TSO send */
                 len = length;
             }
index a62d22ba95a60a08f30b946d5ecaf038e635567a..0e0194a933867cb93ed5c33b72e72ec471623f36 100644 (file)
@@ -364,8 +364,7 @@ ldp_tlv_print(netdissect_options *ndo,
                    ND_PRINT(": IPv4 prefix (invalid length)");
                else
                    ND_PRINT(": IPv4 prefix %s", buf);
-           }
-           else if (af == AFNUM_IP6) {
+           } else if (af == AFNUM_IP6) {
                i=decode_prefix6(ndo, tptr, tlv_tlen, buf, sizeof(buf));
                if (i == -2)
                    goto trunc;
@@ -375,8 +374,7 @@ ldp_tlv_print(netdissect_options *ndo,
                    ND_PRINT(": IPv6 prefix (invalid length)");
                else
                    ND_PRINT(": IPv6 prefix %s", buf);
-           }
-           else
+           } else
                ND_PRINT(": Address family %u prefix", af);
            break;
        case LDP_FEC_HOSTADDRESS:
index 55340ca56d2f08625ab07819641a54095c686bf3..dab853e05c92c4b0ea38023c278208433ee5b056 100644 (file)
@@ -130,8 +130,7 @@ mobility_opt_print(netdissect_options *ndo,
                else {
                        if (i + 1 < len) {
                                optlen = GET_U_1(bp + i + 1) + 2;
-                       }
-                       else
+                       } else
                                goto trunc;
                }
                if (i + optlen > len)
index c90eadbd2fa03fbc69af0b667332439e218ad19a..8bb4718e0a8319080b49db8c8cd638021b56c829 100644 (file)
@@ -970,8 +970,7 @@ xid_map_enter(netdissect_options *ndo,
                                 sizeof(ip->ip_src));
                UNALIGNED_MEMCPY(&xmep->server, ip->ip_dst,
                                 sizeof(ip->ip_dst));
-       }
-       else if (ip6) {
+       } else if (ip6) {
                xmep->ipver = 6;
                UNALIGNED_MEMCPY(&xmep->client, ip6->ip6_src,
                                 sizeof(ip6->ip6_src));
index 12a63cd6370c17454490b18b8d77d88955dfce5b..db78dee62b5c3950ea3715d71ed3c4f39c258112 100644 (file)
@@ -189,8 +189,7 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len)
                 bp += NSH_HDR_WORD_SIZE;
             }
             past_headers = 1;
-        }
-        else if (md_type == MD_TYPE2) {
+        } else if (md_type == MD_TYPE2) {
             n = 0;
             while (n < length - 2) {
                 uint16_t tlv_class;
index 1b0345fc682ec083e6bf63203e3028d01add1a7d..75acc8363a18371144b8060c669bdabce8e27832 100644 (file)
@@ -380,8 +380,7 @@ olsr_print(netdissect_options *ndo,
 
             msg_tlen = msg_len - sizeof(struct olsr_msg6);
             msg_data = tptr + sizeof(struct olsr_msg6);
-        }
-        else { /* (!is_ipv6) */
+        } else {       /* (!is_ipv6) */
             ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg4));
             msgptr.v4 = (const struct olsr_msg4 *) tptr;
             msg_type = GET_U_1(msgptr.v4->msg_type);
@@ -535,8 +534,7 @@ olsr_print(netdissect_options *ndo,
                     msg_data += sizeof(struct olsr_hna6);
                     msg_tlen -= sizeof(struct olsr_hna6);
                 }
-            }
-            else {
+            } else {
                 int col = 0;
 
                 ND_PRINT("\n\t  Advertised networks (total %u)",
index 00c4fdd35a41acdfe0b10ae8ea4f9ff0d3d7b384..da0b8947c3768c9052b42dd42b7444374e2c0fa4 100644 (file)
@@ -1265,8 +1265,7 @@ of10_match_print(netdissect_options *ndo,
                  && ! (wildcards & OFPFW_NW_PROTO) && nw_proto == IPPROTO_ICMP
                  ? "icmp_code" : "tp_dst";
                ND_PRINT("%smatch %s %u", pfx, field_name, GET_BE_U_2(cp));
-       }
-       else
+       } else
                ND_TCHECK_2(cp);
 }
 
index cd288e8dc9c90a963bfec59750c64d9c14b4b410..2a33c1ffb6796eeb390eb93d2457cab198d16593 100644 (file)
@@ -599,8 +599,7 @@ pimv2_addr_print(netdissect_options *ndo,
                if (af == AFNUM_IP) {
                        if (!silent)
                                ND_PRINT("%s", GET_IPADDR_STRING(bp));
-               }
-               else if (af == AFNUM_IP6) {
+               } else if (af == AFNUM_IP6) {
                        if (!silent)
                                ND_PRINT("%s", GET_IP6ADDR_STRING(bp));
                }
@@ -616,8 +615,7 @@ pimv2_addr_print(netdissect_options *ndo,
                                if (GET_U_1(bp + 1) != 32)
                                        ND_PRINT("/%u", GET_U_1(bp + 1));
                        }
-               }
-               else if (af == AFNUM_IP6) {
+               } else if (af == AFNUM_IP6) {
                        if (!silent) {
                                ND_PRINT("%s", GET_IP6ADDR_STRING(bp + 2));
                                if (GET_U_1(bp + 1) != 128)
index 1d3ddd60e84115aebd79955658961e9f3b57b9f2..a15afea6bc59eba61593c1a529b96107effad8d0 100644 (file)
@@ -916,8 +916,7 @@ print_attr_num(netdissect_options *ndo,
             ND_PRINT("Tag[%u] ", GET_U_1(data));
          data++;
          data_value = GET_BE_U_3(data);
-      }
-      else {
+      } else {
          data_value = GET_BE_U_4(data);
       }
       if ( data_value <= (uint32_t)(attr_type[attr_code].siz_subtypes - 1 +
@@ -926,8 +925,7 @@ print_attr_num(netdissect_options *ndo,
          ND_PRINT("%s", table[data_value]);
       else
          ND_PRINT("#%u", data_value);
-   }
-   else {
+   } else {
       switch(attr_code) /* Be aware of special cases... */
       {
         case FRM_IPX:
@@ -1449,8 +1447,7 @@ radius_print(netdissect_options *ndo,
               GET_U_1(rad->id),
               len);
        return;
-   }
-   else {
+   } else {
        ND_PRINT("RADIUS, length: %u\n\t%s (%u), id: 0x%02x, Authenticator: ",
               len,
               tok2str(radius_command_values,"Unknown Command",GET_U_1(rad->code)),
index 780845f260a81dd37c2ab41dbe62aed2e9103d15..334720f1675b6e3f39225f2d03821f740e337691 100644 (file)
@@ -320,8 +320,7 @@ rpki_rtr_pdu_print(netdissect_options *ndo, const u_char *tptr, const u_int len,
                    goto invalid;
                if (! recurse) {
                    ND_TCHECK_LEN(tptr, tlen + encapsulated_pdu_length);
-               }
-               else {
+               } else {
                    ND_PRINT("%s-----encapsulated PDU-----", indent_string(indent+4));
                    rpki_rtr_pdu_print(ndo, tptr + tlen,
                        encapsulated_pdu_length, 0, indent + 2);
index d036a1fa3d2f60d4c0285c0bd44069a78cd4a1f1..bbe5f1cbc6a674ac948a5d39eb79f7492e43b6d4 100644 (file)
@@ -522,8 +522,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
                                } else
                                        ND_PRINT("[udp sum ok] ");
                        }
-               }
-               else if (IP_V(ip) == 6) {
+               } else if (IP_V(ip) == 6) {
                        /* for IPv6, UDP checksum is mandatory */
                        if (ND_TTEST_LEN(cp, length)) {
                                sum = udp6_cksum(ndo, ip6, up, length + sizeof(struct udphdr));