summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv4.c
diff options
context:
space:
mode:
authorAvinash Tekumalla <avinash.tekumalla@technicolor.com>2021-12-08 18:44:36 +0530
committerHans Dedecker <dedeckeh@gmail.com>2022-03-16 20:34:56 +0100
commit860ca900e41c5d0f98cc85e67b39977f6f2cb355 (patch)
tree64c3b5bbd045aeb572fadb0d8681846f8c2337f0 /src/dhcpv4.c
parent83e14f45581757a4ea1418a64d80885c79db5ef0 (diff)
odhcpd: Support for Option NTP and SNTP
Support for DHCPv6 Option NTP (Option-56) and SNTP (Option-31), DHCP Option NTP(Option-42) is implemented. ntp list is supported for IPv4, IPv6 and FQDN. Signed-off-by: Avinash Tekumalla <avinash.tekumalla@technicolor.com> Signed-off-by: Alin Nastac <alin.nastac@technicolor.com> Signed-off-by: Ashutosh Shandilya <ashutosh.shandilya@technicolor.com> Signed-off-by: Vidya Rajagopal <vidya.rajagopal@technicolor.com>
Diffstat (limited to 'src/dhcpv4.c')
-rw-r--r--src/dhcpv4.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index a3b0e33..f078087 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -849,6 +849,14 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len,
dhcpv4_put(&reply, &cookie, DHCPV4_OPT_DNSSERVER,
4 * iface->dhcpv4_dns_cnt, iface->dhcpv4_dns);
+ if (a->reqopts && iface->dhcpv4_ntp_cnt != 0) {
+ for(size_t opts = 0; a->reqopts[opts]; opts++) {
+ if (a->reqopts[opts] == DHCPV4_OPT_NTPSERVER) {
+ dhcpv4_put(&reply, &cookie, DHCPV4_OPT_NTPSERVER,
+ 4 * iface->dhcpv4_ntp_cnt, iface->dhcpv4_ntp);
+ }
+ }
+ }
dhcpv4_put(&reply, &cookie, DHCPV4_OPT_END, 0, NULL);