Hi Michał,

Le Tue, 30 Jun 2015 17:03:09 +0200, Michał Lipka <michal@lipka.email> a
écrit :

> 2015-06-30 16:56 GMT+02:00 Albert ARIBAUD <albert.arib...@free.fr>:
> 
> > Bonjour Maciej,
> >
> > Le Tue, 30 Jun 2015 15:56:36 +0200, Maciej Soltysiak
> > <mac...@soltysiak.com> a écrit :
> >
> > > On Tue, Jun 30, 2015 at 3:24 PM, Albert ARIBAUD <albert.arib...@free.fr>
> > > wrote:
> > >
> > > > Bonjour Michał,
> > > >
> > > > Le Tue, 30 Jun 2015 13:54:11 +0200, Michał Lipka <michal@lipka.email>
> > a
> > > > écrit :
> > > >
> > > > > 2015-06-30 12:10 GMT+02:00 Maciej Soltysiak <mac...@soltysiak.com>:
> > > > >
> > > > > > On Tue, Jun 30, 2015 at 4:03 AM, wkitt...@gmail.com <
> > > > wkitt...@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > >>
> > > > > >> On 06/29/2015 04:01 PM, Michał Lipka wrote:
> > > > > >>
> > > > > >>>
> > > > > >>> 2015-06-25 16:02 GMT+02:00 wkitt...@gmail.com
> > > > > >>>     does breaking the line work?
> > > > > >>>
> > > > > >>>     eg:
> > > > > >>>     dhcp-option=249,10.0.0.1/32,1.2.3.4,192.168.13.15/32,1.2.3.4
> > > > > >>>     <http://10.0.0.1/32,1.2.3.4,192.168.13.15/32,1.2.3.4>, \
> > > > > >>>     192.168.13.16/32,1.2.3.4,192.168.13.17/32,1.2.3.4
> > > > > >>>     <http://192.168.13.16/32,1.2.3.4,192.168.13.17/32,1.2.3.4>,
> > \
> > > > > >>>     192.168.13.18/32,1.2.3.4,192.168.13.19/32,1.2.3.4
> > > > > >>>     <http://192.168.13.18/32,1.2.3.4,192.168.13.19/32,1.2.3.4>,
> > \
> > > > > >>>     192.168.13.20/32,1.2.3.4 <http://192.168.13.20/32,1.2.3.4>
> > > > > >>>
> > > > > >>>
> > > > > >>> Thank you for this idea. Unfortunately it does not work. dnsmasq
> > > > fails
> > > > > >>> at first
> > > > > >>> line which has no option:
> > > > > >>>
> > > > > >>
> > > > > >> sounds like an option that should maybe be implemented...
> > especially
> > > > > >> since it is an apparent standard that so many tools do follow ;)
> > > > > >>
> > > > > > I think dnsmasq has a 1024 characters for config lines. I browsed
> > the
> > > > > > source briefly last night but couldn't find it.
> > > > > >
> > > > >
> > > > > I checked it more precisely and it turned out that is not line length
> > > > that
> > > > > bothers dnsmasq. It's routes count.
> > > > > I can set up to 28 routes in single dhcp-option line. It doesn't
> > matter
> > > > if
> > > > > it will take 600 or 800 characters. If I set 29th route dnsmasq
> > complains
> > > > > about option too long:
> > > > >
> > > > > dnsmasq: dhcp-option too long at line 320 of /etc/dnsmasq.conf
> > > > > Can you check the code once again and try to find this limit (28) ?
> > Why
> > > > it
> > > > > is like that?
> > > >
> > > > Could it be that the total DHCP packet size goes over the maximum
> > > > allowed size for an UDP frame?
> > > >
> > > Perhaps. The offending code is related to the length of the dhcp option,
> > > not the number of routes per se:
> > >
> > >   if (!is6 &&
> > >       ((new->len > 255) ||
> > >       (new->len > 253 && (new->flags & (DHOPT_VENDOR |
> > DHOPT_ENCAPSULATE)))
> > > ||
> > >        (new->len > 250 && (new->flags & DHOPT_RFC3925))))
> > >     ret_err(_("dhcp-option too long"));
> >
> 
> route can use different number of bytes 17-33 - (1.1.1.1/8,2.2.2.2
> 111.111.111.111/32,222.222.222.222) and I checked that you can insert only
> 28 routes despite of the fact how many bytes it will take (if you try to
> assign 28 "smallest" routes it will take 28*17+27(commas)=503 and 28
> "largest" routes would take 28*33+27=951 bytes). and you cannot set 29
> "smallest" routes as it will yell "dhcp-option too long" (tested).

Er, no, a route once encoded in an option is not a variable-length
string, it is a fixed-length, 8-byte binary structure (four bytes to
encode the net, four to encode the mask).

Theoretically, that makes a maximum of 253/8 routes => 31 routes (and
then maybe there is another limit I did not consider which puts the
limit down from 31 to 28).

> > >
> > > I guess you can stick more than 255 bytes in a dhcp packet, anyone knows
> > if
> > > the limit is coming from RFCs or elsewhere?
> >
> > There is actually an option's size limit, see RFC 2132 section 2:
> > the option second byte contains the length and its content does not
> > include the tag and length fields, so the actual option content cannot
> > be bigger than 253 bytes.
> >
> 
> yes but RFC 3396 is about "Encoding Long Options in the Dynamic Host
> Configuration Protocol (DHCPv4)"

Yes, it is. The routes are among these long options.

> and setting 28 routes is working (client gets them)

Which is normal, 28*8+2 = 226 bytes which is below the absolute 253
bytes per option limit and below the 248 bytes route limit (at 8 bytes
per route).

> Michal

Amicalement,
-- 
Albert.

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to