[Dnsmasq-discuss] How to configure routing via DHCP?

Simon Kelley simon at thekelleys.org.uk
Wed Feb 8 16:32:29 GMT 2006


Dirk Schenkewitz wrote:
> That's great, Thank you very much! (For the info and for supporting it.)
> Hmm, AFAIU RFC3442 describes the "raw" packet information as:
> 
> '121' Length-byte Destination-descriptor Router-address
> 
> while "Destination-descriptor" consistst of the netmask width and the 
> "important part" of the network address (it can be 1 to 5 bytes long) and the 
> "Router-address" is always 4 bytes long, optionally followed by one or more 
> blocks of  
> 
> Destination-descriptor Router-address
> 
> while the "Length-byte" specifies the number of "Destination-descriptor 
> Router-address"-blocks and is "1" if there is only one such block.

No. the length byte is the number of bytes following. This is true for 
all DHCP options, and it's important, since it allows code to manipulate 
the following data without knowing anything about it. If the length was 
the number of routes, then knowledge of the exact format of the option 
would have to be built into any code which touched it.
> 
> AFAIU, the "192.168.1.0/24" part in your example means 
> Network-Adress/Netmask-Length and the 1.2.3.4 is the gateway. Will it be 
> possible to do 
> 
> dhcp-option=121,192.168.1.0/24,1.2.3.4,10.128.0.0/9,10.129.3.4 
> 
> with dnsmasq? 
> 

Yes: it's already possible to have a comma-separated of IP addresses as 
an option, (lots of DHCP options have n IP addresses and length 4*n). 
The new code just allows an IP address to include a / character and 
encodes it suitably if it does.


>>It does depend on the client. In dnsmasq, you can always specify exactly
>>the bits you want in the transmitted packet, but using "hex and colons".
>>
>>dhcp-option=45,0e:34:e5:11
>>
>>but for most things  its easier to use one of the supported shortcuts.
>>
>>text: dhcp-option=34,"some text"
>>(list of) IP addresses:  dhcp-option=56,1.2.3.4,5.6.7.8
>>decimal number: dhcp-option=76,1
> 
> 
> Hmm... the colon form of 121,192.168.1.0/24,1.2.3.4 would be 
> 
> 121,1:18:C0:A8:1:1:2:3:4 
> 
> and the colon form of 121,192.168.1.0/24,1.2.3.4,10.128.0.0/9,10.129.3.4 (if 
> supported) would be 
> 
> 121,2:18:C0:A8:1:1:2:3:4:9:A:80:A:81:3:4 

the length byte is wrong (see above), otherwise that's right.
> 
> if I got it right... Looks like this requires some less-trivial parsing & 
> converting on your side...
> (For faster reading: 18x=24d, C0x=192d, A8x=168d, Ax=10d, 80x=128d, 81x=129d 
> provided that I didn't miscalculate anything.)
> 
> 

Cheers,

Simon.



More information about the Dnsmasq-discuss mailing list