On Tue, 2014-11-18 at 18:41 +0100, Tom Gundersen wrote:

> (but cc'ing Patrik just to make sure)

> > RFC 2131:
> >
> >  secs   2  Filled in by client, seconds elapsed since client
> >            began address acquisition or renewal process.

> > @@ -422,7 +423,15 @@ static int client_message_init(sd_dhcp_client *client, 
> > DHCPPacket **ret,
> >
> >          /* Although 'secs' field is a SHOULD in RFC 2131, certain DHCP 
> > servers
> >             refuse to issue an DHCP lease if 'secs' is set to zero */
> > -        packet->dhcp.secs = htobe16(client->secs);
> > +        r = sd_event_now(client->event, clock_boottime_or_monotonic(), 
> > &time_now);
> > +        if (r < 0)
> > +                return r;
> > +        assert(time_now >= client->start_time);
> > +
> > +        /* seconds between sending first and last DISCOVER
> > +         * must always be strictly positive to deal with broken servers */
> > +        secs = ((time_now - client->start_time) / USEC_PER_SEC) ? : 1;
> > +        packet->dhcp.secs = htobe16(secs);

The previous code assumed that resending a message mean really sending
an identical one in place of the lost one. This change actually nags on
the other end that time has really passed, be it a clue to a DHCP relay
that it should do something else than before. Looking at the RFC snippet
and the patch, I think this is what the RFC actually tried to say.

Cheers,

        Patrik

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to