Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
NTPsec
ntpsec
Commits
f030489e
Commit
f030489e
authored
Dec 02, 2017
by
NHOrus
Committed by
Matt Selsky
Dec 02, 2017
Browse files
C99 allows inline declaration in for loops
parent
f02d60ec
Pipeline
#14642481
passed with stages
in 14 minutes and 47 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
libntp/macencrypt.c
View file @
f030489e
...
...
@@ -28,9 +28,8 @@ static bool ctmemeq(const void *s1, const void *s2, size_t n) {
const
uint8_t
*
a
=
s1
;
const
uint8_t
*
b
=
s2
;
uint8_t
accum
=
0
;
size_t
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
accum
|=
a
[
i
]
^
b
[
i
];
}
...
...
ntpd/ntp_io.c
View file @
f030489e
...
...
@@ -461,12 +461,11 @@ sockaddr_dump(const sockaddr_u *psau)
/* Limit the size of the sockaddr_in6 hex dump */
const
int
maxsize
=
min
(
32
,
sizeof
(
psau
->
sa6
));
const
uint8_t
*
cp
;
int
i
;
/* XXX: Should we limit maxsize based on psau->saX.sin_family? */
cp
=
(
const
void
*
)
&
psau
->
sa6
;
for
(
i
=
0
;
i
<
maxsize
;
i
++
)
{
for
(
int
i
=
0
;
i
<
maxsize
;
i
++
)
{
printf
(
"%02x"
,
*
cp
++
);
if
(
!
((
i
+
1
)
%
4
))
printf
(
" "
);
...
...
ntpd/ntp_proto.c
View file @
f030489e
...
...
@@ -246,10 +246,9 @@ free_packet(
struct
parsed_pkt
*
pkt
)
{
size_t
i
;
if
(
pkt
==
NULL
)
{
return
;
};
if
(
pkt
->
extensions
!=
NULL
)
{
for
(
i
=
0
;
i
<
pkt
->
num_extensions
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
pkt
->
num_extensions
;
i
++
)
{
free
(
pkt
->
extensions
[
i
].
body
);
pkt
->
extensions
[
i
].
body
=
NULL
;
}
...
...
@@ -309,7 +308,6 @@ parse_packet(
/* Count and validate extensions */
size_t
ext_count
=
0
;
size_t
extlen
=
0
;
size_t
i
;
while
(
bufptr
<=
recv_buf
+
recv_length
-
28
)
{
extlen
=
ntp_be16dec
(
bufptr
+
2
);
if
(
extlen
%
4
!=
0
||
extlen
<
16
)
{
...
...
@@ -331,7 +329,7 @@ parse_packet(
/* Copy extensions */
bufptr
=
recv_buf
+
LEN_PKT_NOMAC
;
for
(
i
=
0
;
i
<
ext_count
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
ext_count
;
i
++
)
{
pkt
->
extensions
[
i
].
type
=
ntp_be16dec
(
bufptr
);
pkt
->
extensions
[
i
].
len
=
ntp_be16dec
(
bufptr
+
2
)
-
4
;
pkt
->
extensions
[
i
].
body
=
...
...
ntpd/refclock_neoclock.c
View file @
f030489e
...
...
@@ -137,9 +137,6 @@ neoclock4x_start(int unit,
char
dev
[
20
];
int
sl232
;
struct
termios
termsettings
;
#if !defined(NEOCLOCK4X_FIRMWARE)
int
tries
;
#endif
(
void
)
snprintf
(
dev
,
sizeof
(
dev
)
-
1
,
"/dev/neoclock4x-%d"
,
unit
);
...
...
@@ -293,7 +290,7 @@ neoclock4x_start(int unit,
return
false
;
#endif
#else
for
(
tries
=
0
;
tries
<
5
;
tries
++
)
for
(
int
tries
=
0
;
tries
<
5
;
tries
++
)
{
NLOG
(
NLOG_CLOCKINFO
)
msyslog
(
LOG_INFO
,
"REFCLOCK: NeoClock4X(%d): checking NeoClock4X firmware version (%d/5)"
,
unit
,
tries
);
...
...
@@ -389,7 +386,6 @@ neoclock4x_receive(struct recvbuf *rbufp)
unsigned
long
calc_utc
;
int
day
;
int
month
;
/* ddd conversion */
int
c
;
int
dsec
;
unsigned
char
calc_chksum
;
int
recv_chksum
;
...
...
@@ -422,7 +418,7 @@ neoclock4x_receive(struct recvbuf *rbufp)
/* calculate checksum */
calc_chksum
=
0
;
for
(
c
=
0
;
c
<
NEOCLOCK4X_OFFSET_CRC
;
c
++
)
for
(
int
c
=
0
;
c
<
NEOCLOCK4X_OFFSET_CRC
;
c
++
)
{
calc_chksum
+=
pp
->
a_lastcode
[
c
];
}
...
...
@@ -725,10 +721,9 @@ neol_hexatoi_len(const char str[],
int
maxlen
)
{
int
hexdigit
;
int
i
;
int
n
=
0
;
for
(
i
=
0
;
isxdigit
((
unsigned
char
)
str
[
i
])
&&
i
<
maxlen
;
i
++
)
for
(
i
nt
i
=
0
;
isxdigit
((
unsigned
char
)
str
[
i
])
&&
i
<
maxlen
;
i
++
)
{
hexdigit
=
isdigit
((
unsigned
char
)
str
[
i
])
?
toupper
((
unsigned
char
)
str
[
i
])
-
'0'
:
toupper
((
unsigned
char
)
str
[
i
])
-
'A'
+
10
;
n
=
16
*
n
+
hexdigit
;
...
...
@@ -743,10 +738,9 @@ neol_atoi_len(const char str[],
int
maxlen
)
{
int
digit
;
int
i
;
int
n
=
0
;
for
(
i
=
0
;
isdigit
((
unsigned
char
)
str
[
i
])
&&
i
<
maxlen
;
i
++
)
for
(
i
nt
i
=
0
;
isdigit
((
unsigned
char
)
str
[
i
])
&&
i
<
maxlen
;
i
++
)
{
digit
=
str
[
i
]
-
'0'
;
n
=
10
*
n
+
digit
;
...
...
ntpd/refclock_oncore.c
View file @
f030489e
...
...
@@ -1497,7 +1497,7 @@ oncore_consume(
/* Ok, we have a header now */
l
=
sizeof
(
oncore_messages
)
/
sizeof
(
oncore_messages
[
0
])
-
1
;
for
(
m
=
0
;
m
<
l
;
m
++
)
for
(
m
=
0
;
m
<
l
;
m
++
)
if
(
!
strncmp
(
oncore_messages
[
m
].
flag
,
(
char
*
)(
rcvbuf
+
2
),
(
size_t
)
2
))
break
;
if
(
m
==
l
)
{
...
...
@@ -1883,7 +1883,6 @@ oncore_msg_any(
UNUSED_ARG
(
len
);
UNUSED_ARG
(
idx
);
#else
int
i
;
const
char
*
fmt
=
oncore_messages
[
idx
].
fmt
;
const
char
*
p
;
char
*
q
;
...
...
@@ -1899,7 +1898,7 @@ oncore_msg_any(
if
(
!*
fmt
)
{
snprintf
(
Msg
,
sizeof
(
Msg
),
">>@@%c%c "
,
buf
[
2
],
buf
[
3
]);
for
(
i
=
2
;
i
<
len
&&
i
<
2400
;
i
++
)
{
for
(
int
i
=
2
;
i
<
len
&&
i
<
2400
;
i
++
)
{
snprintf
(
Msg2
,
sizeof
(
Msg2
),
"%02x"
,
buf
[
i
]);
strlcat
(
Msg
,
Msg2
,
sizeof
(
Msg
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment