Network Services | ntp: reset cmdline parsing state between invocations (!36)
A V Vedanth (@av-vedanth)
gitlab at rtems.org
Mon May 4 21:21:34 UTC 2026
A V Vedanth created a merge request: https://gitlab.rtems.org/rtems/pkg/rtems-net-services/-/merge_requests/36
Project:Branches: av-vedanth/rtems-net-services:ntp-fix-parsing-state-reset to rtems/pkg/rtems-net-services:main
Author: A V Vedanth
## Summary
Changed scope of parsed and optct from inside parse_cmdline_opts() to global in ntpd.c .
Because parsed static local stays 1 even after first ntp run therefore skipping option processing on restart
Created :
rtems_ntp_opts_globals_fini() to reset ntpdOptions runtime fields.
parsed and optct reset to 0 and rtems_ntp_opts_globals_fini() is called in rtems_ntpd_run()
Verification test done on QEMU leon3 with `ntp01` test.
FIX : second NTP start no longer skips option processing
```
vedanth at vedanth-Legion-Pro-5-16IRX10:~/rtems_proj/rtems-net-services$ qemu-system-sparc -no-reboot -serial mon:stdio \
-m 256M \
-M leon3_generic \
-kernel ~/rtems_proj/rtems-net-services/build/sparc-rtems7-leon3/ntp01.exe
*** BEGIN OF TEST NTP 1 ***
*** TEST VERSION: 7.0.0.108b17f882a298746228e878f50442684cac6a6e
*** TEST STATE: EXPECTED_PASS
*** TEST BUILD: RTEMS_POSIX_API
*** TEST TOOLS: 15.2.0 20250808 (RTEMS 7, Build 2026.03.04, RSB 00a71896204f95cb583e6271cad4c192b62cce6d, Newlib a7c61498)
nexus0: <RTEMS Nexus device>
info: lo0: link state changed to UP
info: version 6.2.1 starting
err: no valid interfaces found
warning: no interfaces have a carrier
info: telnetd: started successfully on port 23
RTEMS Shell on /dev/console. Use 'help' to list commands.
SHLL [/] # ntpd starting
ntpd forced stop
ntpd finished: 0
ntpd starting
```
## Generative AI
Used claude code and gemini to better understand the code base.
--
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-net-services/-/merge_requests/36
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260504/48f574e3/attachment-0001.htm>
More information about the bugs
mailing list