aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/ntpd/ntp_restrict.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/ntpd/ntp_restrict.c')
-rw-r--r--contrib/ntp/ntpd/ntp_restrict.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/contrib/ntp/ntpd/ntp_restrict.c b/contrib/ntp/ntpd/ntp_restrict.c
index 9948d54d9e90..82bbaef25741 100644
--- a/contrib/ntp/ntpd/ntp_restrict.c
+++ b/contrib/ntp/ntpd/ntp_restrict.c
@@ -173,7 +173,7 @@ alloc_res4(void)
LINK_SLIST(resfree4, res, link);
res = (void *)((char *)res - cb);
}
- NTP_INSIST(rl == res);
+ INSIST(rl == res);
/* allocate the first */
return res;
}
@@ -199,7 +199,7 @@ alloc_res6(void)
LINK_SLIST(resfree6, res, link);
res = (void *)((char *)res - cb);
}
- NTP_INSIST(rl == res);
+ INSIST(rl == res);
/* allocate the first */
return res;
}
@@ -223,7 +223,7 @@ free_res(
else
plisthead = &restrictlist4;
UNLINK_SLIST(unlinked, *plisthead, res, link, restrict_u);
- NTP_INSIST(unlinked == res);
+ INSIST(unlinked == res);
if (v6) {
zero_mem(res, V6_SIZEOF_RESTRICT_U);
@@ -291,7 +291,7 @@ match_restrict6_addr(
for (res = restrictlist6; res != NULL; res = next) {
next = res->link;
- NTP_INSIST(next != res);
+ INSIST(next != res);
if (res->expire &&
res->expire <= current_time)
free_res(res, v6);
@@ -435,6 +435,9 @@ restrictions(
match = match_restrict4_addr(SRCADR(srcadr),
SRCPORT(srcadr));
+
+ INSIST(match != NULL);
+
match->count++;
/*
* res_not_found counts only use of the final default
@@ -461,6 +464,7 @@ restrictions(
return (int)RES_IGNORE;
match = match_restrict6_addr(pin6, SRCPORT(srcadr));
+ INSIST(match != NULL);
match->count++;
if (&restrict_def6 == match)
res_not_found++;
@@ -494,8 +498,8 @@ hack_restrict(
op, stoa(resaddr), stoa(resmask), mflags, flags));
if (NULL == resaddr) {
- NTP_REQUIRE(NULL == resmask);
- NTP_REQUIRE(RESTRICT_FLAGS == op);
+ REQUIRE(NULL == resmask);
+ REQUIRE(RESTRICT_FLAGS == op);
restrict_source_flags = flags;
restrict_source_mflags = mflags;
restrict_source_enabled = 1;
@@ -503,9 +507,13 @@ hack_restrict(
}
ZERO(match);
+
+#if 0
/* silence VC9 potentially uninit warnings */
+ // HMS: let's use a compiler-specific "enable" for this.
res = NULL;
v6 = 0;
+#endif
if (IS_IPV4(resaddr)) {
v6 = 0;
@@ -528,7 +536,7 @@ hack_restrict(
&match.u.v6.mask);
} else /* not IPv4 nor IPv6 */
- NTP_REQUIRE(0);
+ REQUIRE(0);
match.flags = flags;
match.mflags = mflags;
@@ -600,7 +608,7 @@ hack_restrict(
break;
default: /* unknown op */
- NTP_INSIST(0);
+ INSIST(0);
break;
}
@@ -626,7 +634,7 @@ restrict_source(
IS_MCAST(addr) || ISREFCLOCKADR(addr))
return;
- NTP_REQUIRE(AF_INET == AF(addr) || AF_INET6 == AF(addr));
+ REQUIRE(AF_INET == AF(addr) || AF_INET6 == AF(addr));
SET_HOSTMASK(&onesmask, AF(addr));
if (farewell) {
@@ -647,10 +655,12 @@ restrict_source(
*/
if (IS_IPV4(addr)) {
res = match_restrict4_addr(SRCADR(addr), SRCPORT(addr));
+ INSIST(res != NULL);
found_specific = (SRCADR(&onesmask) == res->u.v4.mask);
} else {
res = match_restrict6_addr(&SOCK_ADDR6(addr),
SRCPORT(addr));
+ INSIST(res != NULL);
found_specific = ADDR6_EQ(&res->u.v6.mask,
&SOCK_ADDR6(&onesmask));
}