aboutgitcodebugslistschat
path: root/passt.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-05 21:15:01 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-05 21:22:59 +0200
commit16f4b983de5509660f470992f3ce8e5cd1d59c3b (patch)
tree9c1bbda04a8b406a40389c2c37537fd0e48b08b1 /passt.c
parenta26722b8755d36acc17e787399ac085a02a2e3bd (diff)
downloadpasst-16f4b983de5509660f470992f3ce8e5cd1d59c3b.tar
passt-16f4b983de5509660f470992f3ce8e5cd1d59c3b.tar.gz
passt-16f4b983de5509660f470992f3ce8e5cd1d59c3b.tar.bz2
passt-16f4b983de5509660f470992f3ce8e5cd1d59c3b.tar.lz
passt-16f4b983de5509660f470992f3ce8e5cd1d59c3b.tar.xz
passt-16f4b983de5509660f470992f3ce8e5cd1d59c3b.tar.zst
passt-16f4b983de5509660f470992f3ce8e5cd1d59c3b.zip
passt: Shrink binary size by dropping static initialisers
...from 11MiB to 155KiB for 'make avx2', 95KiB with -Os and stripped. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.c')
-rw-r--r--passt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/passt.c b/passt.c
index 1dc1cca..77cd48c 100644
--- a/passt.c
+++ b/passt.c
@@ -54,6 +54,7 @@
#include "util.h"
#include "passt.h"
+#include "dhcp.h"
#include "dhcpv6.h"
#include "icmp.h"
#include "tcp.h"
@@ -376,8 +377,6 @@ int main(int argc, char **argv)
}
sock_probe_mem(&c);
- proto_update_l2_buf(c.mac_guest, c.mac, &c.addr4);
-
tap_sock_init(&c);
clock_gettime(CLOCK_MONOTONIC, &now);
@@ -386,6 +385,11 @@ int main(int argc, char **argv)
(!c.no_tcp && tcp_sock_init(&c, &now)))
exit(EXIT_FAILURE);
+ proto_update_l2_buf(c.mac_guest, c.mac, &c.addr4);
+
+ if (c.v4 && !c.no_dhcp)
+ dhcp_init();
+
if (c.v6 && !c.no_dhcpv6)
dhcpv6_init(&c);