2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Remove redundant parentheses from the return statement

This commit is contained in:
Ondřej Surý
2024-11-19 10:38:03 +01:00
parent 3873b0c279
commit 0258850f20
437 changed files with 10832 additions and 10856 deletions

View File

@@ -220,20 +220,20 @@ const char *
dns_rpz_type2str(dns_rpz_type_t type) {
switch (type) {
case DNS_RPZ_TYPE_CLIENT_IP:
return ("CLIENT-IP");
return "CLIENT-IP";
case DNS_RPZ_TYPE_QNAME:
return ("QNAME");
return "QNAME";
case DNS_RPZ_TYPE_IP:
return ("IP");
return "IP";
case DNS_RPZ_TYPE_NSIP:
return ("NSIP");
return "NSIP";
case DNS_RPZ_TYPE_NSDNAME:
return ("NSDNAME");
return "NSDNAME";
case DNS_RPZ_TYPE_BAD:
break;
}
FATAL_ERROR("impossible rpz type %d", type);
return ("impossible");
return "impossible";
}
dns_rpz_policy_t
@@ -255,14 +255,14 @@ dns_rpz_str2policy(const char *str) {
unsigned int n;
if (str == NULL) {
return (DNS_RPZ_POLICY_ERROR);
return DNS_RPZ_POLICY_ERROR;
}
for (n = 0; n < sizeof(tbl) / sizeof(tbl[0]); ++n) {
if (!strcasecmp(tbl[n].str, str)) {
return (tbl[n].policy);
return tbl[n].policy;
}
}
return (DNS_RPZ_POLICY_ERROR);
return DNS_RPZ_POLICY_ERROR;
}
const char *
@@ -304,7 +304,7 @@ dns_rpz_policy2str(dns_rpz_policy_t policy) {
default:
UNREACHABLE();
}
return (str);
return str;
}
uint16_t
@@ -323,14 +323,14 @@ dns_rpz_str2ede(const char *str) {
unsigned int n;
if (str == NULL) {
return (UINT16_MAX);
return UINT16_MAX;
}
for (n = 0; n < sizeof(tbl) / sizeof(tbl[0]); ++n) {
if (!strcasecmp(tbl[n].str, str)) {
return (tbl[n].ede);
return tbl[n].ede;
}
}
return (UINT16_MAX);
return UINT16_MAX;
}
/*
@@ -366,7 +366,7 @@ zbit_to_num(dns_rpz_zbits_t zbit) {
if ((zbit & 2) != 0) {
++rpz_num;
}
return (rpz_num);
return rpz_num;
}
/*
@@ -710,7 +710,7 @@ new_node(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *ip,
node->ip.w[i++] = 0;
}
return (node);
return node;
}
static void
@@ -756,7 +756,7 @@ ip2name(const dns_rpz_cidr_key_t *tgt_ip, dns_rpz_prefix_t tgt_prefix,
(tgt_ip->w[3] >> 16) & 0xffU,
(tgt_ip->w[3] >> 24) & 0xffU);
if (len < 0 || (size_t)len >= sizeof(str)) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
} else {
int w[DNS_RPZ_CIDR_WORDS * 2];
@@ -764,7 +764,7 @@ ip2name(const dns_rpz_cidr_key_t *tgt_ip, dns_rpz_prefix_t tgt_prefix,
len = snprintf(str, sizeof(str), "%d", tgt_prefix);
if (len < 0 || (size_t)len >= sizeof(str)) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
for (int n = 0; n < DNS_RPZ_CIDR_WORDS; n++) {
@@ -810,7 +810,7 @@ ip2name(const dns_rpz_cidr_key_t *tgt_ip, dns_rpz_prefix_t tgt_prefix,
".%x", w[n]);
}
if (i < 0 || (size_t)i >= (size_t)(sizeof(str) - len)) {
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
len += i;
}
@@ -819,7 +819,7 @@ ip2name(const dns_rpz_cidr_key_t *tgt_ip, dns_rpz_prefix_t tgt_prefix,
isc_buffer_init(&buffer, str, sizeof(str));
isc_buffer_add(&buffer, len);
result = dns_name_fromtext(ip_name, &buffer, base_name, 0, NULL);
return (result);
return result;
}
/*
@@ -829,26 +829,26 @@ static dns_rpz_type_t
type_from_name(const dns_rpz_zones_t *rpzs, dns_rpz_zone_t *rpz,
const dns_name_t *name) {
if (dns_name_issubdomain(name, &rpz->ip)) {
return (DNS_RPZ_TYPE_IP);
return DNS_RPZ_TYPE_IP;
}
if (dns_name_issubdomain(name, &rpz->client_ip)) {
return (DNS_RPZ_TYPE_CLIENT_IP);
return DNS_RPZ_TYPE_CLIENT_IP;
}
if ((rpzs->p.nsip_on & DNS_RPZ_ZBIT(rpz->num)) != 0 &&
dns_name_issubdomain(name, &rpz->nsip))
{
return (DNS_RPZ_TYPE_NSIP);
return DNS_RPZ_TYPE_NSIP;
}
if ((rpzs->p.nsdname_on & DNS_RPZ_ZBIT(rpz->num)) != 0 &&
dns_name_issubdomain(name, &rpz->nsdname))
{
return (DNS_RPZ_TYPE_NSDNAME);
return DNS_RPZ_TYPE_NSDNAME;
}
return (DNS_RPZ_TYPE_QNAME);
return DNS_RPZ_TYPE_QNAME;
}
/*
@@ -885,7 +885,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
}
if (ip_labels < 2) {
badname(log_level, src_name, "; too short", "");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
dns_name_init(&ip_name, ip_name_offsets);
dns_name_getlabelsequence(src_name, 0, ip_labels, &ip_name);
@@ -901,7 +901,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
if (*cp2 != '.') {
badname(log_level, src_name, "; invalid leading prefix length",
"");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
/*
* Patch in trailing nul character to print just the length
@@ -911,7 +911,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
if (prefix_num < 1U || prefix_num > 128U) {
badname(log_level, src_name, "; invalid prefix length of ",
prefix_str);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
cp = cp2 + 1;
@@ -923,7 +923,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
if (prefix_num > 32U) {
badname(log_level, src_name,
"; invalid IPv4 prefix length of ", prefix_str);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
prefix_num += 96;
*tgt_prefix = (dns_rpz_prefix_t)prefix_num;
@@ -939,7 +939,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
}
badname(log_level, src_name,
"; invalid IPv4 octet ", cp);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
tgt_ip->w[3] |= l << i;
cp = cp2 + 1;
@@ -972,7 +972,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
}
badname(log_level, src_name,
"; invalid IPv6 word ", cp);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
if ((i & 1) == 0) {
tgt_ip->w[3 - i / 2] = l;
@@ -986,7 +986,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
}
if (cp != end) {
badname(log_level, src_name, "", "");
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
/*
@@ -1001,7 +1001,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
if ((aword & ~DNS_RPZ_WORD_MASK(i)) != 0) {
badname(log_level, src_name,
"; too small prefix length of ", prefix_str);
return (ISC_R_FAILURE);
return ISC_R_FAILURE;
}
prefix -= i;
prefix += DNS_RPZ_CIDR_WORD_BITS;
@@ -1031,7 +1031,7 @@ name2ipkey(int log_level, dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
}
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
/*
@@ -1111,7 +1111,7 @@ clz(dns_rpz_cidr_word_t w) {
--bit;
}
return (bit);
return bit;
}
#endif /* ifndef HAVE_BUILTIN_CLZ */
@@ -1142,7 +1142,7 @@ diff_keys(const dns_rpz_cidr_key_t *key1, dns_rpz_prefix_t prefix1,
break;
}
}
return (ISC_MIN(bit, maxbit));
return ISC_MIN(bit, maxbit);
}
/*
@@ -1161,7 +1161,7 @@ trim_zbits(dns_rpz_zbits_t zbits, dns_rpz_zbits_t found) {
x &= (~x + 1);
x = (x << 1) - 1;
zbits &= x;
return (zbits);
return zbits;
}
/*
@@ -1193,7 +1193,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
* or add the target as a child of the current parent.
*/
if (!create) {
return (find_result);
return find_result;
}
child = new_node(rpzs, tgt_ip, tgt_prefix, NULL);
if (parent == NULL) {
@@ -1207,7 +1207,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
child->set.nsip |= tgt_set->nsip;
set_sum_pair(child);
*found = child;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if ((cur->sum.client_ip & set.client_ip) == 0 &&
@@ -1223,7 +1223,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
* a node and mark/put this node in the correct tree.
*/
if (!create) {
return (find_result);
return find_result;
}
}
@@ -1263,7 +1263,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
*found = cur;
find_result = ISC_R_SUCCESS;
}
return (find_result);
return find_result;
}
/*
@@ -1272,7 +1272,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
* Add the target as the current node's parent.
*/
if (!create) {
return (find_result);
return find_result;
}
new_parent = new_node(rpzs, tgt_ip, tgt_prefix, cur);
@@ -1288,7 +1288,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
new_parent->set = *tgt_set;
set_sum_pair(new_parent);
*found = new_parent;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (dbit == cur->prefix) {
@@ -1322,7 +1322,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
* add the target as a sibling of the current node
*/
if (!create) {
return (find_result);
return find_result;
}
sibling = new_node(rpzs, tgt_ip, tgt_prefix, NULL);
@@ -1341,7 +1341,7 @@ search(dns_rpz_zones_t *rpzs, const dns_rpz_cidr_key_t *tgt_ip,
sibling->set = *tgt_set;
set_sum_pair(sibling);
*found = sibling;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
}
@@ -1363,7 +1363,7 @@ add_cidr(dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
* Log complaints about bad owner names but let the zone load.
*/
if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
RWLOCK(&rpz->rpzs->search_lock, isc_rwlocktype_write);
@@ -1394,7 +1394,7 @@ add_cidr(dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
adj_trigger_cnt(rpz, rpz_type, &tgt_ip, tgt_prefix, true);
done:
RWUNLOCK(&rpz->rpzs->search_lock, isc_rwlocktype_write);
return (result);
return result;
}
static nmdata_t *
@@ -1414,7 +1414,7 @@ new_nmdata(isc_mem_t *mctx, const dns_name_t *name, const nmdata_t *data) {
__FILE__, __LINE__ + 1, name);
#endif
return (newdata);
return newdata;
}
static isc_result_t
@@ -1454,7 +1454,7 @@ done:
dns_qp_compact(qp, DNS_QPGC_MAYBE);
dns_qpmulti_commit(rpzs->table, &qp);
return (result);
return result;
}
static isc_result_t
@@ -1480,14 +1480,14 @@ add_name(dns_rpz_zone_t *rpz, dns_rpz_type_t rpz_type,
* because diff_apply() likes to add nodes before deleting.
*/
if (result == ISC_R_EXISTS) {
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
if (result == ISC_R_SUCCESS) {
RWLOCK(&rpz->rpzs->search_lock, isc_rwlocktype_write);
adj_trigger_cnt(rpz, rpz_type, NULL, 0, true);
RWUNLOCK(&rpz->rpzs->search_lock, isc_rwlocktype_write);
}
return (result);
return result;
}
/*
@@ -1519,7 +1519,7 @@ dns_rpz_new_zones(dns_view_t *view, isc_loopmgr_t *loopmgr,
isc_mem_attach(mctx, &rpzs->mctx);
*rpzsp = rpzs;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
@@ -1531,12 +1531,12 @@ dns_rpz_new_zone(dns_rpz_zones_t *rpzs, dns_rpz_zone_t **rpzp) {
REQUIRE(rpzp != NULL && *rpzp == NULL);
if (rpzs->p.num_zones >= DNS_RPZ_MAX_ZONES) {
return (ISC_R_NOSPACE);
return ISC_R_NOSPACE;
}
result = dns__rpz_shuttingdown(rpzs);
if (result != ISC_R_SUCCESS) {
return (result);
return result;
}
rpz = isc_mem_get(rpzs->mctx, sizeof(*rpz));
@@ -1570,7 +1570,7 @@ dns_rpz_new_zone(dns_rpz_zones_t *rpzs, dns_rpz_zone_t **rpzp) {
*rpzp = rpz;
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
isc_result_t
@@ -1627,7 +1627,7 @@ dns_rpz_dbupdate_callback(dns_db_t *db, void *fn_arg) {
unlock:
UNLOCK(&rpz->rpzs->maint_lock);
return (result);
return result;
}
void
@@ -1736,7 +1736,7 @@ update_nodes(dns_rpz_zone_t *rpz, isc_ht_t *newnodes) {
ISC_LOG_ERROR,
"rpz: %s: failed to create DB iterator - %s",
domain, isc_result_totext(result));
return (result);
return result;
}
result = dns_dbiterator_first(updbit);
@@ -1857,7 +1857,7 @@ update_nodes(dns_rpz_zone_t *rpz, isc_ht_t *newnodes) {
cleanup:
dns_dbiterator_destroy(&updbit);
return (result);
return result;
}
static isc_result_t
@@ -1899,7 +1899,7 @@ cleanup_nodes(dns_rpz_zone_t *rpz) {
isc_ht_iter_destroy(&iter);
return (result);
return result;
}
static isc_result_t
@@ -1911,10 +1911,10 @@ dns__rpz_shuttingdown(dns_rpz_zones_t *rpzs) {
UNLOCK(&rpzs->maint_lock);
if (shuttingdown) {
return (ISC_R_SHUTTINGDOWN);
return ISC_R_SHUTTINGDOWN;
}
return (ISC_R_SUCCESS);
return ISC_R_SUCCESS;
}
static void
@@ -2177,7 +2177,7 @@ rpz_add(dns_rpz_zone_t *rpz, const dns_name_t *src_name) {
break;
}
return (result);
return result;
}
/*
@@ -2446,11 +2446,11 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
break;
}
} else {
return (DNS_RPZ_INVALID_NUM);
return DNS_RPZ_INVALID_NUM;
}
if (zbits == 0) {
return (DNS_RPZ_INVALID_NUM);
return DNS_RPZ_INVALID_NUM;
}
make_addr_set(&tgt_set, zbits, rpz_type);
@@ -2461,7 +2461,7 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
* There are no eligible zones for this IP address.
*/
RWUNLOCK(&rpzs->search_lock, isc_rwlocktype_read);
return (DNS_RPZ_INVALID_NUM);
return DNS_RPZ_INVALID_NUM;
}
/*
@@ -2491,9 +2491,9 @@ dns_rpz_find_ip(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
isc_log_write(DNS_LOGCATEGORY_RPZ, DNS_LOGMODULE_RBTDB,
DNS_RPZ_ERROR_LEVEL, "rpz ip2name() failed: %s",
isc_result_totext(result));
return (DNS_RPZ_INVALID_NUM);
return DNS_RPZ_INVALID_NUM;
}
return (rpz_num);
return rpz_num;
}
/*
@@ -2512,7 +2512,7 @@ dns_rpz_find_name(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
int i;
if (zbits == 0) {
return (0);
return 0;
}
dns_qpmulti_query(rpzs->table, &qpr);
@@ -2559,7 +2559,7 @@ dns_rpz_find_name(dns_rpz_zones_t *rpzs, dns_rpz_type_t rpz_type,
}
dns_qpread_destroy(rpzs->table, &qpr);
return (zbits & found_zbits);
return zbits & found_zbits;
}
/*
@@ -2583,7 +2583,7 @@ dns_rpz_decode_cname(dns_rpz_zone_t *rpz, dns_rdataset_t *rdataset,
* CNAME . means NXDOMAIN
*/
if (dns_name_equal(&cname.cname, dns_rootname)) {
return (DNS_RPZ_POLICY_NXDOMAIN);
return DNS_RPZ_POLICY_NXDOMAIN;
}
if (dns_name_iswildcard(&cname.cname)) {
@@ -2591,7 +2591,7 @@ dns_rpz_decode_cname(dns_rpz_zone_t *rpz, dns_rdataset_t *rdataset,
* CNAME *. means NODATA
*/
if (dns_name_countlabels(&cname.cname) == 2) {
return (DNS_RPZ_POLICY_NODATA);
return DNS_RPZ_POLICY_NODATA;
}
/*
@@ -2601,7 +2601,7 @@ dns_rpz_decode_cname(dns_rpz_zone_t *rpz, dns_rdataset_t *rdataset,
* evil.com CNAME evil.com.garden.net
*/
if (dns_name_countlabels(&cname.cname) > 2) {
return (DNS_RPZ_POLICY_WILDCNAME);
return DNS_RPZ_POLICY_WILDCNAME;
}
}
@@ -2609,34 +2609,34 @@ dns_rpz_decode_cname(dns_rpz_zone_t *rpz, dns_rdataset_t *rdataset,
* CNAME rpz-tcp-only. means "send truncated UDP responses."
*/
if (dns_name_equal(&cname.cname, &rpz->tcp_only)) {
return (DNS_RPZ_POLICY_TCP_ONLY);
return DNS_RPZ_POLICY_TCP_ONLY;
}
/*
* CNAME rpz-drop. means "do not respond."
*/
if (dns_name_equal(&cname.cname, &rpz->drop)) {
return (DNS_RPZ_POLICY_DROP);
return DNS_RPZ_POLICY_DROP;
}
/*
* CNAME rpz-passthru. means "do not rewrite."
*/
if (dns_name_equal(&cname.cname, &rpz->passthru)) {
return (DNS_RPZ_POLICY_PASSTHRU);
return DNS_RPZ_POLICY_PASSTHRU;
}
/*
* 128.1.0.127.rpz-ip CNAME 128.1.0.0.127. is obsolete PASSTHRU
*/
if (selfname != NULL && dns_name_equal(&cname.cname, selfname)) {
return (DNS_RPZ_POLICY_PASSTHRU);
return DNS_RPZ_POLICY_PASSTHRU;
}
/*
* Any other rdata gives a response consisting of the rdata.
*/
return (DNS_RPZ_POLICY_RECORD);
return DNS_RPZ_POLICY_RECORD;
}
static void
@@ -2669,7 +2669,7 @@ static size_t
qp_makekey(dns_qpkey_t key, void *uctx ISC_ATTR_UNUSED, void *pval,
uint32_t ival ISC_ATTR_UNUSED) {
nmdata_t *data = pval;
return (dns_qpkey_fromname(key, &data->name));
return dns_qpkey_fromname(key, &data->name);
}
static void