aboutgitcodebugslistschat
path: root/dhcpv6.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-14 01:21:29 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-14 13:16:03 +0200
commit32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05 (patch)
treed5cc1d83190b38f58eb86bd094fc5ce6f5d3eef9 /dhcpv6.c
parent66d5930ec77caed942404ceef4829f2c4ca431bd (diff)
downloadpasst-32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05.tar
passt-32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05.tar.gz
passt-32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05.tar.bz2
passt-32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05.tar.lz
passt-32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05.tar.xz
passt-32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05.tar.zst
passt-32d07f5e59f2372939a7c99c4c4bcbb5f60b0e05.zip
passt, pasta: Completely avoid dynamic memory allocation
Replace libc functions that might dynamically allocate memory with own implementations or wrappers. Drop brk(2) from list of allowed syscalls in seccomp profile. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'dhcpv6.c')
-rw-r--r--dhcpv6.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dhcpv6.c b/dhcpv6.c
index 19c7a62..d514e8d 100644
--- a/dhcpv6.c
+++ b/dhcpv6.c
@@ -588,10 +588,10 @@ int dhcpv6(struct ctx *c, struct ethhdr *eh, size_t len)
*/
void dhcpv6_init(struct ctx *c)
{
- struct tm y2k = { 0, 0, 0, 1, 0, 100, 0, 0, 0, 0, NULL };
+ time_t y2k = 946684800; /* Epoch to 2000-01-01T00:00:00Z, no mktime() */
uint32_t duid_time;
- duid_time = htonl(difftime(time(NULL), mktime(&y2k)));
+ duid_time = htonl(difftime(time(NULL), y2k));
resp.server_id.duid_time = duid_time;
resp_not_on_link.server_id.duid_time = duid_time;