Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
ntpsec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
NTPsec
ntpsec
Commits
bff64f91
Commit
bff64f91
authored
8 years ago
by
Eric S. Raymond
Browse files
Options
Downloads
Patches
Plain Diff
TESTFRAME: on replay, skip certain operations before mainloop.
parent
1ebfb9f5
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ntpd/ntp_intercept.c
+13
-13
13 additions, 13 deletions
ntpd/ntp_intercept.c
ntpd/ntp_intercept.h
+1
-1
1 addition, 1 deletion
ntpd/ntp_intercept.h
ntpd/ntpd.c
+2
-4
2 additions, 4 deletions
ntpd/ntpd.c
with
16 additions
and
18 deletions
ntpd/ntp_intercept.c
+
13
−
13
View file @
bff64f91
...
...
@@ -928,13 +928,20 @@ int intercept_open_socket(sockaddr_u *addr,
return
sock
;
}
void
intercept_replay
(
void
)
bool
intercept_replay
(
void
)
{
printf
(
"# entering replay loop at line %d
\n
"
,
lineno
);
if
(
mode
==
capture
)
fputs
(
"mainloop
\n
"
,
stdout
);
if
(
mode
!=
replay
)
return
false
;
/* fall through to normal mail loop */
for
(;;)
{
get_operation
(
NULL
);
if
(
strncmp
(
linebuf
,
"
finish
"
,
7
)
==
0
)
if
(
strncmp
(
linebuf
,
"
mainloop
"
,
8
)
==
0
)
break
;
else
if
(
strncmp
(
linebuf
,
"getaddrinfo "
,
12
)
==
0
)
/* DNS lookups for initial configuration */
continue
;
else
if
(
strncmp
(
linebuf
,
"sendpkt "
,
8
)
==
0
)
/*
* If we get here, this is a sendpkt generated not by the protocol
...
...
@@ -943,17 +950,10 @@ void intercept_replay(void)
*/
continue
;
else
{
char
errbuf
[
BUFSIZ
],
*
cp
;
strlcpy
(
errbuf
,
linebuf
,
sizeof
(
errbuf
));
cp
=
strchr
(
errbuf
,
' '
);
if
(
cp
!=
NULL
)
*
cp
=
'\0'
;
fprintf
(
stderr
,
"ntpd: unexpected operation '%s' at line %d
\n
"
,
errbuf
,
lineno
);
exit
(
1
);
}
replay_fail
(
"unexpected operation before mainloop
\n
"
);
}
return
true
;
/* don't do normal main loop */
}
void
...
...
This diff is collapsed.
Click to expand it.
ntpd/ntp_intercept.h
+
1
−
1
View file @
bff64f91
...
...
@@ -38,7 +38,7 @@ int intercept_set_tod(struct timespec *tvs);
extern
bool
intercept_leapsec_load_file
(
const
char
*
fname
,
struct
stat
*
sb
,
bool
force
,
bool
logall
);
void
intercept_getauthkeys
(
const
char
*
);
void
intercept_replay
(
void
);
bool
intercept_replay
(
void
);
void
intercept_exit
(
const
int
);
/* end */
This diff is collapsed.
Click to expand it.
ntpd/ntpd.c
+
2
−
4
View file @
bff64f91
...
...
@@ -900,10 +900,8 @@ ntpdmain(
msyslog
(
LOG_INFO
,
"running as non-root disables dynamic interface tracking"
);
}
#endif
if
(
intercept_get_mode
()
==
replay
)
intercept_replay
();
else
if
(
!
intercept_replay
())
mainloop
();
return
1
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment