From 16f4b983de5509660f470992f3ce8e5cd1d59c3b Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 5 Oct 2021 21:15:01 +0200 Subject: 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 --- passt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'passt.c') 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); -- cgit v1.2.3