udhcpc: option -x OPT:VAL clarification

Denys Vlasenko vda.linux at googlemail.com
Sun Dec 5 22:22:02 UTC 2010


On Sunday 05 December 2010 20:05, Abdoulaye Walsimou GAYE wrote:
> Can someone clarify usage of -x OPT:VAL please?

$ udhcpc --help
BusyBox v1.18.0 (2010-11-23 00:11:12 CET) multi-call binary.

Usage: udhcpc [-fbnqvoCR] [-i IFACE] [-r IP] [-s PROG] [-p PIDFILE]
        [-H HOSTNAME] [-V VENDOR] [-x OPT:VAL]... [-O OPT]...
...
        -x OPT:VAL              Include option OPT in sent packets (cumulative)
                                Examples of string, numeric, and hex byte opts:
                                -x hostname:bbox - option 12
                                -x lease:3600 - option 51 (lease time)
                                -x 0x3d:0100BEEFC0FFEE - option 61 (client id)


Is this text unclear?
Please provide question(s) it doesn't answer.


> I my case I want to use it to encode dhcp option 125[1], vendor 
> identifying vendor options.

Use -x 125:foo then.

> I want to know how VAL need to be in order to send dhcp option 125.
>
> from [1] ----------------------------------------------------
>     The format of the V-I Vendor-specific Information option is as
>     follows:
>      0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
>     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>     |  option-code  |  option-len   |
>     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>     |      enterprise-number1       |
>     |                               |
>     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
>     |   data-len1   |               |
>     +-+-+-+-+-+-+-+-+ option-data1  |

Well, the picture seems to be garbled. "option-data1" looks strange.
Ypou meant:

   The format of the V-I Vendor Class option is as follows:

                        1 1 1 1 1 1
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  option-code  |  option-len   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      enterprise-number1       |
   |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   data-len1   |               |
   +-+-+-+-+-+-+-+-+               |
   /      vendor-class-data1       /
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ----
   |      enterprise-number2       |   ^
   |                               |   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |
   |   data-len2   |               | optional
   +-+-+-+-+-+-+-+-+               |   |
   /      vendor-class-data2       /   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   |
   ~            ...                ~   V
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ----


Since enterprise-number1, data-len1, vendor-class-data1
are likely to be nonrepresentable as strings,
encode them as hex bytes:

-x 125:010203040506070809

replace 01 with the value of 1st byte, 02 with with the value
of 2nd one and so on.

-- 
vda


More information about the busybox mailing list