diff options
-rw-r--r-- | addrtoname.c | 3 | ||||
-rw-r--r-- | addrtostr.c | 3 | ||||
-rw-r--r-- | missing/getopt_long.c | 3 | ||||
-rw-r--r-- | parsenfsfh.c | 42 | ||||
-rw-r--r-- | print-bgp.c | 3 | ||||
-rw-r--r-- | print-cdp.c | 6 | ||||
-rw-r--r-- | print-domain.c | 6 | ||||
-rw-r--r-- | print-fddi.c | 3 | ||||
-rw-r--r-- | print-fr.c | 3 | ||||
-rw-r--r-- | print-icmp6.c | 3 | ||||
-rw-r--r-- | print-ip.c | 3 | ||||
-rw-r--r-- | print-ldp.c | 6 | ||||
-rw-r--r-- | print-mobility.c | 3 | ||||
-rw-r--r-- | print-nfs.c | 3 | ||||
-rw-r--r-- | print-nsh.c | 3 | ||||
-rw-r--r-- | print-olsr.c | 6 | ||||
-rw-r--r-- | print-openflow-1.0.c | 3 | ||||
-rw-r--r-- | print-pim.c | 6 | ||||
-rw-r--r-- | print-radius.c | 9 | ||||
-rw-r--r-- | print-rpki-rtr.c | 3 | ||||
-rw-r--r-- | print-udp.c | 3 |
21 files changed, 41 insertions, 82 deletions
diff --git a/addrtoname.c b/addrtoname.c index 914665c2..d3c352f5 100644 --- a/addrtoname.c +++ b/addrtoname.c @@ -526,8 +526,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)]; diff --git a/addrtostr.c b/addrtostr.c index f1ccf797..5a08929a 100644 --- a/addrtostr.c +++ b/addrtostr.c @@ -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; diff --git a/missing/getopt_long.c b/missing/getopt_long.c index ece00062..e9b1ef57 100644 --- a/missing/getopt_long.c +++ b/missing/getopt_long.c @@ -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. diff --git a/parsenfsfh.c b/parsenfsfh.c index cd943699..594177c1 100644 --- a/parsenfsfh.c +++ b/parsenfsfh.c @@ -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); } diff --git a/print-bgp.c b/print-bgp.c index efeaea45..1acdd5ba 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -2986,8 +2986,7 @@ bgp_notification_print(netdissect_options *ndo, /* garbage, hexdump it all */ if (shutdown_comm_length > length - (BGP_NOTIFICATION_SIZE + 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; } diff --git a/print-cdp.c b/print-cdp.c index 9f5c24bc..f3004842 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -389,8 +389,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, @@ -408,8 +407,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 */ diff --git a/print-domain.c b/print-domain.c index d2275a5e..d98cd11c 100644 --- a/print-domain.c +++ b/print-domain.c @@ -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) diff --git a/print-fddi.c b/print-fddi.c index fb8d3ed5..75a1055f 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -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); } @@ -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); } diff --git a/print-icmp6.c b/print-icmp6.c index 3aa9a168..fefa6e1c 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -1346,8 +1346,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 */ @@ -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; } diff --git a/print-ldp.c b/print-ldp.c index 896bc403..452b5f1f 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -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_INET6) { + } else if (af == AFNUM_INET6) { 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: diff --git a/print-mobility.c b/print-mobility.c index 55340ca5..dab853e0 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -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) diff --git a/print-nfs.c b/print-nfs.c index af1b274f..9e5102ae 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -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)); diff --git a/print-nsh.c b/print-nsh.c index 12a63cd6..db78dee6 100644 --- a/print-nsh.c +++ b/print-nsh.c @@ -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; diff --git a/print-olsr.c b/print-olsr.c index ecf7918d..27e88721 100644 --- a/print-olsr.c +++ b/print-olsr.c @@ -390,8 +390,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); @@ -552,8 +551,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)", diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index 1d7f2474..cd6072b7 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -1276,8 +1276,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); } diff --git a/print-pim.c b/print-pim.c index f2db8c76..1ec93060 100644 --- a/print-pim.c +++ b/print-pim.c @@ -599,8 +599,7 @@ pimv2_addr_print(netdissect_options *ndo, if (af == AF_INET) { if (!silent) ND_PRINT("%s", GET_IPADDR_STRING(bp)); - } - else if (af == AF_INET6) { + } else if (af == AF_INET6) { 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 == AF_INET6) { + } else if (af == AF_INET6) { if (!silent) { ND_PRINT("%s", GET_IP6ADDR_STRING(bp + 2)); if (GET_U_1(bp + 1) != 128) diff --git a/print-radius.c b/print-radius.c index a8a3ddda..9d5ee3c3 100644 --- a/print-radius.c +++ b/print-radius.c @@ -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)), diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c index 36be3998..64b04997 100644 --- a/print-rpki-rtr.c +++ b/print-rpki-rtr.c @@ -322,8 +322,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); diff --git a/print-udp.c b/print-udp.c index 769cbe41..4ce0082c 100644 --- a/print-udp.c +++ b/print-udp.c @@ -572,8 +572,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)); |