Commit Graph

9 Commits

Author SHA1 Message Date
Beniamino Galvani
687d0dd95e n-dhcp4: arm timers in bound state
Arm timers when the bound state is reached, otherwise the lease is
never renewed.

https://github.com/nettools/n-dhcp4/pull/4
2019-09-18 09:29:51 +02:00
Thomas Haller
b80b25050f n-dhcp4: allocate memory of right size in n_dhcp4_client_probe_option_new()
Non-critical, as the allocated memory was larger than needed.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/224
2019-08-08 07:46:41 +02:00
Beniamino Galvani
fbdfc3f79c n-dhcp4: remove dead code
Reported by coverity.

(cherry picked from commit a32976568c)
2019-08-02 16:29:19 +02:00
Thomas Haller
6c8f35a267 n-dhcp4: avoid "-Werror=declaration-after-statement" warning with static_assert
When we build n-dhcp4 for NetworkManager we get a compiler warning.
This can also be reproduced by building n-dhcp4 alone:

  $ CFLAGS='-Werror=declaration-after-statement' meson build && ninja -C build
  ...
  [36/47] Compiling C object 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o'.
  FAILED: src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o
  ccache cc -Isrc/25a6634@@ndhcp4-private@sta -Isrc -I../src -Isubprojects/c-list/src -I../subprojects/c-list/src -Isubprojects/c-siphash/src -I../subprojects/c-siphash/src -Isubprojects/c-stdaux/src -I../subprojects/c-stdaux/src -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -g -D_GNU_SOURCE -Werror=declaration-after-statement -fPIC -fvisibility=hidden -fno-common -MD -MQ 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o' -MF 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o.d' -o 'src/25a6634@@ndhcp4-private@sta/n-dhcp4-outgoing.c.o' -c ../src/n-dhcp4-outgoing.c
  ../src/n-dhcp4-outgoing.c: In function ‘n_dhcp4_outgoing_new’:
  ../src/n-dhcp4-outgoing.c:63:9: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
     63 |         static_assert(N_DHCP4_NETWORK_IP_MINIMUM_MAX_SIZE >= N_DHCP4_OUTGOING_MAX_PHDR +
        |         ^~~~~~~~~~~~~

(cherry picked from commit 9e7ca3e091)
2019-08-02 11:48:35 +02:00
Beniamino Galvani
106c156b0f n-dhcp4: client/probe: fix memory leak
The probe takes a reference to the current lease and so it must
release it upon destruction.

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>

https://github.com/nettools/n-dhcp4/pull/1
2019-07-05 11:09:28 +02:00
Beniamino Galvani
46f81e18f7 n-dhcp4: client/connection: fix memory leak
Free the request when the connection gets destroyed.

Signed-off-by: Beniamino Galvani <bgalvani@redhat.com>

https://github.com/nettools/n-dhcp4/pull/1
2019-07-05 11:09:03 +02:00
Tom Gundersen
314134a445 n-dhcp4: avoid {net,linux}/if.h clashes on old distros
In particular, avoid including linux/netdevice.h from headers. This is
not a problem on newer distros, but required for CentOS 7.6.

Signed-off-by: Tom Gundersen <teg@jklm.no>
2019-07-05 11:04:32 +02:00
Tom Gundersen
d797611df5 shared/n-dhcp4: avoid c_min() macro to work with old GCC
This is required for the CI to pass, as CentOS has a too old version
of GCC. Ideally this patch should be dropped.
2019-07-05 11:04:32 +02:00
Tom Gundersen
e43b1791a3 Merge commit 'e23b3c9c3ac86b065eef002fa5c4321cc4a87df2' as 'shared/n-dhcp4'
Imported n-dhcp4 code with command:

  git subtree add --prefix shared/n-dhcp4/ git@github.com:nettools/n-dhcp4.git master --squash

To update the library use:

  git subtree pull --prefix shared/n-dhcp4/ git@github.com:nettools/n-dhcp4.git master --squash
2019-05-25 02:02:04 +02:00