[systemd-devel] [PATCH] networkd: act on lease only if there is one

Tom Gundersen teg at jklm.no
Mon Feb 17 14:33:44 PST 2014


On Mon, Feb 17, 2014 at 9:16 PM, Umut Tezduyar Lindskog
<umut.tezduyar at axis.com> wrote:
> Interface could go down before acquiring a dhcp lease
> ---
>  src/network/networkd-link.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
> index d83c4ce..9aca1b6 100644
> --- a/src/network/networkd-link.c
> +++ b/src/network/networkd-link.c
> @@ -626,10 +626,12 @@ static void dhcp_handler(sd_dhcp_client *client, int event, void *userdata) {
>                                  return;
>                          }
>
> -                        r = dhcp_lease_lost(link);
> -                        if (r < 0) {
> -                                link_enter_failed(link);
> -                                return;
> +                        if (link->dhcp_lease) {
> +                                r = dhcp_lease_lost(link);
> +                                if (r < 0) {
> +                                        link_enter_failed(link);
> +                                        return;
> +                                }
>                          }
>
>                          if (event == DHCP_EVENT_IP_CHANGE) {

Applied. Thanks!

Cheers,

Tom


More information about the systemd-devel mailing list